cancel
Showing results for 
Search instead for 
Did you mean: 

Bootloader with Stm32H743VIT6(problem with peripherals)

Amirho3ein
Associate II

Hi

I hope you guys be safe

I want to make a bootloader with Stm32H743VIT6 and i want to start from a simple one the structure is like below:

1_program a simple blink led at 0x08020000 with 50Kb size and changing vector table to that address

2_make simple pointer function in another program at 0x08000000 and point to x08020000

it goes fine until now but when i enable spi in bootlader code the blinker led will not work , the point is where i enable the same spi in aplication(blinker) too and it works fine and when i use HAL_SPI_MspDeInit(spiHandle) in last line befor jumping to blinker code to disable spi in bootloader it works fine !!!

now i wanna know why?!

what is happening in Stm when i enable a peripheral ?

any reference would be fine too :folded_hands: �?��?

this is my pointer function :

static void goto_application(void)

{

 void (*app_reset_handler)(void) = (void*)(*((volatile uint32_t*) (0x08020000 + 4U)));

 HAL_SPI_MspDeInit(&hspi3);

  

 app_reset_handler();  //call the app reset handler

}

4 REPLIES 4
MM..1
Chief III

All type of bootloader (system or user) need deactivate IRQ before jump.

Mean irqs on all enabled peripherals. Full Deinit isnt required, but is clean.

Amirho3ein
Associate II

thank you for your help it's precious for me .

can you explain why i have to disable IRQs?

why my primary apk cannot work whitout these IRQs?

is it because of that apk cannot change those IRQs and it have to be done manually?

cubeide wouldn't reset IRQs at first?

MM..1
Chief III

You need understand how MCU do when you jump to 0x80020000...

Primary you or MSP Init relocates interrupt vectors table and this require no interrupt enabled.

When you dont relocate then all ISR stay on address from 0X80000000 usw.

Simply in bootloader do your job , disable NVIC all enabled, jump , and your app reenable all.

TDK
Guru

You don't need to disable IRQs, you just need to ensure they're not firing from within your application and jumping to bootloader code that is no longer valid. Blindly disabling them all is one way of doing this, but typically leads to other issues.

I can't see anything in HAL_SPI_MspDeInit that would cause other code to start working. In any case, it doesn't disable interrupts so that's not the solution.

If you feel a post has answered your question, please click "Accept as Solution".