2025-02-16 9:17 AM
Hey ST,
In the FW package that comes with the STM32H7S78-DK, I've been using the Template-XIP project as the base for my own project, and I noticed this issue with the MPU setup of the external SDRAM on the XSPI1 line. Whenver I would try and access memory above 4MB of the external ram chip, I would see a memory controller fault, and my Firmware would halt it's operation.
In all of the MPU setup and extmem manager code, the size of this chip is always defined as "32MB". Which would be correct if this define was made for Bytes. But, Since it's an all caps define, I think what probably happened, is that all the defines are written in terms of MegaBits, Instead of MegaBytes, but are following an all caps convention. You can see this in the file stm32h7rsxx_hal_xspi.h:
#define HAL_XSPI_SIZE_1MB (0x00000010U) /*!< 1 Mbits (128 KByte = 2^(16+1)) */
#define HAL_XSPI_SIZE_2MB (0x00000011U) /*!< 2 Mbits (256 KByte = 2^(17+1)) */
#define HAL_XSPI_SIZE_4MB (0x00000012U) /*!< 4 Mbits (512 KByte = 2^(18+1)) */
#define HAL_XSPI_SIZE_8MB (0x00000013U) /*!< 8 Mbits ( 1 MByte = 2^(19+1)) */
#define HAL_XSPI_SIZE_16MB (0x00000014U) /*!< 16 Mbits ( 2 MByte = 2^(20+1)) */
#define HAL_XSPI_SIZE_32MB (0x00000015U) /*!< 32 Mbits ( 4 MByte = 2^(21+1)) */
#define HAL_XSPI_SIZE_64MB (0x00000016U) /*!< 64 Mbits ( 8 MByte = 2^(22+1)) */
#define HAL_XSPI_SIZE_128MB (0x00000017U) /*!< 128 Mbits ( 16 MByte = 2^(23+1)) */
#define HAL_XSPI_SIZE_256MB (0x00000018U) /*!< 256 Mbits ( 32 MByte = 2^(24+1)) */
So, I've went through all of the MPU and Exmem Manager code, and changed all references to 32MB for external ram usage to 256MB.
This fixed my error, and I can access the whole Chip.
Maybe this should be a github issue, or an internal Ticket. Just thought I would post up here, since I would guess this bug might have propagated into other example projects using this external ram chip.
Thanks,
-Hal
Solved! Go to Solution.
2025-02-17 2:01 AM - edited 2025-02-17 3:32 AM
Hello @halfordC;
Thank you for bringing this issue to our attention.
I reported it internally for checking and correction.
Internal ticket number: 203382 (This is an internal tracking number and is not accessible or usable by customers)
Thank you for your contribution to the community.
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.
2025-02-17 2:01 AM - edited 2025-02-17 3:32 AM
Hello @halfordC;
Thank you for bringing this issue to our attention.
I reported it internally for checking and correction.
Internal ticket number: 203382 (This is an internal tracking number and is not accessible or usable by customers)
Thank you for your contribution to the community.
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.