cancel
Showing results for 
Search instead for 
Did you mean: 

How to use ST Open bootloader for STM32L562ZET6Q

priyanka.yadav
Associate II

Moved from the Feedback Forum


Hi,

1. Referring to below link, can we use this for STM32L562ZET6Q part without any change.

2. What changes are to be done to make use of USART3 (PC10,PC11) rather USART1 (PA9,PA10).

 

How to use the ST Open Bootloader for STM32 Microc... - STMicroelectronics Community

11 REPLIES 11
Saket_Om
ST Employee

Hello @priyanka.yadav 

To be able to use the UART3 instead of UART1 you should update the lines below in the file interfaces_conf.h.

#define USARTx                            USART1

#define USARTx_TX_PIN                     GPIO_PIN_9
#define USARTx_TX_GPIO_PORT               GPIOA
#define USARTx_RX_PIN                     GPIO_PIN_10
#define USARTx_RX_GPIO_PORT               GPIOA
#define USARTx_ALTERNATE                  GPIO_AF1_USART1

If your question is answered, please close this topic by clicking "Accept as Solution".

Thanks
Omar

Hello @Saket_Om ,

Following changes have been made in code, but not connecting to desired UART.

priyankayadav_0-1734339933347.png

 

Hello @priyanka.yadav 

Could you provide more details about your setup please?

If your question is answered, please close this topic by clicking "Accept as Solution".

Thanks
Omar

Hello @Saket_Om ,

I'm running this code on STM32L562ZET6Q (our customized board using STM32L562ZET6Q). Running this "OpenBootloader" project to enable remote programming via UART communication interface.

On our board, we have already tested UART3 interface for remote programing, but the hurdle was that this required us to set the nBOOT0=0 (i.e keep this unchecked) using STLINK Debugger, to enable system bootloader instead of flash. So, I searched for OpenBootloader project which enable IAP using UART without need of debugger.

Thanks!

 

 

@priyanka.yadav 

Did you activate the clock for GPIOC please?

If your question is answered, please close this topic by clicking "Accept as Solution".

Thanks
Omar

Hello @Saket_Om ,

Please let us know from where to enable clock for GPIOC group.

Do we also need to do BOOT0 pin PH3 as HIGH?

Also, does the OpenBootloader project contains .ioc file also?

Thanks.

Hello @priyanka.yadav 

1) Please let us know from where to enable clock for GPIOC group.

The GPIOC clock can be enabled in the function OPENBL_USART_Configuration() in the file usart_interface.c.

void OPENBL_USART_Configuration(void)
{
  GPIO_InitTypeDef GPIO_InitStruct;

  /* Enable all resources clocks --------------------------------------------*/
  /* Enable used GPIOx clocks */
  __HAL_RCC_GPIOC_CLK_ENABLE();

  /* Enable USART clock */
  __HAL_RCC_USART3_CLK_ENABLE();

  /* USARTx pins configuration -----------------------------------------------*/

  GPIO_InitStruct.Pin       = USARTx_TX_PIN;
  GPIO_InitStruct.Mode      = GPIO_MODE_AF_PP;
  GPIO_InitStruct.Pull      = GPIO_PULLUP;
  GPIO_InitStruct.Speed     = GPIO_SPEED_FREQ_HIGH;
  GPIO_InitStruct.Alternate = USARTx_ALTERNATE;
  HAL_GPIO_Init(USARTx_TX_GPIO_PORT, &GPIO_InitStruct);

  GPIO_InitStruct.Pin = USARTx_RX_PIN;
  HAL_GPIO_Init(USARTx_RX_GPIO_PORT, &GPIO_InitStruct);

  OPENBL_USART_Init();
}

 

 2) Do we also need to do BOOT0 pin PH3 as HIGH?

Yes, the BOOT0 pin PH3 should be HIGH to boot on system bootloader. Please refer to the section "3.6 Boot modes" in the reference manual for more details. 

Saket_Om_0-1734513034574.png

 

If your question is answered, please close this topic by clicking "Accept as Solution".

Thanks
Omar

Hello @Saket_Om ,

As per the highlighed text, I think Boot0 pin setting to 1 is not required at least for the OpenBootloader code presently I'm trying to use.

priyankayadav_0-1734582239326.png

 

Hello @Saket_Om ,

Even after clock changes it's not recognizing UART3 interface.

When I try to debug the code, it stucks at "SystemClock_Config()".