Hello, I'm using a PhyCore167HSE board (from Phytec). There is on this board a C167CSL40M and flash memory Am29F160DT. The problem is : - how can I write, read and erase in this memory. I have ever look on documentation and examples but I don't arrive to make run any function. Help Me please!!! Thank you Benoît
I have ever look on documentation and examples but I don't arrive to make run any function. does that include the Am29F160DT datasheet? you can not just "write to an address" for most flash memories, you need to supply a string of commands (typically about 5 bytes) which will do the job. Of course, you need to erase the section/page/chip first. as an example I include a write flash routine for another processor/another flash, but it should give you the idea
void WriteFlash (U32 WFLaddr, U8 WFLbyte) { U16 WFLoffs; U8 WFLpage; U8 WFLsvSfpg; U8 WFLsvIE; WFLoffs = (U16) (WFLaddr & 0xFFFF); WFLpage = (U8) ((WFLaddr >> 16) & 0xFF); SF_P4 &= 0xe0; SF_P4 |= WFLpage; WFLsvIE = SG_IE; SBG_IE_EA = FALSE; WFLsvSfpg = SG_SFRPAGE; SG_SFRPAGE = 0x00; S0_EMI0CF = 0x3c; // select external memory XBYTE [0x0AAA] = 0xaa; XBYTE [0x0555] = 0x55; XBYTE [0x0AAA] = 0xa0; XBYTE [WFLoffs] = WFLbyte; S0_EMI0CF = 0x30; // select internal memory SG_SFRPAGE = WFLsvSfpg; SG_IE = WFLsvIE; } // end WriteFlash