Skip to content

Support for UART serial communication #83

Open

Description

@donker

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?

Activity

  1. jikelmon commented on Jul 25, 2017

    @jikelmon

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions