I'm trying to read the values of some gpios, which are connected to an
io expander, inside a xenomai kernel module.

I can read these gpio fine using standard linux gpiod calls.

Just calling gpio_get_value (or gpio_get_value_cansleep) from the
xenomai kernel module works fine during module init. It always works
fine for non-i2c gpios.

However, doing the same read or write inside the rt task results in a
freeze of the board.

The hardware is an Imx6ull board, xenomai version 3.1.1, linux 5.4.119
(vanilla) and ipipe-core-5.4.119. The way, the expander is a pca8135.

I'm not sure what's happening there, but my guesses are that the
get_value with an i2c gpio results in the xenomai kernel spinning while
for the linux kernel (the pca driver is only available for linux), but
thus not giving it time to handle the reading from the i2c. In all
cases it means that even if it would work there would be no real-time
guarantee.

Searching "xenomai + i2c gpio" does not seems to give pertinent results
(just a few old results). So:
* is this supposed to work out-of-the-box ? (my guess is no)
* is it possible to use i2c from inside a xenomai driver
* if not, what would be the proper way to make it work under xenomai (i
can write a driver dedicated to our board (ie, i2c + io expander), but
maybe a more generic i2c would be more useful for the community).

Regards,

Julien

Reply via email to