Coder Social home page Coder Social logo

rbalykov / cdmx Goto Github PK

View Code? Open in Web Editor NEW
8.0 4.0 2.0 261 KB

Linux kernel module that turns any serial TTY to DMX port.

License: GNU General Public License v3.0

Makefile 6.49% C 93.51%
dmx dmx512 rdm lightning linux-kernel enttec dmxking kernel linux raspberry-pi

cdmx's Introduction

cdmx

Linux kernel module that turns any serial tty to DMX port. (C) 2021, GNU Public license v3.

Requirements:

  • h/w support for BREAK detection and non-standard baudrate.
  • Linux kernel v5 (they change API at speed of light, this work done with v5.10.63 LTS)

Implemented for now:

  • UART TX/RX
  • DMXKing USBDMX512-A emulation (Enttec UsbPro compatible)
  • SysFS access to port parameters
  • variable port count, 1 to 256

TODO:

  • implement RDM

Known issues:

  • Oscilloscope could be useful to tweak MARK-After-Frame (MAF) time. By default it's set to 1000us, works fine on PPi3's PL011. If you don't get stable MAF, increase the value.
  • some IOCTLs are implemented as stubs, so you won't be able to change TTY settings while using module. Exclusive file access used in OLA is also emulated with no real action done.
  • RX overflow flag is not reported to host. Faulty frames are just dropped.
  • First received DMX frame remains in read() queue and blocks the rest if no host is reading it. So the best practice is start OLA, let it detect CDMX, then attach UART to CDMX line discipline (LDISC).
  • Kernel API for attaching line discipline has to be called from user-space, not kernel-space, so 'ldattach' from 'util-linux' package is what you need. Alternatively, any application could open UART file and call TIOCSETD ioctl.

Tests performed using OLA (https://github.com/OpenLightingProject/ola)

Dependencies:

  • apt install build-essential util-linux ola sysvinit-utils
  • apt install linux-headers-`uname -r` or build new kernel
  • service olad stop; nano /etc/ola/ola-usbserial.conf (device_prefix = cdmx); make sure other OLA plugins or ModemManager don't use your UART.

Building the module:

  • clone cdmx repository
  • cd cdmx; edit Makefile to replace TEST_DEVICE with your local UART
  • make all insert
  • service olad start
  • make attach

Further module hacking:

  • It's recommended to build kernel from source, since out-of-stock images are not intended for debug.
  • Enable CONFIG_DYNAMIC_DEBUG_CORE and CONFIG_MODULE_FORCE_UNLOAD in kernel .config
  • cd cdmx/extra; make dyndbg

UART on RPi3:

  • sudo systemctl disable hciuart
  • sudo raspi-config, turn login shell off, serial hardware on
  • edit /boot/config.txt, make sure it has "enable_uart=1" and "dtoverlay=pi3-disable-bt"
  • use /dev/ttyAMA0

Kernel headers on RPi3:

cdmx's People

Contributors

peternewman avatar rbalykov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cdmx's Issues

Licencing

You somewhat skirted round my issue (or perhaps I wasn't clear enough) and then you've deleted the original issue.

"github just gives a choice on repo creation"

I'm aware of that, it doesn't mean you need to pick private though.

Is this a closed source project? What's the licence for it? There isn't currently a licence file.

EPOLL support

Hi @rbalykov ,

This looks cool, out of interest how come it's a private rather than public/open source repo?

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.