All of lore.kernel.org
 help / color / mirror / Atom feed
* Using serial port with module xeno_16550A
@ 2021-02-01 18:02 Zhao, Lixiang
  2021-02-01 19:26 ` Jan Kiszka
  0 siblings, 1 reply; 2+ messages in thread
From: Zhao, Lixiang @ 2021-02-01 18:02 UTC (permalink / raw)
  To: xenomai

Hello,

I'm currently porting xenomai on my project on a raspberry pi 4B and I would like some advice, I'm using xenomai 3.0.9 with a ipipe patch that I found on the web, I managed to set the module xeno_16550A and I was able to replace the default module that load ttyAMA0 of the pi to /dev/rtdm/rtser0. Beside this, I was able to adapt the code to the real time task with the Xenomai API, and the performance I get with each cyclic is really good.

I would like to use this file descriptor to perform some exchange, the simple test is to connect a Null cable on the RX/TX UART in order to form a loop. I did import the rtdm/serial.h, and explicitely call the __RT() functions on the open, write, read and ioctl on the low level functions. I am able to open the file, configure it with ioctl and the rtser_config struct, and writing on it. What I am struggling with is the read function, I am not able to retrieve the correct return value of the read, it always return -1, I'm not sure if my configuration is correct or not.

The rtser_config is the following :
    struct rtser_config my_config;

    my_config.config_mask       = 0xFFFF; // RTSER_SET_BAUD | RTSER_SET_TIMESTAMP_HISTORY; // //
    my_config.baud_rate         = 115200;
    my_config.parity            = RTSER_NO_PARITY;
    my_config.data_bits         = RTSER_8_BITS;
    my_config.stop_bits         = RTSER_2_STOPB;
    my_config.handshake         = RTSER_RTSCTS_HAND;
    my_config.fifo_depth        = RTSER_DEF_FIFO_DEPTH;
    my_config.rx_timeout        = RTDM_TIMEOUT_INFINITE;
    my_config.tx_timeout        = RTDM_TIMEOUT_INFINITE;
    my_config.event_timeout     = 1000000000; /* 1 s */
    my_config.timestamp_history = RTSER_RX_TIMESTAMP_HISTORY;
    my_config.event_mask        = RTSER_EVENT_RXPEND;
    my_config.rs485             = RTSER_RS485_DISABLE;

Could you help me on this issue ?

Best regards,
Li Xiang.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Using serial port with module xeno_16550A
  2021-02-01 18:02 Using serial port with module xeno_16550A Zhao, Lixiang
@ 2021-02-01 19:26 ` Jan Kiszka
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Kiszka @ 2021-02-01 19:26 UTC (permalink / raw)
  To: Zhao, Lixiang, xenomai

On 01.02.21 19:02, Zhao, Lixiang via Xenomai wrote:
> Hello,
> 
> I'm currently porting xenomai on my project on a raspberry pi 4B and I would like some advice, I'm using xenomai 3.0.9 with a ipipe patch that I found on the web, I managed to set the module xeno_16550A and I was able to replace the default module that load ttyAMA0 of the pi to /dev/rtdm/rtser0. Beside this, I was able to adapt the code to the real time task with the Xenomai API, and the performance I get with each cyclic is really good.
> 

ttyAMA0 should refer to the pl011 UART, while the auxiliary one is a
8250, thus the fit for the exist rtserial driver.

> I would like to use this file descriptor to perform some exchange, the simple test is to connect a Null cable on the RX/TX UART in order to form a loop. I did import the rtdm/serial.h, and explicitely call the __RT() functions on the open, write, read and ioctl on the low level functions. I am able to open the file, configure it with ioctl and the rtser_config struct, and writing on it. What I am struggling with is the read function, I am not able to retrieve the correct return value of the read, it always return -1, I'm not sure if my configuration is correct or not.
> 
> The rtser_config is the following :
>     struct rtser_config my_config;
> 
>     my_config.config_mask       = 0xFFFF; // RTSER_SET_BAUD | RTSER_SET_TIMESTAMP_HISTORY; // //
>     my_config.baud_rate         = 115200;
>     my_config.parity            = RTSER_NO_PARITY;
>     my_config.data_bits         = RTSER_8_BITS;
>     my_config.stop_bits         = RTSER_2_STOPB;
>     my_config.handshake         = RTSER_RTSCTS_HAND;
>     my_config.fifo_depth        = RTSER_DEF_FIFO_DEPTH;
>     my_config.rx_timeout        = RTDM_TIMEOUT_INFINITE;
>     my_config.tx_timeout        = RTDM_TIMEOUT_INFINITE;
>     my_config.event_timeout     = 1000000000; /* 1 s */
>     my_config.timestamp_history = RTSER_RX_TIMESTAMP_HISTORY;
>     my_config.event_mask        = RTSER_EVENT_RXPEND;
>     my_config.rs485             = RTSER_RS485_DISABLE;
> 
> Could you help me on this issue ?
> 

Did you study demo/alchemy/cobalt/cross-link.c already? It's using the
alchemy skin rather than posix, but that you could translate once you
have a working pattern.

Jan

-- 
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-02-01 19:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-01 18:02 Using serial port with module xeno_16550A Zhao, Lixiang
2021-02-01 19:26 ` Jan Kiszka

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.