cancel
Showing results for 
Search instead for 
Did you mean: 

Which code needs to be put in SRAM4 when using LPBAM tool

AKova.3
Associate III

I have been trying to figure out which code exactly needs to be put in SRAM4 memory region for the LPBAM tool to work. All the examples I could find only use SRAM4 and fail to explain which parts are strictly needed to be placed in that part of the memory. The most concrete explanation I could find is from a workshop on LPBAM:

https://rristm.github.io/tomas_materials_v2/RRISTM/stm32u5_workshop/master/handson4.md/3

AKova3_0-1721211628268.png

I have followed that advice and was able to get my application to work only under a debug session. With no active debug session I was getting DMA linked list update error. I tried placing all object files related to my LPBAM application (the folder generated by Cube) in SRAM4 and my application still would not run without an active debug session. If like in the examples I only use SRAM4 then my application works in both cases which makes me belive that there still is some part of the code that I am missing that needs to be placed in SRAM4. Any help would be appriciated.

1 ACCEPTED SOLUTION

Accepted Solutions

So I have figured it out. I needed to place the variable ADC_Q_Conversion_data_1_Desc of type LPBAM_ADC_ConvDataDesc_t and data buffer in SRAM4. Additionally I needed to set the variable ADC_Q_Conversion_data_1_Desc to 0. Since this is a struct, this can be done with

memset(&ADC_Q_Conversion_data_1_Desc, 0, sizeof(ADC_Q_Conversion_data_1_Desc));

I added this line to the USER CODE 0 block of Scenario Build function.

Maybe it will help someone out.

View solution in original post

3 REPLIES 3
Sarra.S
ST Employee

Hello @AKova.3

Ensure that your linker script correctly defines the SRAM4 section and that it is properly mapped (you could share it)

Only data/ variable used by DMA need to be defined in SRAM4, no other code parts are needed 

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.

AKova.3
Associate III

I have a simple application with one queue which has one ADC conversion data block inside. The conversion is triggered by LPTIM1 which I start and stop manually. After 50 samples I expect a transfer complete interrupt. The queue is not run in circular mode. While the ADC data is being sampled the device is in STOP2 mode.

The relevant part of the linker script is

AKova3_2-1721650927660.png

I have placed the buffer where ADC samples are transfered to and queue descriptor variable in SRAM4 as seen in the build analyzer

AKova3_1-1721650403857.png

The variable ADC_Q_Conversion_data_1_Desc is of type LPBAM_ADC_ConvDataDesc_t. This is the only variable of that type. I am working on NUCLEO-U5A5ZJ-Q board. Under these conditions my application won't run after I power cycle the board.

 

So I have figured it out. I needed to place the variable ADC_Q_Conversion_data_1_Desc of type LPBAM_ADC_ConvDataDesc_t and data buffer in SRAM4. Additionally I needed to set the variable ADC_Q_Conversion_data_1_Desc to 0. Since this is a struct, this can be done with

memset(&ADC_Q_Conversion_data_1_Desc, 0, sizeof(ADC_Q_Conversion_data_1_Desc));

I added this line to the USER CODE 0 block of Scenario Build function.

Maybe it will help someone out.