All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai] CAN bus on beaglebone
@ 2013-03-24 22:01 Davide Faconti
  2013-03-24 22:10 ` Gilles Chanteperdrix
  2013-03-25 13:01 ` Wolfgang Grandegger
  0 siblings, 2 replies; 5+ messages in thread
From: Davide Faconti @ 2013-03-24 22:01 UTC (permalink / raw)
  To: xenomai

Dear Xenomai users and developers,

finally I managet to have a working xenomai (Kernel 3.2.21, xenomai
2.6.2.1) on my beloved Beaglebone.

Everything works fine BUT I can't get my CAN bus working.
Partly this is not a surprise, since I don't think that RTCAN
currently support the D_CAN on Beaglebone (am I right?)

> rtcanconfig rtcan0 --verbose --baudrate=125000 start
> mode: start (0x1)
> Can't get interface index for rtcan0, code = -19

What is disappointing is that the other Socketcan, that in theory it
is also installed, isn't working anymore.

I can get the device can0 "up" writing the command

> ip link set can0 up type can bitrate 125000

But when I try to actually open de device I get the error

> Socket: Protocol not supported

Is there anyone that as any idea of what is going on and how I could fix it?
According to Google no one has tried already to use Xenomai +
Beaglebone + CAN  ;)

Davide Faconti


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

* Re: [Xenomai] CAN bus on beaglebone
  2013-03-24 22:01 [Xenomai] CAN bus on beaglebone Davide Faconti
@ 2013-03-24 22:10 ` Gilles Chanteperdrix
  2013-03-24 23:25   ` Davide Faconti
  2013-03-25 13:01 ` Wolfgang Grandegger
  1 sibling, 1 reply; 5+ messages in thread
From: Gilles Chanteperdrix @ 2013-03-24 22:10 UTC (permalink / raw)
  To: Davide Faconti; +Cc: xenomai

On 03/24/2013 11:01 PM, Davide Faconti wrote:

>> Socket: Protocol not supported
> 
> Is there anyone that as any idea of what is going on and how I could
> fix it?


Hi,

could you try the following patch?

diff --git a/src/skins/posix/rtdm.c b/src/skins/posix/rtdm.c
index aa23737..c6326f0 100644
--- a/src/skins/posix/rtdm.c
+++ b/src/skins/posix/rtdm.c
@@ -87,7 +87,7 @@ int __wrap_socket(int protocol_family, int socket_type, int protocol)
 				protocol_family, socket_type, protocol);
 	if (ret >= 0)
 		ret += __pse51_rtdm_fd_start;
-	else if (ret == -EAFNOSUPPORT || ret == -ENOSYS) {
+	else if (ret == -EAFNOSUPPORT || ret == -EPROTONOSUPPORT || ret == -ENOSYS) {
 		ret = __real_socket(protocol_family, socket_type, protocol);
 
 		if (ret >= __pse51_rtdm_fd_start) {

You need to recompile xenomai user-space support after
applying it.

Regards.

-- 
                                                                Gilles.


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

* Re: [Xenomai] CAN bus on beaglebone
  2013-03-24 22:10 ` Gilles Chanteperdrix
@ 2013-03-24 23:25   ` Davide Faconti
  2013-03-25  7:42     ` Gilles Chanteperdrix
  0 siblings, 1 reply; 5+ messages in thread
From: Davide Faconti @ 2013-03-24 23:25 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai

Hi,

I tried but the output isn't very different (I hope I did everything
correctly...)


> mode: start (0x1)
> Can't get interface index for rtcan0, code = -19

By the way, I also get this:

> [ 4477.943935] Xenomai: RTDM: closing file descriptor 0.

Davide


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

* Re: [Xenomai] CAN bus on beaglebone
  2013-03-24 23:25   ` Davide Faconti
@ 2013-03-25  7:42     ` Gilles Chanteperdrix
  0 siblings, 0 replies; 5+ messages in thread
From: Gilles Chanteperdrix @ 2013-03-25  7:42 UTC (permalink / raw)
  To: Davide Faconti; +Cc: xenomai

On 03/25/2013 12:25 AM, Davide Faconti wrote:

> Hi,


Hi,

> 
> I tried but the output isn't very different (I hope I did everything
> correctly...)
> 
> 
>> mode: start (0x1)
>> Can't get interface index for rtcan0, code = -19


The patch is supposed to fix the issue "Socket: protocol not supported"
you would get when trying to use linux socketcan interface with a
program compiled with xenomai posix skin flags. Which is why my answer
quoted this error message.

> 
> By the way, I also get this:
> 
>> [ 4477.943935] Xenomai: RTDM: closing file descriptor 0.


You get that because you exit from the program without closing the RTDM
file descriptor 0.

-- 
                                                                Gilles.


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

* Re: [Xenomai] CAN bus on beaglebone
  2013-03-24 22:01 [Xenomai] CAN bus on beaglebone Davide Faconti
  2013-03-24 22:10 ` Gilles Chanteperdrix
@ 2013-03-25 13:01 ` Wolfgang Grandegger
  1 sibling, 0 replies; 5+ messages in thread
From: Wolfgang Grandegger @ 2013-03-25 13:01 UTC (permalink / raw)
  To: Davide Faconti; +Cc: xenomai

On 03/24/2013 11:01 PM, Davide Faconti wrote:
> Dear Xenomai users and developers,
> 
> finally I managet to have a working xenomai (Kernel 3.2.21, xenomai
> 2.6.2.1) on my beloved Beaglebone.
> 
> Everything works fine BUT I can't get my CAN bus working.
> Partly this is not a surprise, since I don't think that RTCAN
> currently support the D_CAN on Beaglebone (am I right?)

You are right? There is no C_CAN/D_CAN driver in RTcan. It needs to be
ported from the Linux driver similar to what I have done recently for
the Flexcan driver.

>> rtcanconfig rtcan0 --verbose --baudrate=125000 start
>> mode: start (0x1)
>> Can't get interface index for rtcan0, code = -19

#define	ENODEV		19	/* No such device */

That is no suprise. It's useless to use rtcanconfig without supported
device.

> What is disappointing is that the other Socketcan, that in theory it
> is also installed, isn't working anymore.
> 
> I can get the device can0 "up" writing the command
> 
>> ip link set can0 up type can bitrate 125000
> 
> But when I try to actually open de device I get the error
> 
>> Socket: Protocol not supported

Does it definitely work with a vanilla kernel (without iPipe and Xenomai)?

Did you link your program against the Xenomai POSIX libraries?

> Is there anyone that as any idea of what is going on and how I could fix it?
> According to Google no one has tried already to use Xenomai +
> Beaglebone + CAN  ;)

As long as you do not have a RTcan driver for your hardware you could
play with the "Virtual CAN bus driver" (CONFIG_XENO_DRIVERS_CAN_VIRT).

Wolfgang.



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

end of thread, other threads:[~2013-03-25 13:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-24 22:01 [Xenomai] CAN bus on beaglebone Davide Faconti
2013-03-24 22:10 ` Gilles Chanteperdrix
2013-03-24 23:25   ` Davide Faconti
2013-03-25  7:42     ` Gilles Chanteperdrix
2013-03-25 13:01 ` Wolfgang Grandegger

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.