5 years, 5 months ago.

Alternative serial ports not working Nucleo L476RG

Hey,

I wanted to use a shield with some sensors on it and use UART protocol to send and retrieve data, however i could not manage to make other ports to respond. Before putting a shield, i wanted to try to see if pins are working:

include the mbed library with this snippet

#include "mbed.h"


//------------------------------------
// Hyperterminal configuration
// 9600 bauds, 8-bit data, no parity
//------------------------------------

Serial pc(SERIAL_TX, SERIAL_RX);

Serial uart1( PA_9,  PA_10 );
//Serial uart1( PB_6,  PB_10  );

Serial uart3( PC_10, PC_11 );
Serial uart4( PA_0, PA_1 );
Serial uart5( PC_12, PD_2  );
 
DigitalOut myled(LED1);
 
int main() {
  int i = 1;
  pc.printf("\r\n\nHello World !");
  while(1) { 
      wait(1);
      pc.printf("\r\nSERIAL_TX: %d.", i);
      uart1.printf("\r\nUART1: %d.", i);
      uart3.printf("\r\nUART3: %d.", i);
      uart4.printf("\r\nUART4: %d.", i);
      uart5.printf("\r\nUART5: %d.", i);
      i++;
      myled = !myled;
  }
}

Only the pc.printf() seems to print out data when other ones are not. I used the pinmap from this https://os.mbed.com/platforms/ST-Nucleo-L476RG/ . I read before about using D0/D1 for UART you need to change few solder bridges but I intend to use that line for some commands that would be sent to Nucleo later on. Is it necessary to do same on other UART possibilities if I would want to use them? I am using the online compiler.

1 Answer

5 years, 5 months ago.

Hi Edvardas,

We've taken a look at your code and it appears fine. How are you monitoring the output of the other UARTs? Have you put a scope on those TX pins to see if there is any activity? Only SERIAL_RX/SERIAL_TX will be coming out over the USB cable as a virtual COM port.

Regards,

Ralph, Team Mbed