3 years, 2 months ago.

RS232 Frame error

Hello,

I'm trying to communicate over RS232 with some pins on my Nucleo F070RB. According to the pinout, pins PC_10 and PC_11 can be used for RS232 communication. I currently send only the character "C". I've connected my own USB-2-serial box to the pins (tx,rx,gnd). The Terminal on my PC is not showing the correct character... It says that there is a FRAME ERROR. Debugging the ascii on the scope, I can see 0x43 appearing and this should be correct according to the ascii-table. But in the Terminal I'm getting: ^<0>

All my settings are set the same: br: 9600, data:8, par: none, stop: 1 (also in config of the hardware usb-2-rs232-box)

Connection through USBTX and USBRX of the mbed is working fine, but then I'm not using the external hardware usb-2-rs232 box)

#include "mbed.h"

I2C i2c(I2C_SDA, I2C_SCL);
//Serial pc(USBTX,USBRX); tx,rx
Serial device(PC_10, PC_11);
DigitalOut myled(LED2);
DigitalIn mybutton(USER_BUTTON);

int main()
{
    device.baud(9600);
    device.format(8,SerialBase::None,1);

    while (1) {

        if (device.readable() == 1) {
            myled=1;
            device.printf("C");

            myled = 0;
            wait(0.5);
        } else {
            myled = 1;
            wait(2);
            myled = 0;
            wait(1);
        }
    }
}

Comment on this question
Be the first to answer this question.

You need to log in to post a question