2005-11-09 01:40 AM
2005-11-02 01:59 AM
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 Jack2005-11-02 02:52 AM
Hi,
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, tech2005-11-02 11:39 PM
Thank you, 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.2005-11-03 07:08 PM
Hi, it's pointer to 16-bit variable, so address is 0, 2, 4, ... I think. Jack.
2005-11-04 01:57 AM
You tought right. 16 bit means even addressing...
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, Jp2005-11-08 06:45 PM
Hi. Thank you. I found out that I have set bits in Protection Register Lock (0x0006). Is it impossible clear them? Jack.
2005-11-09 01:40 AM
Check out the M28W320 datasheet, everything you need is in there; block unlock is at p. 14
I attached the document for your reference. (.pdf format) Regards, Tech ________________ Attachments : m28w320cb.pdf : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I1Oz&d=%2Fa%2F0X0000000bmY%2FBvX8UrgVchKY6.i48pGGsdoN0w2QMX621EFCxJ_p20g&asPdf=false