- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am trying to interface NOR flash (S29GL128S10DHB010) to TMS570 by EMIF (which generate the address, data and control signal for external NOR flash.)
I am used the following code to read manufacture id, but not getting correct data. I am getting only 0x00.
Address mapped to external NOR flash memory is 0x60000000 to 0x6C000000.
I could not probe the signal since the board is done by multi layer.
Also I tried to write a single word to a memory location, it is not working, most of the time the memory is filled with value 0x0000e000.
I am also sharing the code for write word to memory.
Is my sequence correct ? or we have any other method to test ?
void Autoselect()
{
uint16_t *base_addr = (uint16_t *)0x60000000;
uint16_t *pa = (uint16_t *)0x60000000;
uint16_t manuf_id ;
*( (uint16_t *)base_addr + 0x555) = 0x00AA; /* write unlock cycle 1 */
*( (uint16_t *)base_addr + 0x2AA) = 0x0055; /* write unlock cycle 2 */
*( (uint16_t *)base_addr + 0x555) = 0x0090; /* write program setup command */
manuf_id = *( (uint16_t *)base_addr + 0x000 ); /* read manuf. id */
/*
Autoselect exit */
*( (uint16_t *)base_addr + 0x000 ) = 0x00F0; /* exit autoselect (write reset command) */
}
void program_word()
{
uint16_t *base_addr = (uint16_t *)0x60000000;
uint16_t *pa = (uint16_t *)0x60000000;
uint16_t Write_data = 0xAABB;
*( (uint16_t *)base_addr + 0xAAA) = 0x00AA; /* write unlock cycle 1 */
*( (uint16_t *)base_addr + 0x555 ) = 0x0055; /* write unlock cycle 2 */
*( (uint16_t *)base_addr + 0xAAA) = 0x00A0; /* write program setup command */
*( (uint16_t *)pa ) = Write_data; /* write data to be programmed */
}
Thanks and Regards,
Ragesh M R
Solved! Go to Solution.
- Tags:
- s29gl128s10
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Ragesh,
The flash should be mapped to: 0x60000000 to 0x61000000 and not 0x6C000000.
This can be an issue with the controller settings.
“base_addr” and “pa” variables must have the “volatile” descriptor when defined, otherwise the compiler will optimize the write cycles and make one cycle out of them, which is wrong of course.
The unlock cycles address for writing are wrong. These should be:
*( (uint16_t *)base_addr + 0x555) = 0x00AA; /* write unlock cycle 1 */
*( (uint16_t *)base_addr + 0x2AA ) = 0x0055; /* write unlock cycle 2 */
*( (uint16_t *)base_addr + 0x555) = 0x00A0; /* write program setup command */
The polling for operation completion (programming in this case) is also missing. This can be done either using the DQ polling or using the status register. Details are in the datasheet.
Thank you
Regards,
Bushra