cancel
Showing results for 
Search instead for 
Did you mean: 

How to use BOOT0 in SBSFU?

Roshan
Associate III

Hi all,

I am porting the SBSFU to the custom STM board which is running in the Stm32L476JGYx.

Normally user button is connected to the PC13 in the Nucleo board and in my custom PCB I made the user button for the Boot0 (PD7) I use this only for the bootable purpose,

I am having a problem changing the BOOT0 pin, I changed the default pin PC13 to PD7 using the Stm32l4xx_nucleo.h in the BSP folder but I am not getting the bootable update window (to update using the Ymodem protocol) if I do the same as in the Nucleo board. Are there any other facts should I consider when changing the User Button.

Thanks

Roshan

1 ACCEPTED SOLUTION

Accepted Solutions
Jocelyn RICARD
ST Employee

Hi Roshan,

You actually need to implement the 2 macros: BUTTON_INIT() and BUTTON _PUSHED() located in app_hw.h

The init should contain the GPIO initialization, the pushed should contain the test of button is pushed.

You can either put GPIO initialization in the macro or define your own functions

Typical GPIO init for PC6 would be would be:

 GPIO_InitTypeDef GPIO_InitStruct = {0};

 __HAL_RCC_GPIOC_CLK_ENABLE();

 GPIO_InitStruct.Pin = GPIO_PIN_6;

 GPIO_InitStruct.Mode = GPIO_MODE_INPUT;

 GPIO_InitStruct.Pull = GPIO_NOPULL;

 HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);

Best regards

Jocelyn

View solution in original post

5 REPLIES 5
Jocelyn RICARD
ST Employee

Hello Roshan,

just a precision. on your STM32L476JGY / WLCSP72 BOOT0 is on pin D7. On the other hand PD7 is port D7, not available on this package.

Anyway, BOOT0 pin is used to select boot on system bootloader.

But, as soon as you set this pin to VDD the chip will boot on bootloader ... except if you activated RDP level 2: but please don't do that ! you cannot debug anymore.

So, you cannot use the BOOT0 to indicate SBSFU to launch the update.

Best regards

Jocelyn

Hello @Jocelyn RICARD​ 

Thank you, sir. Can you please let me know the files which I need to change for the user button, in case if I use another pin? (is it only in  Stm32l4xx_nucleo.h )

Regards

Roshan

Hello @Jocelyn RICARD​ 

I tried with another pin i.e PC6, Now the problem, is that it won't be recognized. I changed in the Stm32l4xx_nucleo.h

#define USER_BUTTON_PIN                         GPIO_PIN_6
#define USER_BUTTON_GPIO_PORT                   GPIOC
#define USER_BUTTON_GPIO_CLK_ENABLE()           __HAL_RCC_GPIOC_CLK_ENABLE()
#define USER_BUTTON_GPIO_CLK_DISABLE()          __HAL_RCC_GPIOC_CLK_DISABLE()
#define USER_BUTTON_EXTI_LINE                   GPIO_PIN_6
#define USER_BUTTON_EXTI_IRQn                   EXTI15_10_IRQn

but even though if I try to go the SBSFU update window, nothing is recognized and it just starts as normal. Ymodem update protocol page is not loading. please can you tell other than the Stm32l4xx_nucleo.h if there any places which I need to change. for the button configuration.

in app_hw.h only contains user_button, that's why I change this

Thanks

Roshan.

Jocelyn RICARD
ST Employee

Hi Roshan,

You actually need to implement the 2 macros: BUTTON_INIT() and BUTTON _PUSHED() located in app_hw.h

The init should contain the GPIO initialization, the pushed should contain the test of button is pushed.

You can either put GPIO initialization in the macro or define your own functions

Typical GPIO init for PC6 would be would be:

 GPIO_InitTypeDef GPIO_InitStruct = {0};

 __HAL_RCC_GPIOC_CLK_ENABLE();

 GPIO_InitStruct.Pin = GPIO_PIN_6;

 GPIO_InitStruct.Mode = GPIO_MODE_INPUT;

 GPIO_InitStruct.Pull = GPIO_NOPULL;

 HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);

Best regards

Jocelyn

Thanks