Hi. I've got evaluation board MB393B. I don't be able read CFI Query Identification String. I tried this:
GPIO_Config(GPIO2,0xF,GPIO_AF_PP); EMI_Config(0, EMI_WAITSTATE(14)|EMI_ENABLE|EMI_SIZE_16); *(u32*)0x6000000 = 0x00000098; data = *(u32*)0x6000000; //Manufacturer Code Can anybody help me? Thanks Jack
Making sure ALL of your pins are configured as GPIO_AF_PP (it is rather evident that the bus should be configured properly), so try this; works fine with my board... GPIO_Config(GPIO2, 0x0001 , GPIO_AF_PP); // Bank0 CS (Flash) GPIO_Config(GPIO2, 0x0002 , GPIO_AF_PP); // Bank1 CS (SRAM) GPIO_Config(GPIO2, 0x0004 , GPIO_AF_PP); GPIO_Config(GPIO2, 0x0010 , GPIO_AF_PP); // Addr20-23 GPIO_Config(GPIO2, 0x0020 , GPIO_AF_PP); GPIO_Config(GPIO2, 0x0040 , GPIO_AF_PP); GPIO_Config(GPIO2, 0x0080 , GPIO_AF_PP); //configure the EMI so /CSO is pointing the flash, 16 bits large, 15 WS EMI_Config(0, EMI_ENABLE | EMI_WAITSTATE(15) | EMI_SIZE_16); //the board has a ST M28W320CB chip on it... //read electronic signature, for manuf and device *(u8*) 0x60000000=0x90; u32 EMIData=*(u32*)0x60000000; //should be 00 02: manuf code *(u8*) 0x60000000=0x90; EMIData=*(u32*)0x60000002; //should be 88 BB: device code-Bottom block Best regards, tech
It works, but I don't know why is the address 60000002, why isn't there 60000001 (I found it in data sheet.)? It works with 2, but I don't know why. EMIData=*(u32*)0x60000002; //should be 88 BB: device code-Bottom block Can You give me an example with writing and reading something to Flash? I tried: Vpp_On(); //Vpp high *(u8*)(0x60000000)=0x0040; //write command *(u32*)(0x60000EEE)=0x1234; //write 1234 *(u8*) 0x60000000=0x00FF; //read command data=*(u32*)0x60000EEE; //should be 1234 Thank You Jack.
Example to read: u16 function_to_read(u32 add) *(u8*)0x60000000=0xFF; return *(u16*)add; and to write: u8 program(u32 add, u16 data) *(u8*)0x60000000=0x40; *(u16*)add=data; You should read the datasheet on the M28W320CB, lots of good things to find... particularly about errors from the status register. Note: you won't be able to ``see`` the data you wrote in the debugger, just the status register(sometimes), because obviously the debugger is not sending the appropriate command to read the flash. Reading the flash back with a temp variable is your best option. Also, write a routine to read the status register, you'll find millions of use for it (waiting for a write completion, checking errors, erase status...) Have fun! Best regards, Jp