cancel
Showing results for 
Search instead for 
Did you mean: 

How to read/write from external memory in RiverDI RVT50HQSNWN00 module for OTA update

RiverDi_user
Associate III

Hello,

I am facing the below scenario in my development board. I am trying to do OTA update in my RIverDI 5 inch display module. I receive the firmware chunk from the ESP board which is connected through the external connectors of the riverDI module and through USART1. The USART1 receives the firmware elf chunks and I need to store them in the STM32. The size of my elf file is more than 3MB and I cant directly store the data in the internal flash memory. The only option that I have right now is the external memory, but I am unable to read/write from it.

When I looked through the internet, it was not suggested to write into the external memory since it is allocated for storing the TouchGfx Assets. But my only option is to store the elf file chunks in the external memory and use the same for the OTA update process.

This is what I tried to do in my appliation.

1. Initialized the OSPI in main 

MX_OCTOSPI1_Init();

2. Made sure the Memory mapped more is enabled and the API response for OSPI_NOR_EnableMemoryMappedMode() is 0

3. Called memcpy() to write a simple string into the external memory location

memcpy( (uint8_t *)0x91000000, "hello", 5);

 

I receive a hardfault handler error when I call the memcpy(). Can you please let me know what am I doing wrong here?

RiverDi_user_0-1729248868688.png

 

Regards

RiverDI user

 

19 REPLIES 19

Yes, its related.

So why two threads on the same subject?

SofLit
ST Employee

Hello,

You question does not seem to be related to TouchGFX but how to write to a QSPI Flash.

So, as you are writing to a NOR Flash this is not correct. memcpy is only used for volatile RAM. 

 

memcpy( (uint8_t *)0x91000000, "hello", 5);

 

You need to program that Flash. You can isnspire from this example: https://github.com/STMicroelectronics/STM32CubeH7/tree/master/Projects/STM32H743I-EVAL/Examples/QSPI/QSPI_ReadWrite_IT

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

That was a generic query and this is specific to the hardfault handler when I tried to access the external flash address location. 

What's the size of the region being mapped. Trapping at 16MB

Check Size field passed at OSPI Init

 

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

Hello @RiverDi_user ,

 

Could you please check if DQSE bit is set or not?

Because it is mentioned in the errata sheet, when doing memory-mapped writes it is recommended to set the DQSE bit of the OCTOSPI_WCCR register, even for memories that have no DQS pin. 

KDJEM1_0-1729525091782.png

Thank you.

Kaouthar

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Its set as 0, but I am unable to set to 0x1

RiverDi_user_0-1729606922311.png

 

Hello @RiverDi_user ,

 

You need to enable the DQS by using a line of code, like this:

sCommand.DQSMode = HAL_XSPI_DQS_ENABLE;

Please take a look at this example OSPI_NOR_MemoryMapped and get inspired. I think can help you.

 

Thank you.

Kaouthar

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.