soft_uart:用于树莓派的基于软件的串口模块

  • X4_611738
    了解作者
  • 19.6KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-05-17 04:02
    上传日期
soft_uart 用于 Raspberry Pi 的基于软件的串行端口模块。 该模块使用一对可配置的 GPIO 引脚创建基于软件的串行端口。 串行端口将显示为/dev/ttySOFT0 。 特征 与基于硬件的串行端口完全一样。 适用于任何应用程序,例如 cat、echo、minicom。 可配置的波特率。 256字节的TX缓冲区。 由内核管理的 RX 缓冲区。 编译 获取源码: git clone https://github.com/adrianomarto/soft_uart 安装包raspberrypi-kernel-headers : sudo apt-get install raspberrypi-kernel-headers 像往常一样运行make和make install 。 cd soft_uart make sudo make install 我
soft_uart-master.zip
  • soft_uart-master
  • module.c
    10.2KB
  • LICENSE
    34.3KB
  • README.md
    1.7KB
  • Makefile
    323B
  • raspberry_soft_uart.c
    7.4KB
  • queue.c
    2.1KB
  • queue.h
    528B
  • raspberry_soft_uart.h
    531B
内容介绍
# 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.
评论
    相关推荐