Wrong characters from serial

27 Jul 2015

Hi, I will connect my STM32 with PC via RS-232. I have this simple code:

Serial

#include "mbed.h"
DigitalOut dir(PA_8);

Serial pc(PA_2, PA_3);

void serial_int(void)
{
    pc.putc(pc.getc());
}

int main() {
  pc.printf("Hello World !\n");
  pc.attach(&serial_int);
  dir = 0;
  while(1) { 
        wait(1);
        dir = 1;
        wait(1.0);
        dir = 0;
  }
}

Problem is that, when i put for example "a" character on PC terminal, I recive "aa" or "ay" or "aá˙" or something else. This is this same with all of the characters. First letter is ok, but it is not only one character. Do you know what could be the reason of that?