Skip to contentSkip to conversation

Xenomai FlexCAN driver - where to start?

Xenomai Tomasz Guszkowski 2 participants 3 messages Jul 11, 2012 – Jul 16, 2012

lore
Share & tools
lore
#0 lore raw

Hello!

I am to write a MPC8309 (powerpc made by Freescale) FlexCAN driver for Xenomai. I have a working non-RT driver for this machine. Xenomai 2.6.0 works flawlessly as far I can assess it.

I have started converting a non-RT version of the driver to rtdm (rtcan) API and after some time spent on it I have an impression it will last a good while. (I am new to Xenomai driver development.)

I have also analyzed mscan and sja1000 drivers and the conclusion is that RT and non-RT versions have almost no common parts, at least meld can't easily point them.

So the questions are:

What is the preferrable starting point for writing Xenomai CAN driver?
Is my path (non-RT driver -> rtdm/rtcan driver) optimal?
Does there exist a better way, for example a kind of a "template" for filling up with some HW-specific code?
Now I think about trying to use a crippled mscan version as a template, despite the fact that mscan and FlexCAN have no common parts besides using Flattened Device Tree for HW description.Is this a good idea?

Any hints are welcomed.

--
Tomek

#1 lore raw
Quoted 8 lines · Tomasz Guszkowski

Hello!

I am to write a MPC8309 (powerpc made by Freescale) FlexCAN driver for Xenomai. I have a working non-RT driver for this machine. Xenomai 2.6.0 works flawlessly as far I can assess it.

I have started converting a non-RT version of the driver to rtdm (rtcan) API and after some time spent on it I have an impression it will last a good while. (I am new to Xenomai driver development.)

I have also analyzed mscan and sja1000 drivers and the conclusion is that RT and non-RT versions have almost no common parts, at least meld can't easily point them.

Quoted 8 lines

So the questions are:

What is the preferrable starting point for writing Xenomai CAN driver?
Is my path (non-RT driver -> rtdm/rtcan driver) optimal?
Does there exist a better way, for example a kind of a "template" for filling up with some HW-specific code?
Now I think about trying to use a crippled mscan version as a template, despite the fact that mscan and FlexCAN have no common parts besides using Flattened Device Tree for HW description.Is this a good idea?

Any hints are welcomed.

You need to use bit and pieces out of both driver sources. From the SJA1000 or MSCAN RTCAN driver we take the RTDM framework and RTCAN API calls and from Linux's flexcan.c we take the platform code and the init, config tx and rx code. But there are some distinct differences:

- The RTDM driver does not use deferred interrupt handling (napi)
- The API for mode and bitrate setting is different including bittime calculation.
- and even more ...

Today and tomorrow I'm out of office. I will have a closer look next week. Maybe I find the time to implement a first test version.

Wolfgang.

#2 lore raw
Quoted 23 lines · Wolfgang Grandegger
Quoted 8 lines · Tomasz Guszkowski

Hello!

I am to write a MPC8309 (powerpc made by Freescale) FlexCAN driver for Xenomai. I have a working non-RT driver for this machine. Xenomai 2.6.0 works flawlessly as far I can assess it.

I have started converting a non-RT version of the driver to rtdm (rtcan) API and after some time spent on it I have an impression it will last a good while. (I am new to Xenomai driver development.)

I have also analyzed mscan and sja1000 drivers and the conclusion is that RT and non-RT versions have almost no common parts, at least meld can't easily point them.

Quoted 8 lines

So the questions are:

What is the preferrable starting point for writing Xenomai CAN driver?
Is my path (non-RT driver -> rtdm/rtcan driver) optimal?
Does there exist a better way, for example a kind of a "template" for filling up with some HW-specific code?
Now I think about trying to use a crippled mscan version as a template, despite the fact that mscan and FlexCAN have no common parts besides using Flattened Device Tree for HW description.Is this a good idea?

Any hints are welcomed.

You need to use bit and pieces out of both driver sources. From the SJA1000 or MSCAN RTCAN driver we take the RTDM framework and RTCAN API calls and from Linux's flexcan.c we take the platform code and the init, config tx and rx code. But there are some distinct differences:

Quoted 7 lines

- The RTDM driver does not use deferred interrupt handling (napi)
- The API for mode and bitrate setting is different including bittime calculation.
- and even more ...

Today and tomorrow I'm out of office. I will have a closer look next week. Maybe I find the time to implement a first test version.

I started implementing rtcan_flexcan.c... Now I'm looking for a board with Flexcan hardware for testing. I have a mx35pdk at hand, which should be fine, but it does not boot yet with Linux 3.2.21 :(. Would you be ready for testing on your MPC hardware? What kernel version would you like to use? Does Xenomai already work on it?

Wolfgang.