6 years, 3 months ago.

STM32L053C8 UART/I2C Error in Mbed2 Latter Than Rev159

I am using a STM32L053C8 MCU and got some problems with it.

include the mbed library with this snippet

#include "mbed.h"

int main()
{
    DigitalOut  led(PA_14);
//    Serial      serial(PB_6, PB_7);
//    I2C         i2c(PB_14, PB_13);

    while(1)
    {
        led = !led;
        wait(0.1);
    }
}

The code above works fine. However, when I un-comment the Serial or I2C, the LED stops blinking.

So I switch the MBED2 version to rev.159 (which looks like more stable) and un-comment the Serial and I2C and it works fine.

No idea what's going on. Any one could help?

The reason that I do not want to use the Rev.159 because it has some bugs on the LowPowerTicker lib.

Best

Question relating to:

The 32L0538DISCOVERY board helps you to discover the ultra-low-power microcontrollers of the STM32 L0 series.

It also works if I modified the Serial pins to (PB_10, PB_11) or the I2C pins to (PB_9, PB_8)

posted by Tony YI 01 Sep 2018

1 Answer

6 years, 3 months ago.

Hi

- serial(PB_6, PB_7): this could not work as PB6 and PB7 are using the same UART (UART_1) as the default STDIO.

- serial(PB_10, PB_11): this is OK as it is configuring LPUART_1 instance

Thanks Jerome, so can I disable the STDIO and use the UATR_1 for other propose? Because the above code works fine when using Mbed Rev159, I assume there is a way to do that.

posted by Tony YI 05 Sep 2018

Hi

the above code works fine

LED was blinking, but I don't think that the new uart was working...

Check the wiki page: https://os.mbed.com/teams/ST/wiki/STDIO

posted by Jerome Coutant 05 Sep 2018