2023-08-16 02:35 PM
I am working with Discovery kit with STM32U5A9NJ MCU (MB1829) and I am trying to implement code to read and write the PSRAM (APS512XXN-OBRx DDR Octal SPI PSRAM) in memory mapped mode.
All GPIOs are properly configured. (I used MXCube)
The configurations are done following the instructions in the datasheet (RM0456 Rev 4), the driver comments in stm32u5xx_hal_xspi.c file and the datasheet for the PSRAM ( APS512XXN-OBR-BE.pdf)
HAL_XSPI_Init()
HAL_XSPI_Command()
HAL_XSPI_MemoryMapped()
Access method: Dereferencing the pointer to:
#define HSPI1_BASE (0xA0000000UL)
mem_addr = (__IO uint8_t *)(HSPI1_BASE + 0x0);
I also added the new xrw section into the linker file with origin 0xa0000000
The reads seem to work, but the writes are not updating the memory. I checked the MPU and I don’t see a problem there.
Could you please provide sample examples of how to configure the PSRAM on HSPI1 in memory mapped mode?
Regards,
EF.
2023-08-17 05:44 AM
Hello @efekete and welcome to the community :),
Please check the errata HSPI cases in the Errata sheet ES0553 and precisely 2.6.2 and 2.6.3 errata.
Also, the BSP example in STM32CubeU5 shows how to erase, write and read data available on the HexaDecaSPI ram memory available on the board may be can help you.
Could you please share your HSPI configuration?
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.
2023-08-17 02:06 PM
Thank you, I will check those.
One of the configurations I've tried is:
CR 30000001
DCR1 060F0000
DCR2 00000000
DCR3 00000000
DCR4 00000000
SR 00000000
FCR 00000000
DLR 00000000
AR 00000000
DR 00000000
PSMKR 00000000
PSMAR 00000000
PIR 00000000
CCR 24003C0C
TCR 00000004
IR 00000000
ABR 00000000
LPTR 00000000
WPCCR 00000000
WPTCR 00000000
WPIR 00000000
WPABR 00000000
WCCR 24003C0C
WTCR 00000003
WIR 00000080
WABR 00000000
HLCR 00000000
CALFCR 00000000
CALMR 00000000
CALSOR 00000000
CALSIR 00000000
Now I I am facing one more problem. No matter how I configure the HSPI parameters for DCR1, I always read the value 071F3F00 which seems to be invalid