2023-09-19 03:38 AM
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();
}
Solved! Go to Solution.
2023-09-20 07:30 AM
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
2023-09-19 08:47 AM
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
2023-09-20 07:30 AM
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
2023-09-20 08:01 AM
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.
2023-09-20 08:03 AM
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.
2023-09-21 12:02 AM
thanks Belaid ;)