cancel
Showing results for 
Search instead for 
Did you mean: 

Isn't external NOR Flash memory mapped in write too ?

ranran
Senior II

Hello,

I tried to access external nor flash in stm32h743 eval board.

After configuring it I can view the memory in debugger (IAR).

But it fails when trying to access it from debugger memory view (0x60000000) - after erasing the sector.

I see that the HAL API for accessing the NOR flash HAL_NOR_Program is setting the address in HAL driver:

  /* Send program data command */
  NOR_WRITE(NOR_ADDR_SHIFT(deviceaddress, uwNORMemoryDataWidth, NOR_CMD_ADDRESS_FIRST), NOR_CMD_DATA_FIRST);
  NOR_WRITE(NOR_ADDR_SHIFT(deviceaddress, uwNORMemoryDataWidth, NOR_CMD_ADDRESS_SECOND), NOR_CMD_DATA_SECOND);
  NOR_WRITE(NOR_ADDR_SHIFT(deviceaddress, uwNORMemoryDataWidth, NOR_CMD_ADDRESS_THIRD), NOR_CMD_DATA_PROGRAM);

Probably these address setting can explains why trying to access it like a regular memory in write - does not work.

Is it correct that flash NOR is not memory mapped in write ?

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions

Writing to the NOR requires magic sequences like those used by HAL_NOR_Program, you can't just write variables or memcpy​() into it.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

5 REPLIES 5

You can't read/execute from it concurrently with write/erase as the device returns status information rather than data.​

The mapping for read/write should be identical, but caching and buffering should not be used.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
ranran
Senior II

Hi,

I don;t try to do it concurrently., I just tried to write.

writing directly (as if it is a memory mapped device) does not work. Only writing using the HAL API for nor works.

I just mentioned that reading directly (not concurrently, but in other times) , works just fine.

Thanks

Ok, but the debugger is​ trying too, and you specifically cite it as being problematic.

I wouldn't recommend single stepping this code with the debugger probing the same memory space.

Pretty confident the state machine in the NOR Flash will malfunction.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
ranran
Senior II

I also tried to do the writing without debugger. It also does not work. Only if I'll use the HAL function HAL_NOR_Program  then writing does work.

Yet, reading is memory-mapped (not only in debugger).

Writing to the NOR requires magic sequences like those used by HAL_NOR_Program, you can't just write variables or memcpy​() into it.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..