2022-02-21 05:02 AM
STM32G473VC, custom board.
I use an own bootloader which resides at address 0x00000000 , the user application resides at 0x00008000.
I did set external files correct to use the bootloader
in user application
system_stm32g4xx.c : #define VECT_TAB_OFFSET 0x00008000U
STM32G473VCTX_FLASH.ld : FLASH (rx) : ORIGIN = 0x8008000, LENGTH = 220K
in bootload application
STM32G473VBTX_FLASH.ld : FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 32K
in bootloader we use this code to jump to the user application
void deinitEverything()
{
//-- reset peripherals to guarantee flawless start of user application
HAL_TIM_Base_DeInit(&htim6);
HAL_CRC_DeInit(&hcrc);
HAL_SPI_DeInit(&hspi2);
HAL_NVIC_DisableIRQ(DMA1_Channel2_IRQn);
HAL_NVIC_DisableIRQ(DMA1_Channel1_IRQn);
HAL_NVIC_DisableIRQ(EXTI15_10_IRQn);
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_1);
HAL_RCC_DeInit();
HAL_DeInit();
SysTick->CTRL = 0;
SysTick->LOAD = 0;
SysTick->VAL = 0;
}
static void jumpToApp(const uint32_t address)
{
const JumpStruct* vector_p = (JumpStruct*)address;
deinitEverything();
/* let's do The Jump! */
/* Jump, used asm to avoid stack optimization */
asm("msr msp, %0; bx %1;" : : "r"(vector_p->stack_addr), "r"(vector_p->func_p));
}
In user application we use this code to jump to bootloader
HAL_NVIC_SystemReset();
timer 7 is used as Timebase Source, FreeRTOS is also running.
We used this bootloader setup successfully in many other projects , but in this one the timer 7 interrupt stops interrupting if we jump to bootload code and back to user application.
This cause HAL_IncTick() not getting called, and uwTick staying at 0 . Which cause HAL_MspInit() ... HAL_SYSCFG_EnableVREFBUF() run in an endless loop.
The only different with other projects is that we use SPI in this bootloader to bootload , where we use UART in all other projects.
I checked the timer 7 registers which seems all fine .
the strange thing is that both bootloader and user application runs correctly after a reset or power down - up cycle. Bootloader starts first and starts user application which runs fine. But when i use (SPI) commands to switch to bootloader and back to user application, then the TMR7 interrupt stops working.
What else can i check to find out why timer 7 is not firing an interrupt?
Solved! Go to Solution.
2022-02-24 07:01 AM
when interrupts are firing after a jumpt to application code and i break while no interrupt is executing i get SCB_ICSR : 0xc47000
when no interrupts are firing after a jump to application code and no interrupt is executing i get SCB_ICSR : 0x4438000
if i analyse this i get :
int works : vectpending 0x70 , PENDSTSET activated
int not works vectpending 0x8E
i dont know how to interpret this ...
2022-02-24 07:31 AM
i have removed __disable_irq which i have added the past days in the bootloader code while i was searching for a solution... now it works.
i don't understand 100% why, i guess i need more knowledge about the STM32 NVIC interrupt system to know whats going on. But good documentation about this part is hard to get .
anyway , Thank you for assisting !