2024-11-28 04:46 PM - last edited on 2024-11-28 11:41 PM by SofLit
Symptom:
STM32H7S78-DK board includes a 32MB PSRAM (APS256XXN-OBR-BG() connected to HEXASPI. Somehow only the first 4MB is accessable.
How to reproduce the error:
Use the template project provided in "STM32Cube_FW_H7RS_V1.1.0\Projects\STM32H7S78-DK\Templates\Template_XIP" add the following code in the app's main.c:
/* USER CODE BEGIN 0 */
#include <stdbool.h>
bool TestExRam()
{
unsigned char* address = (unsigned char*)0x90000000;
int ramSize;
ramSize = 32*1024*1024; // failed at 0x90400000 which means only 4MB RAM is accessible.
//ramSize = 4*1024*1024; // passed test.
unsigned char* begin = address;
unsigned char* end = begin + ramSize;
unsigned char* p = begin;
char c = 0;
while(p < end) {
*p = c;
p++;
c++;
}
// Check whether the data is correct:
c = 0;
p = begin;
while(p < end) {
if (c != *p) {
// error!
return false;
}
c++;
p++;
}
return true;
}
/* USER CODE END 0 */
// Call the test function in user code section 2:
/* USER CODE BEGIN 2 */
/* Initialize LD1 */
BSP_LED_Init(LD1);
if (!TestExRam()) {
Error_Handler();
}
/* USER CODE END 2 */
A fault error will be generated when the RAM access loop goes beyond 0x90400000.
Any advice or insights to address this issue would be greatly appreciated.
Thank you!
David
Solved! Go to Solution.
2024-11-29 04:11 PM
The problem is solved.
Two issues were identified and resolved to fix the external memory error.
1. The App's linker file STM32H7S7L8HXH_ROMxspi1_RAMxspi2.ld (located in: STM32Cube_FW_H7RS_V1.1.0\Projects\STM32H7S78-DK\Templates\Template_XIP\STM32CubeIDE\Appli\) required an update to the external memory size.
The original value was:
__EXTRAM_SIZE = 0x00400000
It was updated to:
__EXTRAM_SIZE = 0x02000000
2. The external memory size specified in the STM32CubeIDE Configuration Editor located at Middleware and Software Packs -> EXTMEM_MANAGER -> Memory 2 -> Memory Size needed correction.
The original setting was 32MB, which was changed to 256MB.
It was noted that the editor interprets the value in megabits (Mbit), not megabytes (MB).
After updating the linker file and the .ioc file with the corrected memory size, regenerating the code, and rebuilding the project, the external RAM (32MB) worked as expected.
Best regards,
David
2024-11-29 04:11 PM
The problem is solved.
Two issues were identified and resolved to fix the external memory error.
1. The App's linker file STM32H7S7L8HXH_ROMxspi1_RAMxspi2.ld (located in: STM32Cube_FW_H7RS_V1.1.0\Projects\STM32H7S78-DK\Templates\Template_XIP\STM32CubeIDE\Appli\) required an update to the external memory size.
The original value was:
__EXTRAM_SIZE = 0x00400000
It was updated to:
__EXTRAM_SIZE = 0x02000000
2. The external memory size specified in the STM32CubeIDE Configuration Editor located at Middleware and Software Packs -> EXTMEM_MANAGER -> Memory 2 -> Memory Size needed correction.
The original setting was 32MB, which was changed to 256MB.
It was noted that the editor interprets the value in megabits (Mbit), not megabytes (MB).
After updating the linker file and the .ioc file with the corrected memory size, regenerating the code, and rebuilding the project, the external RAM (32MB) worked as expected.
Best regards,
David
2024-12-02 01:38 AM
Hello @David123 and welcome to the community,
Glad to know that your problem is solved.
Thank you for reporting this issue and sharing the solution.
About the wrong "Memory Size" in EXTMEM_MANAGER configuration, I reported this issue internally.
>The App's linker file STM32H7S7L8HXH_ROMxspi1_RAMxspi2.ld (located in: STM32Cube_FW_H7RS_V1.1.0\Projects\STM32H7S78-DK\Templates\Template_XIP\STM32CubeIDE\Appli\)
For __EXTRAM_SIZE issue size, I did not find STM32H7S7L8HXH_ROMxspi1_RAMxspi2.ld file in "STM32Cube_FW_H7RS_V1.1.0\Projects\STM32H7S78-DK\Templates\Template_XIP\STM32CubeIDE\Appli\" path.
Do you mean STM32H7S7L8HXH_FLASH.ld file in "STM32Cube_FW_H7RS_V1.1.0\Projects\STM32H7S78-DK\Templates\Template_XIP\STM32CubeIDE\Appli\"?
Internal ticket number: 186407 (This is an internal tracking number and is not accessible or usable by customers).
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.
2024-12-02 09:40 AM - edited 2024-12-02 09:41 AM
Hi Kaouthar,
Thank you for your message and for reporting the issue internally.
You are correct the linker file path I referred to should indeed be:
STM32Cube_FW_H7RS_V1.1.0\Projects\STM32H7S78-DK\Templates\Template_XIP\STM32CubeIDE\Appli\STM32H7S7L8HXH_FLASH.ld.
I apologize for the mistake in my earlier communication.
Best regards,
David
2024-12-02 11:45 PM
Hello @David123,
I reported this issue internally for check and fix.
Thank you for your contribution to the community.
Internal ticket number: 197582 (This is an internal tracking number and is not accessible or usable by customers).
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.
2024-12-03 03:33 PM
Hi Kaouthar,
Thank you, I really appreciate your efforts.
Best regards,
David