cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 Custom Bootloader - Application's Peripheral Init Problem

Baris Demirbas
Associate

Hi all,

I am developing custom bootloader for STM32F765VG and i have a problem with application's peripheral init which explained below.

Bootloader uses LL drivers , applications use HAL drivers.

My first application code just toggles a led and only uses gpio periperhal. bootloader jumps perfectly application and i can see led toggles.

In my second application code unlike the first application code i just enable USART1 peripheral. When i try to enable USART1 , my bootloader code stucks in LL_RCC_GetUARTClockFreq function.

Here is bootloader code.

LL_USART_DeInit(BL_USART_CHANNEL);

LL_USART_Disable(BL_USART_CHANNEL);

LL_I2C_DisableIT_STOP(I2C3DEV_I2C);

LL_DMA_DisableIT_TC(I2C3DEV_DMA, I2C3DEV_DMA_TX_STREAM);

LL_DMA_DisableIT_TC(I2C3DEV_DMA, I2C3DEV_DMA_RX_STREAM);

LL_I2C_DisableDMAReq_TX(I2C3DEV_I2C);

LL_I2C_DisableDMAReq_RX(I2C3DEV_I2C);

LL_I2C_Disable(I2C3DEV_I2C);

LL_RCC_DeInit();

LL_EXTI_DeInit();

LL_EXTI_DisableIT_0_31(LL_EXTI_LINE_ALL_0_31);

SysTick->CTRL = 0;

SysTick->LOAD = 0;

SysTick->VAL = 0;

// 1- Get the application stack pointer (First entry in the application vector table)

   appStack = (uint32_t) *((__IO uint32_t *)APPLICATION_ADDR);

   // 2- Get the application entry point (Second entry in the application vector table)

  appEntry = (pFunc) *(__IO uint32_t *) (APPLICATION_ADDR+4);

   // 3- Reconfigure vector table offset register to match the application location

  SCB->VTOR = APPLICATION_ADDR;

   // 4- Set the application stack pointer

   __set_MSP(appStack);

// 5- jump to application

appEntry();

Regards

Baris

0 REPLIES 0