cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L0 Uart failure after OTA

nikhivv07
Associate II

hi,

Previously i was using STM32L010K8TX which has 8K memory. I did OTA update in this device via Uart with help of external controller which receive hex file from User.

 

Currently am using STM32L010R8Tx which has 64K memory. And i tried the same OTA program to update the application in this new device but after OTA update the user application is running proper.

The external device which receive hex file has a debug communication port to monitor STM32L0 device by communicating in UART. After updating the application the UART communication not at all responding to external device.

After completing the OTA update am using GO command to run application (0x08000000) and making Boot Pin Low ( which is making HIGH When Entering to OTA mode). Am using same OTA file commands flow to update which was used for previous device (stm32L010K8Tx) including the memory locations. 

 

but in new device after updating the OTA it stops working Uart peripheral. I am not sure about other peripherals are working or Not. because i did not tested other peripherals state. UART is the only communication i can check now with help of another device. if uart is working i can get the other peripherals state through uart messages.

 

is there any memory address change between these two device ?

if not why the new device is not responding in uart?

If we do NRST reset it starts communicating in Uart.

 

kindly help in this topic ..

 

thanks, 

Nikhil

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
nikhivv07
Associate II

Hi,

The issue is resolved now.

It is because of re initialization of global variables which is used in uart receive routine.

i was comparing receive buffer pointer of HAL library with user defined buffer pointer to check any data is received or not.

after FOTA the userdefined variable initial value is assigned with some random value.

After reinitialize the value the uart receive routine works fine. Previously i was initializing the value globaly during declaration.

now it is initializing in main() again.

 

Thanks,

View solution in original post

10 REPLIES 10

Double check status return from UART, perhaps explicitly reset the UART, check for noise, framing, parity type errors.

The system loader doesn't reset the part, so whatever pins, clocks and uart settings might be inherited.

Don't recall if the watchdog is running, or not

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
nikhivv07
Associate II

Hi,

Watchdog is not yet enabled.

 

In application Uart is running on 9600bps with No Parity.

When FOTA is updating application other device changing the parity to EVEN because FOTA works in Even Parity.

After writing all pages other Device executing GO command with address of 0x08000000 then Making Low BOOT0 pin of STM32 and also changing the parity to NONE.

Same FOTA application code works in STM32L010k8 device. currently we updated the device to STM32L010R8 to increase the memory and add other peripheral like GPS which is connected to LPUART.

Normally the application communicate with other device in a minute but after OTA waited for long time still the STM32 not sending any uart message to other device.

After NRST reset the stm32 the device start communicating with updated application code. i Hope Passing 0x08000000 itself a kind of reset for application. by setting memory to 0x8000000 i think peripheral doesnot reset. But in application am re-initializing (MXinit()) all peripheral.(code generated by MXcube).

 

Is there any Boot command to Reset the STM32 from externally. 

 

Noise and parity i checked and everything is fine. 

 

Hi,

I created FOTA commands by referring AN3155 rev16 document.

Start Memory Address : 0x08000000

 

 

nikhivv07
Associate II

hi,

 

I have checked huart2 errors and there was no error.

I tried to print some strings in uart terminal and it is working fine. Getting print on terminal when running.

i think uart receive occurring a problem while receive through interrupt. 

Does it need to enable to get jump to uarterror_callback() if uart getting any error?

 

 

 

nikhivv07
Associate II

Hi,

The issue is resolved now.

It is because of re initialization of global variables which is used in uart receive routine.

i was comparing receive buffer pointer of HAL library with user defined buffer pointer to check any data is received or not.

after FOTA the userdefined variable initial value is assigned with some random value.

After reinitialize the value the uart receive routine works fine. Previously i was initializing the value globaly during declaration.

now it is initializing in main() again.

 

Thanks,

premkumar
Associate II

WILL YOU PLEASE SHARE THE SOURCE CODE FOR UPLOAD FIRMWARE  VIA UART , AND  PLEASE SHARE HOW TO USE THE SYSTEM BOOTLOADER HOW TO ACTIVATE THAT TO RECEVE FIRMWARE , 
I AM DOING AN OTA WITH THE STM32U575  AND THE ESP32 CAN YOU GUIDE ME

Hi @premkumar ,

 

We have used LTE module to push hex file to STM32 via UART.

We referred following document.

 AN3155 rev16

 

Here follows the steps.

> STM32 receive notification for Update.

> STM32 Backup all necessary readings such as analog , RTC etc.

> LTE module push low STM32's BOOT pin.

> Reboot using NVIC reboot.

> Rest of the action handled by STM Bootloader with LTE Modem.

 

> LTE module select the hex file and push to STM32 by addressing Memory location of stm32 to where the hex file has to be written.

 

 

Thanks,

Nikhil

premkumar
Associate II

Hi @nikhivv07 

Thanks for your reply,  I am trying to upload the firmware from the esp32 to stm32f1.

1. I Entered the Bootloader

2. Sent the 0x7F to initialize uart Bootloader.
Result:-  I receved this , I NACK from the stm32f103c6t6 

 

will you please assist what to do
 

premkumar_0-1745226817188.png

 

hi @premkumar ,

 

Check the Parity of UART settings. Bootloader works in Even Parity.

After initializing bootloader change your UART parity to EVEN.

 

_nikhil