cancel
Showing results for 
Search instead for 
Did you mean: 

Lost of GPIO configuration once the bootloader is started

tingting
Associate II
Posted on January 27, 2016 at 14:46

Hi,

I am using the microcontroller STM32L0.

I configured two pins(PB5 and PB6) of the micro as outputs. And the PB5 is  in SET state and the PB6 is in RESET state.

To update the firmware , we use the bootloder. To enter in bootlodaer mode, we make a jump to its address.

But once the bootloader started, I lost the configuration of my two pins, and my RS232 transceiver cannot be ON. Because to activate the transceiver, I must have PB5  SET and PB6 RESET.

Is it normal that the GPIO configuration can be lost in bootloader mode?

Thank you

13 REPLIES 13
tingting
Associate II
Posted on February 02, 2016 at 14:49

The example code is for STM32L073Z. I changed some code to make it compatible with my board 'STM32L051'.

I have changed:

 #define FLASH_START_BANK2             ((uint32_t)0x08007FFF)

May be I missed  other important changes?

I tried to program a little .bin file. It went up until 100% , but I never get the message  ''Programming Completed Successfully''.

Posted on February 02, 2016 at 17:22

Well it is going to be important that the code does not erase flash it is using itself. Check the size of the created code (.MAP)

Also the flash bank isn't likely to be at an odd address like 0x08007FFF, which would be one byte shy of 32KB

I'm not a big fan of ST's Y-Modem code, there are perhaps some robustness issue that could cause it to stall. Does dropping the baud rate help? Does debugging tell you anything about where it is stalled?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
tingting
Associate II
Posted on February 02, 2016 at 17:53

Hi clive1,

After debugging, the system is stuck in the function UART_WaitOnFlagTimeout(..)(stm32l0xx_hal_uart.c) , after executing

FLASH_If_Erase(APPLICATION_ADDRESS);
*p_size = filesize;
Serial_PutByte(ACK);
Serial_PutByte(CRC16);

in the Ymodem_Receive function(Ymodem.c).
tingting
Associate II
Posted on February 03, 2016 at 17:20

After the ''inspection'', the program is not stuck in the uart_waitonFlagtimeout. The characters ACK and CRC 16 are sent. But, i cannot see them with tera term.

Using the realterm, i see more details. The program sends ''CA'' characters after the ACK and CRC 16 of the memory erase.

But, there is a strange phenomenon, during the file transfer, there are only two packets received. The first packet includes the file name,size ..and the second packet includes the data.  Then the communication is abort, and I receive CA (0x18).

When I check the memory, this one is not written with the only received packet of data. There are only zeros in the memory.0690X0000060379QAA.jpg

0690X000006037EQAQ.jpg

0690X000006037AQAQ.jpg