All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai] rtdm can on mpc5121e - no rtcan devices detected
@ 2013-12-08 19:44 Andreas Gareis
  2013-12-08 22:06 ` Tom Evans
  0 siblings, 1 reply; 7+ messages in thread
From: Andreas Gareis @ 2013-12-08 19:44 UTC (permalink / raw)
  To: xenomai

Hi Wolfgang, 

Thanks for your answer. 

On 11/30/2013 01:00, Wolfgang Grandegger wrote 
>Hi Andreas,
> 
>On 11/29/2013 03:06 PM, andreas.gareis wrote: 
>> Hello,
>> 
>> I am trying to get running xenomai with RTDM support on an embedde 
>>linux  system. A powerpc mpc5121e operates on this system. I've 
>>suceeded in  patching the linux (3.0.4) with xenomai (2.6.2.1). The 
>>xenomai kernel  seems to work correct as I was able to run some of the 
>>xenomai examples  and my own test application.
>> Now I want to use the CAN interface in realtime. I've activated 
>>"Real-time sub-system => Drivers => CAN drivers => RT-Socket-CAN,  CAN 
>>raw socket interface" and "Real-time sub-system => Drivers =>  CAN 
>>drivers => MSCAN driver for MPC52xx and MPC512x"
>> ("module" as well as "build-in")  and also  deactivated "Networking 
>>support => CAN bus subsystem support => Raw CAN  Protocol (raw access 
>>with CAN-ID filtering)" in the linux kernel  configuration. The entry 
>>"Networking support => CAN bus subsystem support

>> => CAN Device Drivers Freescale MPC5xxx onboard CAN controller" is 
>> enabled as the xenomai module "xeno_can_mscan.ko" isn't able to start 
>> without it.

>> When xenomai CAN modules are used as module (not build-in) I started 
>> the module "xeno_can.ko" and "xeno_can_mscan.ko" afterwards. No 
>> errors or warnings appear but there aren't new devices in "/dev", too.
> 
> Is the MSCAN device defined in your device tree (dts file)? If not, no 
> devices will be detected.

Yes, but I didn't modify the dts-file (which is used for "normal" (non
xenomai) Linux) as in rtcan_mscan_mpc5xxx.c there is a line which includes: 
 .compatible = "fsl,mpc5121-mscan" 
  
CAN0 entry in dts-file: 
   mscan@1300 { 
       compatible = "fsl,mpc5121-mscan"; 
       interrupts = <12 8>; 
       reg = <0x1300 0x80>; 
       fsl,mscan-clock-source = "ip"; 
   }; 

> RTCAN devices are not visible in /dev. It's not a character device. 
> You can find more informations in /proc/rtnet.
    
The files "devices" and "sockets" which are located in /proc/rtcan don't
have any entries. (/proc/rtnet doesn't exist on my system) 

>> How can I check if the module is working correctly? Or do I have to 
>> do some other initialization?
> 
> See above. When a MSCAN device is detected you should find a related 
> line in the kernel log (dmesg), starting with "MSCAN at ...".
> 
> Next time please make a CC to the Xenomai mailing list. 
> 
> Wolfgang. 

In kernelconfig I have enabled "Networking support => CAN bus subsystem
support => CAN Device Drivers Freescale MPC5xxx onboard CAN controller"
(Otherwise "insmod xeno_can_mscan.ko" gets stuck) 

After boot up dmesg shows: 

  I-pipe 2.13-03: pipeline enabled. 
  ... 
  I-pipe: Domain Xenomai registered. 
  Xenomai: hal/powerpc started. 
  Xenomai: scheduling class idle registered. 
  Xenomai: scheduling class rt registered. 
  Xenomai: real-time nucleus v2.6.0-rc5 (head) loaded. 
  Xenomai: debug mode enabled. 
  Xenomai: starting native API services. 
  Xenomai: starting POSIX services. 
  Xenomai: starting RTDM services. 
  ... 
  CAN device driver interface
  mpc5xxx_can 80001300.mscan: using 'ips_clk' with frequency divider 1
  mpc5xxx_can 80001300.mscan: MSCAN at 0xd10da300, irq 16, clock 66660000 Hz

  mpc5xxx_can 80001380.mscan: using 'ips_clk' with frequency divider 1
  mpc5xxx_can 80001380.mscan: MSCAN at 0xd10de380, irq 18, clock 66660000 Hz

  mpc5xxx_can 80002300.mscan: using 'ips_clk' with frequency divider 1
  mpc5xxx_can 80002300.mscan: MSCAN at 0xd10e2300, irq 90, clock 66660000 Hz

  mpc5xxx_can 80002380.mscan: using 'ips_clk' with frequency divider 1
  mpc5xxx_can 80002380.mscan: MSCAN at 0xd10e6380, irq 91, clock 66660000 Hz

  .. 
  can: controller area network core (rev 20090105 abi 8)
  ... 
  mpc5xxx_can 80001300.mscan: bitrate error 1.0%
  mpc5xxx_can 80001300.mscan: setting BTR0=0x05 BTR1=0x26
  can0 bitrate: 1010000, sample-point: 0.727
  mpc5xxx_can 80001380.mscan: bitrate error 1.0%
  mpc5xxx_can 80001380.mscan: setting BTR0=0x05 BTR1=0x26
  can1 bitrate: 1010000, sample-point: 0.727
  mpc5xxx_can 80002380.mscan: bitrate error 1.0%
  mpc5xxx_can 80002380.mscan: setting BTR0=0x05 BTR1=0x26
  can3 bitrate: 1010000, sample-point: 0.727 

After executing "insmod xeno_can.ko" dmesg shows: 
  RT-Socket-CAN 0.90.2 - (C) 2006 RT-Socket-CAN Development Team 

After executing "insmod xeno_can_mscan.ko" dmesg shows nothing. 

lsmod shows: 
  xeno_can_mscan 10840 0 - Live 0xd311a000
  xeno_can 16632 1 xeno_can_mscan, Live 0xd310b000 
  
Is there a problem when mpc5xxx_can is running before xeno_can_mscan is
loaded? 

Regards, Andreas





^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: [Xenomai] rtdm can on mpc5121e - no rtcan devices detected
@ 2013-12-09 18:17 Andreas Gareis
  2013-12-09 19:09 ` Wolfgang Grandegger
  0 siblings, 1 reply; 7+ messages in thread
