cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7 RAM and DMA after bootloader not work

Msolinas
Senior

Hi everyone, I have a problem with placing data in RAM from DMA with H7. I have a custom bootloader that then jumps to the application that uses ADC, + DMA, TIM + DMA etc.. I ran the classic __attribute__((section(".D1buffer"),used)) and modified it on the .ld by adding its section, although with the latest ld files it is not needed.
This happens: When I compile the project without including the bootloader everything works perfectly, but when I include the bootloader, after the jump the DMA stops working.

Do I need to do any realignment or setup before jumping?

On the bootloader side I run this before jumping and clear every interrupt and blank everything:

void
applicationJump(void){


typedef void(*pFunction)(void);
volatile uint32_t BootAddr=BOOT_APP_ADDR;
uint32_t JumpAddress=*(__IO uint32_t*)(BootAddr+4);
pFunction JumpToApplication=(pFunction)JumpAddress;

HAL_MPU_Disable();
HAL_SuspendTick();

__HAL_RCC_AHB1_FORCE_RESET(); __HAL_RCC_AHB1_RELEASE_RESET();
__HAL_RCC_AHB2_FORCE_RESET(); __HAL_RCC_AHB2_RELEASE_RESET();
__HAL_RCC_AHB3_FORCE_RESET(); __HAL_RCC_AHB3_RELEASE_RESET();
__HAL_RCC_APB4_FORCE_RESET(); __HAL_RCC_APB4_RELEASE_RESET();
__HAL_RCC_APB1L_FORCE_RESET(); __HAL_RCC_APB1L_RELEASE_RESET();
__HAL_RCC_APB1H_FORCE_RESET(); __HAL_RCC_APB1H_RELEASE_RESET();

HAL_MspDeInit();
__disable_irq();

SysTick->CTRL=0U;
SysTick->LOAD=0U;
SysTick->VAL=0U;

HAL_RCC_DeInit();

for(uint8_t i=0U;i<7U;i++)
{NVIC->ICER[i]=0xFFFFFFFF; NVIC->ICPR[i]=0xFFFFFFFF;}//

__enable_irq();

SCB->ICSR|=SCB_ICSR_PENDSTCLR_Msk;
SCB->SHCSR&=~( _SHCSR_USGFAULTENA_Msk|SCB_SHCSR_BUSFAULTENA_Msk|SCB_SHCSR_MEMFAULTENA_Msk);

if(CONTROL_SPSEL_Msk&__get_CONTROL())
{__set_CONTROL(__get_CONTROL()&~CONTROL_SPSEL_Msk);}

__HAL_RCC_SYSCFG_CLK_ENABLE();

__set_MSP(*(__IO uint32_t*)BootAddr);
__set_CONTROL(0);

JumpToApplication();
}
but with or without I get no change.
 
1 ACCEPTED SOLUTION

Accepted Solutions

Found problem, in bootloader was SCB_EnableDCache(); and before jump it must be disabled, DMA can't work with this on. Can I click self Kudos? :D

View solution in original post

5 REPLIES 5
Msolinas
Senior

rereading what I wrote, I understood that I wrote very badly, sorry for my English.
I have an application, a project that is launched from a classic bootloader.
If I carry out the programming on the micro without having it launched by the bootloader, it continues without problems, in it the DMA on the ADC, serial etc. they're doing great.
But if I load the bootloader which in turn launches the application, the processes that use the DMA stop and jam.
I think I wrote better, above, the list of what I do on the bootloader side before jumping to the application. I hope I explained myself well :D

Found problem, in bootloader was SCB_EnableDCache(); and before jump it must be disabled, DMA can't work with this on. Can I click self Kudos? :D

FBL
ST Employee

Hello @Msolinas 

Have you tried to check the map file, size of the program? Make sure that the bootloader and application are not overlapping in memory. 

 

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.

Ah thank you for the feedback. I have seen this before. Here is a similar case : Solved: Problems using the Cache and SCB_DisableDCache in ... - STMicroelectronics Community

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.

thanks Belaid 😉