Altera_Forum
Honored Contributor
21 years agoIntel CFI Flash & HAL drivers
Hi,
I'm porting some code to our target board which uses the HAL to save settings in Flash. The code works just fine on the Stratix dev. kit board, but fails to program the flash on my target board. What's different? The target has an 8MB Intel Strataflash CFI part in place of the AMD part. It's a 16-bit part, but is used in an 8-bit configuration (#BYTE Low - and yes, I have NIOS SDK 1.01). I'm also aware that the parthas 64 128K sectors rather than 128 64K sectors. What works? The device can be programmed with "nios2-flash-programmer" command line, and the system boots and runs. Once running, the HAL seems happy with the CFI query information, and has correctly worked out the device type and architecture. What goes wrong? I'm using the standard HAL calls to open/write/close the flash device. I open it OK, but the write fails. At first, I was getting a 'command sequence error' status from the flash (0xB0) when HAL tried to unlock the sector. This seemed odd, as the sector shouldn't be locked in the first place. I think the HAL code to read sector 'locked' state is accessing the wrong flash location (should be "block_offset+4" instead of +2, as A0 is ignored) Having fixed that, I now get the "command sequence error" status while trying to erase the flash block http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/sad.gif - the code looks fine, and the hardware does appear to be otherwise working OK. Does anyone have any suggestions - and has anyone else successfully used the HAL drivers to write to Intel Strataflash CFI devices? - Roddy