NUCLEO-F103RB USART1 (not console) reading garbage and incorrect voltage levels

Hi! I’m just getting started with Mbed on a NUCLEO-F103RB board and am seeing some weird issues with USART1 using the UnbufferedSerial class. (I’m using UnbufferedSerial for this because this is supposed to be a half-duplex connection and I want to try to inspect the timing of the bytes.)

UnbufferedSerial ser1 (NC, PA_10, 9600);
UnbufferedSerial ser3 (NC, PB_11, 9600);

My program is a simple serial spy using the RX lines of USART1 and USART3 to spy on another PCB serial TX and RX lines and send out a report over USB (USART2). I’m using PA_10 for USART1_RX and PB_11 for USART3_RX. I can receive either line on the target just fine with USART3, but not with USART1.

When I use an oscilloscope, I notice that the voltage doesn’t swing from 3.3V to ground, but rather only goes down to about about 1.5V, which suggests that the peripheral is not configured properly (not acting like an input). I suspect that there is an initialization problem, but penetrating the thick outer shell of of the HAL through the mists of C++ makes it difficult to find where exactly things are getting initialized. I also wonder if some other component is configuring itself on top of PA_10 in the background somewhere.

What’s even more strange, when I try to change to use the alternate pins for USART1, nothing seems to change.

UnbufferedSerial ser1 (NC, PB_7, 9600);

Not only does PB_7 not react to the serial data, if i switch the wire back to PA_10, this pin still transmits garbage as though it were still configured as USART1_RX.

Any ideas how to get USART1 working on either pin? Thanks!

Some progress!

There are multiple issues going on here:

  1. I realized that one of my UART lines is operating at 5V, not 3.3V, which is why the voltage levels are off. The ST part has internal pull-down resistors but I have not been able to confirm whether they are active or not.

  2. I’m still not sure why the the alternate pins do not work.

  3. I got this code working on a Silabs EFM32 Giant Gecko, proving the power of the mbed platform for retargeting code, however I ran into software issues with printf and missing input characters (missing interrupts?). That is for a different thread.

Hi

I don’t have any answer, but 2 comments:

  • I don’t think that half duplex is supported in mbed-os ?
  • From ST point of view, I think that, for half duplex, only TX pin is used

Jerome