From: Andreas Gareis @ 2013-12-09 18:17 UTC (permalink / raw)
  To: xenomai

Von: Tom Evans
 Gesendet: Sonntag, 8. Dezember 2013 23:07
> 
> On 09/12/13 06:44, Andreas Gareis wrote:
> > Hi Wolfgang,
> >
> > Thanks for your answer.
>  > ...
> >> RTCAN devices are not visible in /dev. It's not a character device.
> >> You can find more informations in /proc/rtnet.
> >
> > The files "devices" and "sockets" which are located in /proc/rtcan 
> > don't have any entries. (/proc/rtnet doesn't exist on my system)
> 
> Did the CAN devices work before you installed Xenomai? Get them 
> working there first.
> 
> On the device I'm using (Freescale i.MX53), the CAN drivers are 
> connected via NETWORKING. So they don't show up in /dev, just as 
> Ethernet doesn't show there either (/dev is so 1980's :-).
> 
> root@triton1:~# ls /proc/net/can
> rcvlist_all  rcvlist_err  rcvlist_inv  reset_stats  version 
> rcvlist_eff  rcvlist_fil rcvlist_sff  stats root@triton1:~# ifconfig
> can0      Link encap:UNSPEC  HWaddr
> 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
>            UP RUNNING NOARP  MTU:16  Metric:1
>            RX packets:0 errors:0 dropped:0 overruns:0 frame:0
>            TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
>            collisions:0 txqueuelen:256
>            RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
>            Interrupt:82
> 
> can1      Link encap:UNSPEC  HWaddr
> 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
>            UP RUNNING NOARP  MTU:16  Metric:1
>            RX packets:2527 errors:0 dropped:0 overruns:0 frame:0
>            TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
>            collisions:0 txqueuelen:256
>            RX bytes:19583 (19.1 KiB)  TX bytes:0 (0.0 B)
>            Interrupt:83
> 
> eth0      Link encap:Ethernet  HWaddr 00:0C:C6:79:6C:6E
> ... And so on.
> 
> Check for interrupts:
> 
> root@triton1:~# cat /proc/interrupts
>             CPU0
>    6:          0      tzic  sdma
> ...
>   64:          0      tzic  imx-i2c.2
>   82:          0      tzic  can0
>   83:       5832      tzic  can1
>   87:     124900      tzic  imx25-fec.0
> 
> 
> Tom
> 

