7 years, 6 months ago.

PC Serial: Can receive from PC but nothing comes back on terminal app

I am trying out my new Nucleo F411RE but am not getting very far with the serial communication. Using the example below, I have been able to get the LED to increase and decrease in brightness (signaling that the mbed is receiving data). However, I cannot receive anything back from the mbed, either via the same terminal app that is sending or using an Arduino. I tried reverting the mbed library to rev 119 as another post suggested to no avail. I'm just not getting why I the mbed can seem to send any data. Help?

  • Board: Nucleo F411RE
  • OS: Windows 7
  • Terminal App: Tera Term
  • Tera Term Settings: 8n1, 9600, LF

Partially Working Code:

#include "mbed.h"
 
Serial pc(USBTX, USBRX); // tx, rx
PwmOut led(LED1);
 
float brightness = 0.0;
 
int main() {
    pc.printf("Press 'u' to turn LED1 brightness up, 'd' to turn it down\n");
 
    while(1) {
        char c = pc.getc();
        if((c == 'u') && (brightness < 0.5)) {
            brightness += 0.01;
            led = brightness;
        }
        if((c == 'd') && (brightness > 0.0)) {
            brightness -= 0.01;
            led = brightness;
        } 
 
    }
}

source: https://developer.mbed.org/handbook/SerialPC#serial-communication-with-a-pc

'However, I cannot receive anything back from the mbed, either via the same terminal app that is sending or using an Arduino' -> you do not write anything back to the PC in your code example. If you put pc.putc(c); before the while loop ends do you see anything?

posted by Jan Jongboom 04 Oct 2016

Sorry, you're right. This example shows the mbed to reading from the PC, which does work. But when I've tried pc.putc(c); or a simple example with only pc.putc(pc.getc()); , neither sends back any data to the terminal application.

posted by M O 04 Oct 2016

Has the board been modified in any way? Check solderbridges SB13 and SB14. They should both be installed. Also check SB62 and SB63. They should both be open. The bridges should be as indicated to get PC USB serial to work.

What have you done to test serial connection with an Arduino? Are you using a direct link between an Arduino serial port and D0, D1 on the nucleo? Note that D0, D1 are not connected to the F411 when SB62 and SB63 are not installed. The bridges SB13 and SB14 on the other hand should be removed when D0, D1 are active or you will short circuit the serial link to the PC host.

posted by Wim Huiskamp 05 Oct 2016
Be the first to answer this question.