[Xenomai] Serial Communication

Satapathy Asutosh sasutosh at ethz.ch
Fri Jun 30 19:36:35 CEST 2017


Hello everyone,

I am using xenomai 2.6.4 and trying to establish real-time serial communication with a Roboteq Motor Controller(HDC2450). The required configuration for serial communication is : 115200, 8-bit, no parity, 1 stop bit, no flow control

I have included the user account in the dialout group and set the port(/dev/ttyS0) permissions to 777. I then unload the uart driver and modprobe the xeno driver as follows:
sudo setserial /dev/ttyS0 uart none
sudo modprobe xeno_16550A io=0x3f8 irq=4 baud_base=115200 # I have also tried with irq=0

The code looks something like as follows:

int handle = rt_dev_open(port.c_str(), O_RDWR); // port is rtser0. rt_dev_open returns 0
...
config.config_mask       = 0xFFFF;
config.baud_rate         = 115200;
config.parity            = RTSER_NO_PARITY;
config.data_bits         = RTSER_8_BITS;
config.stop_bits         = RTSER_DEF_STOPB;
config.handshake         = RTSER_DEF_HAND;
config.fifo_depth        = RTSER_DEF_FIFO_DEPTH;
config.rx_timeout        = RTSER_DEF_TIMEOUT;
config.tx_timeout        = RTSER_DEF_TIMEOUT; 
config.event_timeout     = RTSER_DEF_TIMEOUT;
config.timestamp_history = RTSER_RX_TIMESTAMP_HISTORY;
config.event_mask        = RTSER_EVENT_RXPEND;

ser_err = rt_dev_ioctl(handle, RTSER_RTIOC_SET_CONFIG, &config); // returns 0
...
ssize_t countSent = rt_dev_write(handle, str.c_str(), str.length()); // returns -1. Operation not permitted

The rt_dev_write returns -1 which is "Operation not permitted". 

What am I doing wrong here? Any advice on how to proceed and debug? Thanks a lot in advance.

Cheers
Asutosh


More information about the Xenomai mailing list