Uart Application developed for RS485 Communication on BeagleBone Black, using termios.
- Modular based interface
- pthread and termios implementation
- stty
-
compileUART.sh :
Simple g++ compiler commands to build app.
-
MakeFile :
This can also be used to build app. ( Preferred )
-
multiUART.cpp :
BBB provides 4 Uart ( 1,2,4,5) . Uart0 is used for boot messages. This app runs them all in parallel using thread having read/write fxns.
-
multiUARTApp.cpp :
2 thread based app for testing the application, as required in the Project. This is similar to above file, and more specific to the Project specs.
-
uartconfig.txt :
Uart configuration used for termios structure
-
uartRx.cpp :
A simple Uart receive module prototype for testing RX case
-
uartTx.cpp :
A simple Uart transmit module prototype for testing TX case
-
uartTxLoop.cpp -
Test a continuous transmission case
-
uartPinsConfig.sh -
Pin configuration for all UARTs , this is specfic to BeagleBone black and may vary.
- Compile :
You can either use compileuart or makefile , since it is a small project, it doesn't matter much. The variable "Target" has to be changed in MAKEFILE for different App as required.
Run
chmod a+x compileUART.sh
./compileUART.sh
OR
make clean
make
- Pin Configurtion :
For BeagleBone Black, if the cape-overlay is loaded, config-pin can be directly used to set pins for UART. Else corresponding BB-UART1-00A0.dtbo like devicetree overlays has to be added in uEnv.txt file.
Run
chmod a+x uartPinsConfig.sh
./uartPinsConfig.sh
- Now you can execute the application
- multiUARTApp.cpp
- Implement mutex-based lock in threads.
The following links provide a very good read about Serial programming and termios structure details.
- HOWTO-Serial-Programming - Also include sample code. Good explanation of canonical and non-canonical modes.
- Serial_Programming-wiki
- termios - good explanation of termios flags
- stty and man page