Skip to main content
Aarra.1
Associate III
March 1, 2023
Solved

What is the significance of SRAM Bank swapping?

  • March 1, 2023
  • 2 replies
  • 3106 views

Hello all,

While configuring the FMC SRAM configurations for STM32H747 MCU I found the option for bank swapping.

As I see the reference manual I understand that the chip select configured interchanges it's address with that of the SDRAM bank addresses.

And I did face an issue to read and write from the SRAM but when I enabled the bank swap option in the cube MX now my SRAM responds correctly.

Kindly help me out in understanding the role of BANK SWAPPING here.

Thank You!

This topic has been closed for replies.
Best answer by Ghofrane GSOURI

Hello @Aarra.1​ 

First let me thank you for posting.

In the context of SRAM configurations for microcontrollers like the STM32H747, bank swapping refers to the ability to swap the memory map between two or more memory banks, typically for the purpose of allowing more efficient access to memory.

When a microcontroller has multiple banks of SRAM, bank swapping allows the programmer to access different banks of SRAM as if they were contiguous blocks of memory, even though they may physically be located in different areas of the chip. This can be useful when working with large data sets or when multiple tasks need to access different areas of memory simultaneously.

In the case of the STM32H747, enabling bank swapping may have resolved your issues with reading and writing from the SRAM because it allowed the microcontroller to access the correct bank of memory when accessing specific addresses. Without bank swapping enabled, the microcontroller may have been attempting to access the wrong bank of memory, resulting in errors or unexpected behavior..

BR,

Ghofrane

2 replies

Ghofrane GSOURI
Ghofrane GSOURIBest answer
Technical Moderator
March 3, 2023

Hello @Aarra.1​ 

First let me thank you for posting.

In the context of SRAM configurations for microcontrollers like the STM32H747, bank swapping refers to the ability to swap the memory map between two or more memory banks, typically for the purpose of allowing more efficient access to memory.

When a microcontroller has multiple banks of SRAM, bank swapping allows the programmer to access different banks of SRAM as if they were contiguous blocks of memory, even though they may physically be located in different areas of the chip. This can be useful when working with large data sets or when multiple tasks need to access different areas of memory simultaneously.

In the case of the STM32H747, enabling bank swapping may have resolved your issues with reading and writing from the SRAM because it allowed the microcontroller to access the correct bank of memory when accessing specific addresses. Without bank swapping enabled, the microcontroller may have been attempting to access the wrong bank of memory, resulting in errors or unexpected behavior..

BR,

Ghofrane

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.
Aarra.1
Aarra.1Author
Associate III
March 10, 2023

Hello @Ghofrane GSOURI​ ,

Thank you for your response.

Technical Moderator
March 3, 2023

Hello @Aarra.1​ 

It depends on your application, are you enabling the cache for example?

Enabling the SRAM bank swapping allows to access the SDRAM banks at two different addresses mapping. So, it is possible that accessing normal memory should solve your issue.

You may refer to the datasheet and the reference manual RM0399 Table 6. Memory map and default device memory area attributes.

Hope this helps!

Firas

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.Best regards,FBL
Aarra.1
Aarra.1Author
Associate III
March 10, 2023

Hello @F.Belaid​ 

Thank you for your response.

Yes my cache is enabled im using LWIP for ethernet communication.