Giter VIP home page Giter VIP logo

soft_uart's Introduction

soft_uart

Software-based serial port module for Raspberry Pi.

This module creates a software-based serial port using a configurable pair of GPIO pins. The serial port will appear as /dev/ttySOFT0.

Features

  • Works exactly as a hardware-based serial port.
  • Works with any application, e.g. cat, echo, minicom.
  • Configurable baud rate.
  • TX buffer of 256 bytes.
  • RX buffer managed by the kernel.

Compiling

Fetch the source:

git clone https://github.com/adrianomarto/soft_uart

Install the package raspberrypi-kernel-headers:

sudo apt-get install raspberrypi-kernel-headers

Run make and make install, as usual.

cd soft_uart
make
sudo make install

I haven't tried cross-compiling this module, but it should work as well.

Loading

Module parameters:

  • gpio_tx: int [default = 17]
  • gpio_rx: int [default = 27]

Loading the module with default parameters:

sudo insmod soft_uart.ko

Loading module with custom parameters:

sudo insmod soft_uart.ko gpio_tx=10 gpio_rx=11

Usage

The device will appear as /dev/ttySOFT0. Use it as any usual TTY device.

You must be included in the group dialout. You can verify in what groups you are included by typing groups. To add an user to the group dialout, type:

sudo usermod -aG dialout <username>

Usage examples:

minicom -b 4800 -D /dev/ttySOFT0
cat /dev/ttySOFT0
echo "hello" > /dev/ttySOFT0

Baud rate

When choosing the baud rate, take into account that:

  • The Raspberry Pi is not very fast.
  • You will probably not be running a real-time operating system.
  • There will be other processes competing for CPU time.

As a result, you can expect communication errors when using fast baud rates. So I would not try to go any faster than 4800 bps.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.