kirspaum
Posts: 2
Joined: Sun Sep 01, 2019 5:52 pm

UART interfacing with "pigpio"

Sun Sep 01, 2019 6:15 pm

Hey there!

Im working on a project where i want to use the UART Pins. Therefore I want to use the "pigpio"-library.
I am just not able to receive bytes from the UART device.

For trying out I "shortcutet" the TxD and RxD of one Raspberry (3B+), wrote that little code to send letters

Code: Select all

#include<iostream>
#include<pigpio.h>

using namespace std;

int x = gpioInitialise();

int main()
{

char p[] = "/dev/ttyS0";

int port = serOpen(p, 9600, 0);

char buf[] = {'a','b','c'};

serWrite(pot, buf, 3);

serClose(port);

return 0;
and with minicom I could verify that those letters where sent and received.
Same thing with another Raspberry (Zero WH). So this worked fine.

But now if I connect the TxD of one Raspberry with the RxD of another, run the code on one and minicom on the other Pi, this doesn't work anymore. And I just can't get my head around why this wouldn't work.
Maybe someone can give me a little hint. Thanks!

markkuk
Posts: 118
Joined: Thu Mar 22, 2018 1:02 pm
Location: Finland

Re: UART interfacing with "pigpio"

Mon Sep 02, 2019 5:56 am

Did you connect the ground pins in addition to TxD and RxD? Remember that electricity flows in circuits.

kirspaum
Posts: 2
Joined: Sun Sep 01, 2019 5:52 pm

Re: UART interfacing with "pigpio"

Mon Sep 02, 2019 4:39 pm

Oh my god, the ground pins. thank you so much!

Return to “C/C++”