==== 3) Erasing, Loading, and Verifying the SPI Flash ====
The [http://ww1.microchip.com/downloads/en/DeviceDoc/20005262C.pdf SST26VF016B] flash chip can be programmed by an SPI programmer attached to the SPI pins of the CW308. Attach a jumper to J8 on the CW308, pulling nRST to GND. Ensure both the target and your SPI programmer are powered. PDIC must be driven high during the programming process to enable communication through the buffer chip. The [http://ww1.microchip.com/downloads/en/DeviceDoc/20005262C.pdf SST26VF016B] flash chip uses global block protection that must be disabled before every write operation. This is done by sending the command code '''98''' to the chip before erasing or writing to the device. This can be done by configuring a custom transaction in your flash programming software. Below is a table of useful information for configuring your programming software. The Parameters listed here have been tested with the Total Phase Flash Center software and the Aardvark I<sup>2</sup>C/SPI Host adapter. See the [http://ww1.microchip.com/downloads/en/DeviceDoc/20005262C.pdf SST26VF016B data sheet] for more details. {| class="wikitable"!Parameter!Value|-|deviceName|SST26VF016B|-|deviceDescription|SST SST26VF016B 16 Megabyte SPI Flash|-|capacity|16*1024*1024|-|maxBitrate|8*1000|-|addressWidth |3|-|writeSize|256|-|writeTime|64|-|writeAutoAddressIncrementSize|2|-|writeAutoAddressIncrementTime|10|-|readDeviceIdInstruction|0x9F|-|expectedDeviceId|\xbf\x26\x41|-|eraseAllInstruction|0xC7|-|eraseAllTime|16000|-|userTransaction1|\x98|-|userTransaction1Time|10000|-|userTransaction1WriteEnable|false|} ==== 4) Running the Program ====Remove the reset jumper from J8 on the CW308 to allow the target to power up. Startup can take some time with larger programs as the Secure Boot ROM loads the program into RAM.