2019-03-11 02:02 AM
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
Solved! Go to Solution.
2019-03-11 05:12 AM
Writing to the NOR requires magic sequences like those used by HAL_NOR_Program, you can't just write variables or memcpy() into it.
2019-03-11 03:55 AM
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.
2019-03-11 04:52 AM
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
2019-03-11 04:57 AM
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.
2019-03-11 05:02 AM
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).
2019-03-11 05:12 AM
Writing to the NOR requires magic sequences like those used by HAL_NOR_Program, you can't just write variables or memcpy() into it.