Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for UART serial communication #83

Open
donker opened this issue Mar 1, 2017 · 1 comment
Open

Support for UART serial communication #83

donker opened this issue Mar 1, 2017 · 1 comment

Comments

@donker
Copy link

donker commented Mar 1, 2017

I'm not 100% sure this is not already somewhere in the codebase, but I couldn't find it. I need to start up a serial connection, write to it and read from it. I'd love to use common code syntax like:

Serial.Begin(speed [,rxPin, txPin])
Serial.Write
Serial.Read
Serial.OnData
Serial.Close

Or something similar.

Thoughts?

@jikelmon
Copy link

jikelmon commented Jul 25, 2017

Hi,

you can use the built in UART the same way as with every external serial port to usb adapter in C#. You have to disable the console output over UART at first. Unfortunately with RPi 3 you have to disable your bluetooth adapter by adding dtoverlay=pi3-disable-bt at the end of your /boot/config.txt file. I am not 100% sure what has to be changed on RPi 2 as i have not used one in a long time. I think you have to remove console=ttyAMA0,11520 in /boot/cmdline.txt to disable the console forwarding.

After these changes you can use the /dev/ttyAMA0 interface for your serial connection over UART.

SerialPort _uart = new SerialPort("/dev/ttyAMA0", 115200, Parity.None, 8, StopBits.One);
_uart.WriteLine(...);

etc. did the trick for me.

Nevertheless this works for me i am not responsible for any damages or data loss on your hardware and software.

Best regards!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants