All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Zhao, Lixiang" <Lixiang.Zhao@leoni.com>
To: "xenomai@xenomai.org" <xenomai@xenomai.org>
Subject: Using serial port with module xeno_16550A
Date: Mon, 1 Feb 2021 18:02:48 +0000	[thread overview]
Message-ID: <AS8PR08MB6485476EF27D66304C35723F9AB69@AS8PR08MB6485.eurprd08.prod.outlook.com> (raw)

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.


             reply	other threads:[~2021-02-01 18:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-01 18:02 Zhao, Lixiang [this message]
2021-02-01 19:26 ` Using serial port with module xeno_16550A Jan Kiszka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AS8PR08MB6485476EF27D66304C35723F9AB69@AS8PR08MB6485.eurprd08.prod.outlook.com \
    --to=lixiang.zhao@leoni.com \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.