Raspberry Pi 3 with wirpingpi - uart doesnt work

78 views Asked by At

I want to communicate RPI3 with atmega8 via uart. In atmega I set 9600 baud rate, 8bits, no parity bit and one stop bit. I my rpi I'm using WiringPi library and this is my code:

  int fd;

  if ((fd = serialOpen ("/dev/ttyAMA0", 9600)) < 0)
  {
    cout << "Error";
    return 1 ;
  }

  if (wiringPiSetup () == -1)
  {
    cout << "Error";
    return 1 ;
  }

  serialPutchar (fd, 50) ;

But .. I atmega I don't receive this '50'. Maybe should I configure connection in termios ? Any Idea ?

1

There are 1 answers

0
Christoph On

When I try to use the code I receive a "2" in the ASCII table dec 50. If you receive wrong data you might convert it first. If you don't receive data there might be a problem with the tty configuration or the hardware setup.