PC UART Listener (Linux)

XCore Project reviews, ideas, videos and proposals.
User avatar
snowman
Member
Posts: 13
Joined: Fri Dec 11, 2009 10:51 am

PC UART Listener (Linux)

Post by snowman »

Version: 1
Status: Just an idea
License: BSD
Download: /files/project_builds/UART_Listener_Linux.zip

Description:

This program is a Linux shell script will listen on a UART device (configured as default 115200/n/8/1) on a Linux machine.

See also PC UART Listener (Windows), which is a C program for Windows of equivalent functionality.
Usage:

$ ./xrun.sh test.xe

$ ./PollConsole.sh

Using default /dev/ttyUSB1

Polling every 1 sec

Console open

foo

foo

.

.

The "foo" lines come from the test.xe program.
FTDI UART is supported on Linux via the ftdi_sio kernel module. When properly detected, the FTDI chip appears as:

/dev/ttyUSB0 and /dev/ttyUSB1
Unfortunately each time xgdb accesses FTDI, these devices disappear. This means that with a third party RS232 console programme like GTKterm, you will lose connection each time xrun is called.
When it happens, the connection must be restored. GTKterm needs to reopen the port via the GUI or one can use modprobe:

sudo modprobe -r ftdi_sio && sudo modprobe ftdi_sio

i.e. restart ftdi_sio.
This is a known issue with the FTDI drivers and we have filed support requests with FTDI on it. Inside XMOS, we either debug in Windows (using virtual COM ports), or restart ftdi_sio after each xrun:

xrun program.xe && sudo modprobe -r ftdi_sio && modprobe ftdi_sio
This is exactly what the xrun.sh script does.
The PollConsole.sh script polls the /dev/ttyUSB1 device (or any other specified) and displays output when ready.


User avatar
jonathan
Respected Member
Posts: 377
Joined: Thu Dec 10, 2009 6:07 pm

Post by jonathan »

Thanks Larry, much appreciated!

For those on Linux who wanna use their XC-1A kits, this is very useful.
Image
User avatar
rp181
Respected Member
Posts: 395
Joined: Tue May 18, 2010 12:25 am

Post by rp181 »

So does the script poll after it looses connection?