Yes, the CAN devices worked before Xenomai installation. They were shown in
ifconfig and communication with other CAN-devices was possible.

When I select normal (non rt) CAN-support and xenomai kernel (without
RT-CAN) in the kernelconfig, working CAN devices are also available.

Now I want to use RT-CAN with xenomai. So, I activated "RT-Socket-CAN" and
"MSCAN driver for MPC52xx and MPC512x" in the kernelconfig. When "normal"
CAN support (Networking support => CAN bus subsystem support => CAN Device
Drivers Freescale MPC5xxx onboard CAN controller) is disabled, the xenomai
module "xeno_can_mscan.ko" isn't able to start. When "normal" CAN support is
enabled, the xenomai module "xeno_can_mscan.ko" can be loaded without errors
in dmesg, but there are no rtcan devices.


Andreas




^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: [Xenomai] rtdm can on mpc5121e - no rtcan devices detected
@ 2013-12-09 19:35 Andreas Gareis
  2013-12-10  8:01 ` Wolfgang Grandegger
  0 siblings, 1 reply; 7+ messages in thread
From: Andreas Gareis @ 2013-12-09 19:35 UTC (permalink / raw)
  To: xenomai

 Von: Wolfgang Grandegger
 Gesendet: Montag, 9. Dezember 2013 20:10
> 
> On Mon, 9 Dec 2013 19:17:47 +0100, "Andreas Gareis"
> <andreas.gareis@hs-augsburg.de> wrote:
> > Von: Tom Evans
> >  Gesendet: Sonntag, 8. Dezember 2013 23:07
> >>
> >> Did the CAN devices work before you installed Xenomai? Get them
> >> working there first.
> >>
> >
> > Yes, the CAN devices worked before Xenomai installation. They were
> > shown in 
> > ifconfig and communication with other CAN-devices was possible.
> >
> > When I select normal (non rt) CAN-support and xenomai kernel (without
> > RT-CAN) in the kernelconfig, working CAN devices are also available.
> >
> > Now I want to use RT-CAN with xenomai. So, I activated "RT-Socket-CAN"
> > and "MSCAN driver for MPC52xx and MPC512x" in the kernelconfig.
> > When "normal" CAN support (Networking support => CAN bus
> >  subsystem support => CAN Device Drivers Freescale MPC5xxx
> > onboard CAN controller) is disabled, the xenomai module
> > "xeno_can_mscan.ko" isn't able to start. When "normal" CAN support
> 
> That's the real problem. What happen's if you want to start the CAN device?
 
First I call "insmod xeno_can.ko". dmesg shows:
    RT-Socket-CAN 0.90.2 - (C) 2006 RT-Socket-CAN Development Team

Then I call "insmod xeno_can_mscan.ko".
This operation gets stuck (the insmod doesn't return). 
In dmesg there are no messages. 
lsmod shows that xeno_can is running and xeno_can_mscan is still loading.

> 
> > is
> > enabled, the xenomai module "xeno_can_mscan.ko" can be loaded
> > without errors in dmesg, but there are no rtcan devices.
> 
> But the device are not probed because they are already bound to a the Linux
> CAN driver. You can unbind them before loading the RTCAN driver but then
> you will run into the same problem then reported above.
> 
> Wolfgang.
> 
> 

Andreas




^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: [Xenomai] rtdm can on mpc5121e - no rtcan devices detected
@ 2013-12-30 16:00 Andreas Gareis
  0 siblings, 0 replies; 7+ messages in thread
From: Andreas Gareis @ 2013-12-30 16:00 UTC (permalink / raw)
  To: xenomai

> Von: Wolfgang Grandegger 

> 

> On Mon, 9 Dec 2013 20:35:12 +0100, "Andreas Gareis"

> < <mailto:andreas.gareis@hs-augsburg.de> andreas.gareis@hs-augsburg.de>
wrote:

> > Von: Wolfgang Grandegger

> >  Gesendet: Montag, 9. Dezember 2013 20:10

> >>

> >> On Mon, 9 Dec 2013 19:17:47 +0100, "Andreas Gareis"

> >> < <mailto:andreas.gareis@hs-augsburg.de> andreas.gareis@hs-augsburg.de>
wrote:

> >> > Von: Tom Evans

> >> >  Gesendet: Sonntag, 8. Dezember 2013 23:07

> >> >>

> >> >> Did the CAN devices work before you installed Xenomai? Get them

> >> >> working there first.

> >> >>

> >> >

> >> > Yes, the CAN devices worked before Xenomai installation. They were

> >> > shown in ifconfig and communication with other CAN-devices was

> >> > possible.

> >> >

> >> > When I select normal (non rt) CAN-support and xenomai kernel

> >> > (without

> >> > RT-CAN) in the kernelconfig, working CAN devices are also available.

> >> >

> >> > Now I want to use RT-CAN with xenomai. So, I activated

> "RT-Socket-CAN"

> >> > and "MSCAN driver for MPC52xx and MPC512x" in the kernelconfig.

> >> > When "normal" CAN support (Networking support => CAN bus

> subsystem

> >> > support => CAN Device Drivers Freescale MPC5xxx onboard CAN

> >> > controller) is disabled, the xenomai module "xeno_can_mscan.ko"

> >> > isn't able to start. When "normal" CAN support

> >>

> >> That's the real problem. What happen's if you want to start the CAN

> >> device?

> >

> > First I call "insmod xeno_can.ko". dmesg shows:

> >     RT-Socket-CAN 0.90.2 - (C) 2006 RT-Socket-CAN Development Team

> >

> > Then I call "insmod xeno_can_mscan.ko".

> > This operation gets stuck (the insmod doesn't return).

> > In dmesg there are no messages.

> > lsmod shows that xeno_can is running and xeno_can_mscan is still

> loading.

> 

> Add some pr_info/printk to the drivers probe function to see where it
hangs.

> 

> Wolfgang.

> 

 Sorry for my late answer. I've found the problem: I was using xenomai
2.6.0-rc5. In the function rtcan_mscan_mode_stop() in rtcan_mscan.c there is
a while() which is never terminated. So I used the code from current xenomai
version as there is a counter within the while(). The rtcan devices can be
used now.

 

Thank you for your help!

 

Andreas

 


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

end of thread, other threads:[~2013-12-30 16:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-08 19:44 [Xenomai] rtdm can on mpc5121e - no rtcan devices detected Andreas Gareis
2013-12-08 22:06 ` Tom Evans
  -- strict thread matches above, loose matches on Subject: below --
2013-12-09 18:17 Andreas Gareis
2013-12-09 19:09 ` Wolfgang Grandegger
2013-12-09 19:35 Andreas Gareis
2013-12-10  8:01 ` Wolfgang Grandegger
2013-12-30 16:00 Andreas Gareis

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.