cancel
Showing results for 
Search instead for 
Did you mean: 

Switching from read only memory mapped mode to Indirect mode and vice versa in STM32F746G-Discovery board.

Pradeep Sathyan
Associate II
Posted on May 21, 2018 at 07:26

Hello everyone, I am just a beginner in ARM development. I have started a GUI development on STM32F746G-Discover board, After couple of days my project got too many screens and I had to use the on board external QSPI-Flash for storing my program (near to 4 MB). It is working fine on memory mapped mode, I store all the BMP to C files and all. 

But the problem started when I'm trying to use this external QSPI flash also as a database, which means I wanna write data to it, which means I need to switch from read only memory mapped mode to Indirect mode and vice versa. I was trying to use HAL function comes with the board not digging deep into register or assembly level. but my screen freezes whenever I change from memory mapped to indirect mode, I assume it is because of the code it self is residing on external flash. Then I tried writing 

/* Stop memory mapped mode */

  QUADSPI->CCR &= (~(QUADSPI_CCR_FMODE));

  QUADSPI->CCR |= (~(HAL_QSPI_STATE_ABORT));

to HAL in a different function. but that also failed. can anyone help me with this?

https://community.st.com/tags♯/?tags=stm32f746g-disco

‌

https://community.st.com/tags♯/?tags=qspi%20flash

‌

https://community.st.com/tags♯/?tags=segger

‌

https://community.st.com/tags♯/?tags=embedded%20gui

‌

#segger #qspi-flash #stm32f746g-disco #stm32f7-nand #embedded-gui
3 REPLIES 3
Pradeep Sathyan
Associate II
Posted on May 22, 2018 at 11:30

It got solved. Don't bother to answer. 

Pradeep Sathyan
Associate II
Posted on May 22, 2018 at 12:07

Actually the solution is very simple we need to call 'BSP_QSPI_Init()' before every mode switching happen. 

/* code in memory mapped mode */

/* code in memory mapped mode */

BSP_QSPI_Init();

BSP_QSPI_Write('DATA TO BE WRITTEN TO FLASH', 0xFFFFCA, sizeof('

DATA TO BE WRITTEN TO FLASH

'));

BSP_QSPI_Read(qspi_aRxBuffer, 0xFFFFCA, sizeof(

qspi_aRxBuffer

));

/* Now its on Indirect mode */

/* Do all your read write erase code here */

BSP_QSPI_Init();

BSP_QSPI_EnableMemoryMappedMode(); // Back to memory mapped mode

/* code in memory mapped mode */

/* code in memory mapped mode */

NOTE: Do calculate upto which address your code is present, and eliminate that much portion from writing data to it. I think the address you give in the HAL functions is not memory mapped address. After '0x9000 0000' is the memory mapped address of the QSPI flash but in function's perspective it starts from '0x0000 00'.

Posted on May 22, 2018 at 11:42

Hi

appusgoldfish

,

It is good to hear that it was solved

The idea behind the STM32 forum is to look for help and share experiences/solutions.

So it will be interesting if you can let other users know how you resolved your issue. It may be helpful for someone else facing same issue.

-Nesrine-