* [Xenomai-help] rtcanconfig rtcansend rtcanrecv
@ 2009-01-07 16:17 Charlton, John
2009-01-07 17:28 ` Sebastian Smolorz
2009-01-07 18:19 ` Wolfgang Grandegger
0 siblings, 2 replies; 21+ messages in thread
From: Charlton, John @ 2009-01-07 16:17 UTC (permalink / raw)
To: xenomai@xenomai.org, socketcan-users@domain.hid
I added a kernel module to the xenomai ksrc/drivers/xenomai/can/sja1000. It builds and installs with make modules_install for linux-2.6.27.7 and xenomai-2.4.6.1. I am using OpenEmbedded on an i686 NANO-7240 single board computer. I load the kernal modules and start for two TS_CAN1 CAN boards with the following commands:
insmod xeno_can_sja1000.ko
insmod xeno_can_tscan1.ko io=0x100,0x120 irq=5,7
rtcanconfig rtcan0 --baudrate=125000 start
rtcanconfig rtcan1 --baudrate=125000 start
/proc/rtcan/rtcan0/info:
Device rtcan0
Controller SJA1000
Board TSCAN1-Board
Clock-Hz 8000000
Baudrate 125000
Bit-time brp=4 prop_seg=0 phase_seg1=13 phase_seg2=2 sjw=1 sam=0
Ctrl-Mode
State active
TX-Counter 0
RX-Counter 0
Errors 0
Refcount 0
/proc/rtcan/rtcan1/info:
Device rtcan1
Controller SJA1000
Board TSCAN1-Board
Clock-Hz 8000000
Baudrate 125000
Bit-time brp=4 prop_seg=0 phase_seg1=13 phase_seg2=2 sjw=1 sam=0
Ctrl-Mode
State active
TX-Counter 0
RX-Counter 0
Errors 0
Refcount 0
In one terminal I receive from rtcan0 as follows:
rtcanrecv rtcan0 --verbose
interface rtcan0
s=0, ifr_name=rtcan0
In a second terminal I send to rtcan1 as follows:
rtcansend rtcan1 --verbose --identifier=0x123 0xde 0xad
interface rtcan1
s=1, ifr_name=rtcan1
<0x123> [2] de ad
Cleaning up...
Nothing happens on the rtcanrecv side--it remains blocked. If I send a second time the rtcansend side blocks after the s=1, ifr_name=rtcan1 is displayed.
I am new to CAN interfaces so I don't know if the Bit-time and Clock-Hz parameters are correct. I appreciate any advice. I am proceeding to get more output from the xeno_can_tscan1 kernel module. I have the two TS_CAN1 interfaces output/input connected directly together with a short (3 inch) straight 10 conductor ribbon cable. Both boards have the 120 ohm termination.
--John
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [Xenomai-help] rtcanconfig rtcansend rtcanrecv
2009-01-07 16:17 [Xenomai-help] rtcanconfig rtcansend rtcanrecv Charlton, John
@ 2009-01-07 17:28 ` Sebastian Smolorz
2009-01-07 19:56 ` Charlton, John
2009-01-07 20:08 ` [Xenomai-help] " Charlton, John
2009-01-07 18:19 ` Wolfgang Grandegger
1 sibling, 2 replies; 21+ messages in thread
From: Sebastian Smolorz @ 2009-01-07 17:28 UTC (permalink / raw)
To: xenomai; +Cc: socketcan-users@domain.hid
Charlton, John wrote:
> I added a kernel module to the xenomai ksrc/drivers/xenomai/can/sja1000.
In an earlier post to the xenomai-help ML you said that you modified
rtcan_isa.c to make your CAN adapter work. Could you share your modifications
with us? Otherwise it's difficult to analyse your problem because you changed
the code we know in an unknown matter and maybe you made a mistake. It's like
chasing ghosts without your source code.
--
Sebastian
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [Xenomai-help] rtcanconfig rtcansend rtcanrecv
2009-01-07 17:28 ` Sebastian Smolorz
@ 2009-01-07 19:56 ` Charlton, John
2009-01-08 10:32 ` Sebastian Smolorz
2009-01-07 20:08 ` [Xenomai-help] " Charlton, John
1 sibling, 1 reply; 21+ messages in thread
From: Charlton, John @ 2009-01-07 19:56 UTC (permalink / raw)
To: Sebastian Smolorz, xenomai@xenomai.org; +Cc: socketcan-users@domain.hid
[-- Attachment #1: Type: text/plain, Size: 2182 bytes --]
I am attaching rtcan_tscan1.zip (and the ts-can1-manual.pdf) which contains the added rtcan_tscan1.c and Kconfig and Makefile modifications I made. It is possible that there is something in my kernel module that is causing the problem. I copied the rtcan_isa.c module and changed the names for the tscan1 device. The TS-CAN1 PC-104 has jumper selectable configuration registers and IRQ. The first TS-CAN1 is at the default open jumper setting which is IO address 0x150 to 0x157 and IRQ5 (both JP4 and JP5). The second TS-CAN1 is at 0x158 to 0x15F and IRQ7 (only JP5).
Wolfgang is correct in his reply there is nothing going out on the wire or at least the receiver is not receiving anything. I used rtcanrecv rtcan0 -e 0xffff and no errors are displayed. After rtcansend the /proc/rtcan/rtcan{0|1}/info show that nothing is changed in the receiver and the sender TX-counter is incremented to 1:
After:
Device rtcan0
Controller SJA1000
Board TSCAN1-Board
Clock-Hz 8000000
Baudrate 125000
Bit-time brp=4 prop_seg=0 phase_seg1=13 phase_seg2=2 sjw=1 sam=0
Ctrl-Mode
State active
TX-Counter 0
RX-Counter 0
Errors 0
Refcount 0
After:
Device rtcan1
Controller SJA1000
Board TSCAN1-Board
Clock-Hz 8000000
Baudrate 125000
Bit-time brp=4 prop_seg=0 phase_seg1=13 phase_seg2=2 sjw=1 sam=0
Ctrl-Mode
State active
TX-Counter 1
RX-Counter 0
Errors 0
Refcount 0
-----Original Message-----
From: Sebastian Smolorz [mailto:Sebastian.Smolorz@domain.hid]
Sent: Wednesday, January 07, 2009 12:29 PM
To: xenomai@xenomai.org
Cc: Charlton, John; socketcan-users@domain.hid
Subject: Re: [Xenomai-help] rtcanconfig rtcansend rtcanrecv
Charlton, John wrote:
> I added a kernel module to the xenomai ksrc/drivers/xenomai/can/sja1000.
In an earlier post to the xenomai-help ML you said that you modified rtcan_isa.c to make your CAN adapter work. Could you share your modifications with us? Otherwise it's difficult to analyse your problem because you changed the code we know in an unknown matter and maybe you made a mistake. It's like chasing ghosts without your source code.
--
Sebastian
[-- Attachment #2: rtcan_tscan1.zip --]
[-- Type: application/x-zip-compressed, Size: 3902 bytes --]
[-- Attachment #3: ts-can1-manual.pdf --]
[-- Type: application/pdf, Size: 207365 bytes --]
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: [Xenomai-help] rtcanconfig rtcansend rtcanrecv
2009-01-07 19:56 ` Charlton, John
@ 2009-01-08 10:32 ` Sebastian Smolorz
2009-01-08 13:21 ` Charlton, John
0 siblings, 1 reply; 21+ messages in thread
From: Sebastian Smolorz @ 2009-01-08 10:32 UTC (permalink / raw)
To: Charlton, John; +Cc: xenomai@xenomai.org, socketcan-users@domain.hid
Charlton, John wrote:
> I am attaching rtcan_tscan1.zip (and the ts-can1-manual.pdf) which
> contains the added rtcan_tscan1.c and Kconfig and Makefile modifications
> I made. It is possible that there is something in my kernel module that
> is causing the problem. I copied the rtcan_isa.c module and changed the
> names for the tscan1 device. The TS-CAN1 PC-104 has jumper selectable
> configuration registers and IRQ. The first TS-CAN1 is at the default
> open jumper setting which is IO address 0x150 to 0x157 and IRQ5 (both
> JP4 and JP5). The second TS-CAN1 is at 0x158 to 0x15F and IRQ7 (only JP5).
Without digging too deep into the special properties of your CAN
hardware and your source code modifications: It seems to me that your
CAN controller has two distinct IO regions whereas rtcan_isa assumes
that there is one IO region of 32 bytes which belongs to the SJA1000.
What are the two regions of your hardware for especially, the one with
only 8 bytes? You should check whether you access those SJA1000
registers correctly. A look into rtcan_sja1000_regs.h may help you.
However, as Wolfgang already suggested, there is at least one driver
available for plain Linux which should work with your CAN controller. If
you tested this driver successfully you could take a look into its
source to get further hints for your Xenomai driver.
--
Sebastian
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [Xenomai-help] rtcanconfig rtcansend rtcanrecv
2009-01-08 10:32 ` Sebastian Smolorz
@ 2009-01-08 13:21 ` Charlton, John
2009-01-12 15:33 ` Charlton, John
[not found] ` <496605F2.1080306@domain.hid>
0 siblings, 2 replies; 21+ messages in thread
From: Charlton, John @ 2009-01-08 13:21 UTC (permalink / raw)
To: Sebastian Smolorz; +Cc: xenomai@xenomai.org, socketcan-users@domain.hid
Sebastian,
Thank you for looking at the rtcan_tscan1.c source code. You are right, there are two distinct IO regions in the TS-CAN1, but rtcan_sja1000_regs.h only should access the SJA1000 region. The other IO region is accessed only by the rtcan_tscan1.c module to select the IO region for the SJA1000. The TS-CAN1 and IRQ lines are selected by jumpers and the jumper selection is not currently checked in the rtcan_tscan1.c module (it can be checked since it is readable from the TS-CAN1 base + 6 status register). The TS-CAN1 base + 5 register is the one that selects the SJA1000 base address. Setting only bit 6 of TS-CAN1 + 5 maps the SJA1000 to 0x100 - 0x11F. The rtcan_tscan1.c module sets the lower three bits of the TS-CAN1 + 5 to the idx parameter which maps the SJA1000 to 0x120 - 0x13F if idx is 1 and so on. The io addresses and irq variables passed to the xeno_can_tscan1 module when loaded must be consistent with the jumper settings. In my test, the first TS-CAN1 is set to the default base address of 0x150 and irq 5 and the second is set to 0x158 and irq 7 and the module is loaded as follows:
insmod xeno_can_tscan1.ko io=0x100,0x120 irq=5,7
Note that the io base address array is set to the SJA1000 base addresses and not the TS-CAN1 addresses. The rtcan_tscan1.c module takes care of setting the TS-CAN1 base address + 5 so that the SJA1000 IO region is as specified in the insmod above.
Since my primary goal at present is to test and compare CAN IP performance with ethernet IP performance, I am going to shift to the lincan driver. We are planning to use xenomai in the near future so I would like to fix the rtcan_tscan1.c module to work correctly.
--John
-----Original Message-----
From: Sebastian Smolorz [mailto:smolorz@domain.hid]
Sent: Thursday, January 08, 2009 5:33 AM
To: Charlton, John
Cc: xenomai@xenomai.org; socketcan-users@domain.hid
Subject: Re: [Xenomai-help] rtcanconfig rtcansend rtcanrecv
Charlton, John wrote:
> I am attaching rtcan_tscan1.zip (and the ts-can1-manual.pdf) which
> contains the added rtcan_tscan1.c and Kconfig and Makefile
> modifications I made. It is possible that there is something in my
> kernel module that is causing the problem. I copied the rtcan_isa.c
> module and changed the names for the tscan1 device. The TS-CAN1
> PC-104 has jumper selectable configuration registers and IRQ. The
> first TS-CAN1 is at the default open jumper setting which is IO
> address 0x150 to 0x157 and IRQ5 (both
> JP4 and JP5). The second TS-CAN1 is at 0x158 to 0x15F and IRQ7 (only JP5).
Without digging too deep into the special properties of your CAN hardware and your source code modifications: It seems to me that your CAN controller has two distinct IO regions whereas rtcan_isa assumes that there is one IO region of 32 bytes which belongs to the SJA1000.
What are the two regions of your hardware for especially, the one with only 8 bytes? You should check whether you access those SJA1000 registers correctly. A look into rtcan_sja1000_regs.h may help you.
However, as Wolfgang already suggested, there is at least one driver available for plain Linux which should work with your CAN controller. If you tested this driver successfully you could take a look into its source to get further hints for your Xenomai driver.
--
Sebastian
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: [Xenomai-help] rtcanconfig rtcansend rtcanrecv
2009-01-08 13:21 ` Charlton, John
@ 2009-01-12 15:33 ` Charlton, John
2009-01-12 16:10 ` [Xenomai-help] [Socketcan-users] " Wolfgang Grandegger
[not found] ` <496605F2.1080306@domain.hid>
1 sibling, 1 reply; 21+ messages in thread
From: Charlton, John @ 2009-01-12 15:33 UTC (permalink / raw)
To: Sebastian Smolorz; +Cc: xenomai@xenomai.org, socketcan-users@domain.hid
[-- Attachment #1: Type: text/plain, Size: 7329 bytes --]
I am attaching an updated rtcan_tscan1.c driver for the TS_CAN1 PC-104 CAN interface. I have only attempted to configure it for x86 so it is not configured for ARM or any other architecture.
I tried to build lincan-0.3.3 for linux-2.6.27.7 and so far have not
succeeded so I have returned to testing the rtcan_tscan1.c module in
xenomai-2.4.6.1. I wait for input from rtcan0 in one terminal and
send to rtcan1 in another terminal. From previous tests the send does not block the first time but always
blocks on the second attempt (or in this case with multiple loops)
with a socket filter of -1. The details are below:
root@domain.hid:~$ rtcanconfig rtcan0 --verbose --baudrate=125000 start
mode: start (0x1)
baudrate: 125000
root@domain.hid:~$ rtcanconfig rtcan1 --verbose --baudrate=125000 start
mode: start (0x1)
baudrate: 125000
root@domain.hid:~$ cat /proc/rtcan/devices
Name___________ _Baudrate State___ TX_Counter RX_Counter ____Errors
rtcan0 125000 active 0 0 0
rtcan1 125000 active 0 0 0
root@domain.hid:~$ cat /proc/rtcan/sockets
fd Name___________ Filter ErrMask RX_Timeout_ns TX_Timeout_ns RX_BufFull TX_Lo
root@domain.hid:~$ rtcanrecv rtcan0 --verbose --error=0xffff
interface rtcan0
s=0, ifr_name=rtcan0
Using err_mask=0xffff
>>Blocks waiting for input
>>In another terminal:
rtcansend -d 500 -l 10 rtcan1 1 2 3 4 5 6 7 8
blocks waiting for transmit
In a third terminal:
root@domain.hid:~$ cat /proc/rtcan/sockets
fd Name___________ Filter ErrMask RX_Timeout_ns TX_Timeout_ns RX_BufFull TX_Lo
1 -1 0x00000 infinite infinite 0 1
0 1 0x0ffff infinite infinite 0 1
root@domain.hid:~$ cat /proc/rtcan0/info
cat: /proc/rtcan0/info: No such file or directory
root@domain.hid:~$ cat /proc/rtcan/rtcan0/info
Device rtcan0
Controller SJA1000
Board TSCAN1-Board
Clock-Hz 8000000
Baudrate 125000
Bit-time brp=4 prop_seg=0 phase_seg1=13 phase_seg2=2 sjw=1 sam=0
Ctrl-Mode
State active
TX-Counter 0
RX-Counter 0
Errors 0
Refcount 0
root@domain.hid:~$ cat /proc/rtcan/rtcan1/info
Device rtcan1
Controller SJA1000
Board TSCAN1-Board
Clock-Hz 8000000
Baudrate 125000
Bit-time brp=4 prop_seg=0 phase_seg1=13 phase_seg2=2 sjw=1 sam=0
Ctrl-Mode
State active
TX-Counter 1
RX-Counter 0
Errors 0
Refcount 1
root@domain.hid:~$
I am not sure what the 'Filter' parameter does. in the send socket,
it is -1 and in the receive socket it is 1. Since the receive socket
doesn't receive anything it indicates that the send never goes out on
the wire or the receive interrupt is not occurring.
If I do this:
root@domain.hid:~$ rtcanrecv rtcan0 --verbose --error=0xffff --filter=-1:-1:1:1
Filter #0: id=0xffffffff mask=0xffffffff
Filter #1: id=0x00000001 mask=0x00000001
interface rtcan0
s=0, ifr_name=rtcan0
Using err_mask=0xffff
The filter parameter is set to 2 for the receiver socket:
root@domain.hid:~$ cat /proc/rtcan/sockets
fd Name___________ Filter ErrMask RX_Timeout_ns TX_Timeout_ns RX_BufFull TX_Lo
0 2 0x0ffff infinite infinite 0 1
1 -1 0x00000 infinite infinite 0 1
root@domain.hid:~$
Both send and receive sockets remain blocked.
--John
-----Original Message-----
From: socketcan-users-bounces@domain.hid [mailto:socketcan-users-bounces@domain.hid] On Behalf Of Charlton, John
Sent: Thursday, January 08, 2009 8:21 AM
To: Sebastian Smolorz
Cc: xenomai@xenomai.org; socketcan-users@domain.hid
Subject: Re: [Socketcan-users] [Xenomai-help] rtcanconfig rtcansend rtcanrecv
Sebastian,
Thank you for looking at the rtcan_tscan1.c source code. You are right, there are two distinct IO regions in the TS-CAN1, but rtcan_sja1000_regs.h only should access the SJA1000 region. The other IO region is accessed only by the rtcan_tscan1.c module to select the IO region for the SJA1000. The TS-CAN1 and IRQ lines are selected by jumpers and the jumper selection is not currently checked in the rtcan_tscan1.c module (it can be checked since it is readable from the TS-CAN1 base + 6 status register). The TS-CAN1 base + 5 register is the one that selects the SJA1000 base address. Setting only bit 6 of TS-CAN1 + 5 maps the SJA1000 to 0x100 - 0x11F. The rtcan_tscan1.c module sets the lower three bits of the TS-CAN1 + 5 to the idx parameter which maps the SJA1000 to 0x120 - 0x13F if idx is 1 and so on. The io addresses and irq variables passed to the xeno_can_tscan1 module when loaded must be consistent with the jumper settings. In my test, the first TS-CAN1 is set to the
default base address of 0x150 and irq 5 and the second is set to 0x158 and irq 7 and the module is loaded as follows:
insmod xeno_can_tscan1.ko io=0x100,0x120 irq=5,7
Note that the io base address array is set to the SJA1000 base addresses and not the TS-CAN1 addresses. The rtcan_tscan1.c module takes care of setting the TS-CAN1 base address + 5 so that the SJA1000 IO region is as specified in the insmod above.
Since my primary goal at present is to test and compare CAN IP performance with ethernet IP performance, I am going to shift to the lincan driver. We are planning to use xenomai in the near future so I would like to fix the rtcan_tscan1.c module to work correctly.
--John
-----Original Message-----
From: Sebastian Smolorz [mailto:smolorz@domain.hid]
Sent: Thursday, January 08, 2009 5:33 AM
To: Charlton, John
Cc: xenomai@xenomai.org; socketcan-users@domain.hid
Subject: Re: [Xenomai-help] rtcanconfig rtcansend rtcanrecv
Charlton, John wrote:
> I am attaching rtcan_tscan1.zip (and the ts-can1-manual.pdf) which
> contains the added rtcan_tscan1.c and Kconfig and Makefile
> modifications I made. It is possible that there is something in my
> kernel module that is causing the problem. I copied the rtcan_isa.c
> module and changed the names for the tscan1 device. The TS-CAN1
> PC-104 has jumper selectable configuration registers and IRQ. The
> first TS-CAN1 is at the default open jumper setting which is IO
> address 0x150 to 0x157 and IRQ5 (both
> JP4 and JP5). The second TS-CAN1 is at 0x158 to 0x15F and IRQ7 (only JP5).
Without digging too deep into the special properties of your CAN hardware and your source code modifications: It seems to me that your CAN controller has two distinct IO regions whereas rtcan_isa assumes that there is one IO region of 32 bytes which belongs to the SJA1000.
What are the two regions of your hardware for especially, the one with only 8 bytes? You should check whether you access those SJA1000 registers correctly. A look into rtcan_sja1000_regs.h may help you.
However, as Wolfgang already suggested, there is at least one driver available for plain Linux which should work with your CAN controller. If you tested this driver successfully you could take a look into its source to get further hints for your Xenomai driver.
--
Sebastian
_______________________________________________
Socketcan-users mailing list
Socketcan-users@domain.hid
https://lists.berlios.de/mailman/listinfo/socketcan-users
[-- Attachment #2: rtcan_tscan1.tgz --]
[-- Type: application/x-compressed, Size: 2348 bytes --]
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: [Xenomai-help] [Socketcan-users] rtcanconfig rtcansend rtcanrecv
2009-01-12 15:33 ` Charlton, John
@ 2009-01-12 16:10 ` Wolfgang Grandegger
2009-01-12 16:30 ` Charlton, John
0 siblings, 1 reply; 21+ messages in thread
From: Wolfgang Grandegger @ 2009-01-12 16:10 UTC (permalink / raw)
To: Charlton, John; +Cc: xenomai@xenomai.org, socketcan-users@domain.hid
Charlton, John wrote:
> I am attaching an updated rtcan_tscan1.c driver for the TS_CAN1 PC-104 CAN interface. I have only attempted to configure it for x86 so it is not configured for ARM or any other architecture.
>
> I tried to build lincan-0.3.3 for linux-2.6.27.7 and so far have not
> succeeded so I have returned to testing the rtcan_tscan1.c module in
> xenomai-2.4.6.1. I wait for input from rtcan0 in one terminal and
> send to rtcan1 in another terminal. From previous tests the send does not block the first time but always
> blocks on the second attempt (or in this case with multiple loops)
> with a socket filter of -1. The details are below:
>
> root@domain.hid:~$ rtcanconfig rtcan0 --verbose --baudrate=125000 start
> mode: start (0x1)
> baudrate: 125000
> root@domain.hid:~$ rtcanconfig rtcan1 --verbose --baudrate=125000 start
> mode: start (0x1)
> baudrate: 125000
> root@domain.hid:~$ cat /proc/rtcan/devices
> Name___________ _Baudrate State___ TX_Counter RX_Counter ____Errors
> rtcan0 125000 active 0 0 0
> rtcan1 125000 active 0 0 0
> root@domain.hid:~$ cat /proc/rtcan/sockets
> fd Name___________ Filter ErrMask RX_Timeout_ns TX_Timeout_ns RX_BufFull TX_Lo
> root@domain.hid:~$ rtcanrecv rtcan0 --verbose --error=0xffff
> interface rtcan0
> s=0, ifr_name=rtcan0
> Using err_mask=0xffff
>
>>> Blocks waiting for input
>
>>> In another terminal:
> rtcansend -d 500 -l 10 rtcan1 1 2 3 4 5 6 7 8
>
> blocks waiting for transmit
>
> In a third terminal:
>
> root@domain.hid:~$ cat /proc/rtcan/sockets
> fd Name___________ Filter ErrMask RX_Timeout_ns TX_Timeout_ns RX_BufFull TX_Lo
> 1 -1 0x00000 infinite infinite 0 1
> 0 1 0x0ffff infinite infinite 0 1
> root@domain.hid:~$ cat /proc/rtcan0/info
> cat: /proc/rtcan0/info: No such file or directory
> root@domain.hid:~$ cat /proc/rtcan/rtcan0/info
> Device rtcan0
> Controller SJA1000
> Board TSCAN1-Board
> Clock-Hz 8000000
> Baudrate 125000
> Bit-time brp=4 prop_seg=0 phase_seg1=13 phase_seg2=2 sjw=1 sam=0
> Ctrl-Mode
> State active
> TX-Counter 0
> RX-Counter 0
> Errors 0
> Refcount 0
> root@domain.hid:~$ cat /proc/rtcan/rtcan1/info
> Device rtcan1
> Controller SJA1000
> Board TSCAN1-Board
> Clock-Hz 8000000
> Baudrate 125000
> Bit-time brp=4 prop_seg=0 phase_seg1=13 phase_seg2=2 sjw=1 sam=0
> Ctrl-Mode
> State active
> TX-Counter 1
> RX-Counter 0
> Errors 0
> Refcount 1
> root@domain.hid:~$
>
> I am not sure what the 'Filter' parameter does. in the send socket,
> it is -1 and in the receive socket it is 1. Since the receive socket
> doesn't receive anything it indicates that the send never goes out on
> the wire or the receive interrupt is not occurring.
>
> If I do this:
> root@domain.hid:~$ rtcanrecv rtcan0 --verbose --error=0xffff --filter=-1:-1:1:1
> Filter #0: id=0xffffffff mask=0xffffffff
> Filter #1: id=0x00000001 mask=0x00000001
> interface rtcan0
> s=0, ifr_name=rtcan0
> Using err_mask=0xffff
>
> The filter parameter is set to 2 for the receiver socket:
> root@domain.hid:~$ cat /proc/rtcan/sockets
> fd Name___________ Filter ErrMask RX_Timeout_ns TX_Timeout_ns RX_BufFull TX_Lo
> 0 2 0x0ffff infinite infinite 0 1
> 1 -1 0x00000 infinite infinite 0 1
> root@domain.hid:~$
>
> Both send and receive sockets remain blocked.
The TX done interrupt does not come indicating that the hardware is not
configured or handled correctly. To simplify debugging
- connect an external known-to-work node your CAN bus, preferably a
CAN bus analyzer, to receive and send CAN messages.
- To inspect the SJA1000 registers und /proc/rtcan/rtcan[01]/registers,
enable the Kconfig option XENO_DRIVERS_CAN_DEBUG:
http://www.rts.uni-hannover.de/xenomai/lxr/source/ksrc/drivers/can/Kconfig#009
Wolfgang.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [Xenomai-help] [Socketcan-users] rtcanconfig rtcansend rtcanrecv
2009-01-12 16:10 ` [Xenomai-help] [Socketcan-users] " Wolfgang Grandegger
@ 2009-01-12 16:30 ` Charlton, John
2009-01-12 17:10 ` Sebastian Smolorz
2009-01-12 17:17 ` Wolfgang Grandegger
0 siblings, 2 replies; 21+ messages in thread
From: Charlton, John @ 2009-01-12 16:30 UTC (permalink / raw)
To: Wolfgang Grandegger; +Cc: xenomai@xenomai.org, socketcan-users@domain.hid
Wolfgang,
Thank you for the help. I do have XENO_DRIVERS_CAN_DEBUG enabled and the registers are:
root@domain.hid:~$ cat /proc/rtcan/rtcan1/registers
SJA1000 registers
00: 00 00 0c 02 ff 00 03 1c 1a 00 00 00 00 60 00 00
10: 08 00 20 01 02 03 04 05 06 07 08 ff 20 00 00 c8
root@domain.hid:~$ cat /proc/rtcan/rtcan0/registers
SJA1000 registers
00: 00 00 0d 01 ff 00 03 1c 1a 00 00 00 00 60 00 00
10: 08 00 20 01 02 03 04 05 06 07 08 bf 00 01 00 c8
root@domain.hid:~$
I will focus on the transmitter and try another CAN device or CAN analyzer as you suggest.
--John
-----Original Message-----
From: Wolfgang Grandegger [mailto:wg@domain.hid
Sent: Monday, January 12, 2009 11:10 AM
To: Charlton, John
Cc: Sebastian Smolorz; xenomai@xenomai.org; socketcan-users@domain.hid.de
Subject: Re: [Socketcan-users] [Xenomai-help] rtcanconfig rtcansend rtcanrecv
Charlton, John wrote:
> I am attaching an updated rtcan_tscan1.c driver for the TS_CAN1 PC-104 CAN interface. I have only attempted to configure it for x86 so it is not configured for ARM or any other architecture.
>
> I tried to build lincan-0.3.3 for linux-2.6.27.7 and so far have not
> succeeded so I have returned to testing the rtcan_tscan1.c module in
> xenomai-2.4.6.1. I wait for input from rtcan0 in one terminal and
> send to rtcan1 in another terminal. From previous tests the send does
> not block the first time but always blocks on the second attempt (or
> in this case with multiple loops) with a socket filter of -1. The details are below:
>
> root@domain.hid:~$ rtcanconfig rtcan0 --verbose --baudrate=125000
> start
> mode: start (0x1)
> baudrate: 125000
> root@domain.hid:~$ rtcanconfig rtcan1 --verbose --baudrate=125000
> start
> mode: start (0x1)
> baudrate: 125000
> root@domain.hid:~$ cat /proc/rtcan/devices Name___________ _Baudrate
> State___ TX_Counter RX_Counter ____Errors
> rtcan0 125000 active 0 0 0
> rtcan1 125000 active 0 0 0
> root@domain.hid:~$ cat /proc/rtcan/sockets fd Name___________ Filter
> ErrMask RX_Timeout_ns TX_Timeout_ns RX_BufFull TX_Lo
> root@domain.hid:~$ rtcanrecv rtcan0 --verbose --error=0xffff
> interface rtcan0 s=0, ifr_name=rtcan0 Using err_mask=0xffff
>
>>> Blocks waiting for input
>
>>> In another terminal:
> rtcansend -d 500 -l 10 rtcan1 1 2 3 4 5 6 7 8
>
> blocks waiting for transmit
>
> In a third terminal:
>
> root@domain.hid:~$ cat /proc/rtcan/sockets fd Name___________ Filter
> ErrMask RX_Timeout_ns TX_Timeout_ns RX_BufFull TX_Lo
> 1 -1 0x00000 infinite infinite 0 1
> 0 1 0x0ffff infinite infinite 0 1
> root@domain.hid:~$ cat /proc/rtcan0/info
> cat: /proc/rtcan0/info: No such file or directory root@domain.hid
> cat /proc/rtcan/rtcan0/info
> Device rtcan0
> Controller SJA1000
> Board TSCAN1-Board
> Clock-Hz 8000000
> Baudrate 125000
> Bit-time brp=4 prop_seg=0 phase_seg1=13 phase_seg2=2 sjw=1 sam=0
> Ctrl-Mode
> State active
> TX-Counter 0
> RX-Counter 0
> Errors 0
> Refcount 0
> root@domain.hid:~$ cat /proc/rtcan/rtcan1/info
> Device rtcan1
> Controller SJA1000
> Board TSCAN1-Board
> Clock-Hz 8000000
> Baudrate 125000
> Bit-time brp=4 prop_seg=0 phase_seg1=13 phase_seg2=2 sjw=1 sam=0
> Ctrl-Mode
> State active
> TX-Counter 1
> RX-Counter 0
> Errors 0
> Refcount 1
> root@domain.hid:~$
>
> I am not sure what the 'Filter' parameter does. in the send socket,
> it is -1 and in the receive socket it is 1. Since the receive socket
> doesn't receive anything it indicates that the send never goes out on
> the wire or the receive interrupt is not occurring.
>
> If I do this:
> root@domain.hid:~$ rtcanrecv rtcan0 --verbose --error=0xffff
> --filter=-1:-1:1:1 Filter #0: id=0xffffffff mask=0xffffffff Filter #1:
> id=0x00000001 mask=0x00000001 interface rtcan0 s=0, ifr_name=rtcan0
> Using err_mask=0xffff
>
> The filter parameter is set to 2 for the receiver socket:
> root@domain.hid:~$ cat /proc/rtcan/sockets fd Name___________ Filter
> ErrMask RX_Timeout_ns TX_Timeout_ns RX_BufFull TX_Lo
> 0 2 0x0ffff infinite infinite 0 1
> 1 -1 0x00000 infinite infinite 0 1
> root@domain.hid:~$
>
> Both send and receive sockets remain blocked.
The TX done interrupt does not come indicating that the hardware is not configured or handled correctly. To simplify debugging
- connect an external known-to-work node your CAN bus, preferably a
CAN bus analyzer, to receive and send CAN messages.
- To inspect the SJA1000 registers und /proc/rtcan/rtcan[01]/registers,
enable the Kconfig option XENO_DRIVERS_CAN_DEBUG:
http://www.rts.uni-hannover.de/xenomai/lxr/source/ksrc/drivers/can/Kconfig#009
Wolfgang.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [Xenomai-help] [Socketcan-users] rtcanconfig rtcansend rtcanrecv
2009-01-12 16:30 ` Charlton, John
@ 2009-01-12 17:10 ` Sebastian Smolorz
2009-01-12 18:47 ` Charlton, John
2009-01-12 17:17 ` Wolfgang Grandegger
1 sibling, 1 reply; 21+ messages in thread
From: Sebastian Smolorz @ 2009-01-12 17:10 UTC (permalink / raw)
To: Charlton, John; +Cc: xenomai, socketcan-users@domain.hid
Charlton, John wrote:
> root@domain.hid:~$ cat /proc/rtcan/rtcan1/registers
> SJA1000 registers
> 00: 00 00 0c 02 ff 00 03 1c 1a 00 00 00 00 60 00 00
> 10: 08 00 20 01 02 03 04 05 06 07 08 ff 20 00 00 c8
> root@domain.hid:~$ cat /proc/rtcan/rtcan0/registers
> SJA1000 registers
> 00: 00 00 0d 01 ff 00 03 1c 1a 00 00 00 00 60 00 00
> 10: 08 00 20 01 02 03 04 05 06 07 08 bf 00 01 00 c8
Register 0x03 reflects the exact interrupt bits. They mean that a RX interrupt
occured on rtcan0 (0x01) and a TX interrupt on rtcan1 (0x02). Now this is
interesting as it seems that your system does not get those interrrupts the
SJA1000s generate. Are you sure your IRQs that you specify on insmod are
really the correct ones?
--
Sebastian
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [Xenomai-help] [Socketcan-users] rtcanconfig rtcansend rtcanrecv
2009-01-12 17:10 ` Sebastian Smolorz
@ 2009-01-12 18:47 ` Charlton, John
2009-01-12 20:30 ` Wolfgang Grandegger
0 siblings, 1 reply; 21+ messages in thread
From: Charlton, John @ 2009-01-12 18:47 UTC (permalink / raw)
To: Sebastian Smolorz; +Cc: xenomai@xenomai.org, socketcan-users@domain.hid
I agree that rtcan1 transmit interrupt request is set as is rtcan0 receive request in sja1000 base + 3, but I notice that neither interrupt is enabled in the control register (offset 0). I think the command register should be 0x06 so that TIE and RIE interrupt enable bits are set. I am relying on the xeno_can_sja1000 module to set the interrupt enable bits since the xeno_can_tscan1 module should just provide access to the sja1000 registers. I don't think the xeno_can_tscan1 should program any of the sja1000 registers itself--is that assumption correct? I am specifying the correct interrupts which are jumper selected to be 5 and 7 for rtcan0 and rtcan1 respectively. The jumper settings can be checked using the TS-CAN1 base + 6 to but the driver doesn't do that yet.
Wolfgang mentioned that the rtcan_tscan1.c driver doesn't set the offset + 4 register to zero as does the lincan driver. I will correct that just in case but it is supposed to default to zero according to the TS-CAN1 documentation.
--John
-----Original Message-----
From: Sebastian Smolorz [mailto:Sebastian.Smolorz@domain.hid
Sent: Monday, January 12, 2009 12:11 PM
To: Charlton, John
Cc: Wolfgang Grandegger; xenomai@xenomai.org; socketcan-users@domain.hids.de
Subject: Re: [Xenomai-help] [Socketcan-users] rtcanconfig rtcansend rtcanrecv
Charlton, John wrote:
> root@domain.hid:~$ cat /proc/rtcan/rtcan1/registers SJA1000
> registers
> 00: 00 00 0c 02 ff 00 03 1c 1a 00 00 00 00 60 00 00
> 10: 08 00 20 01 02 03 04 05 06 07 08 ff 20 00 00 c8
> root@domain.hid:~$ cat /proc/rtcan/rtcan0/registers SJA1000
> registers
> 00: 00 00 0d 01 ff 00 03 1c 1a 00 00 00 00 60 00 00
> 10: 08 00 20 01 02 03 04 05 06 07 08 bf 00 01 00 c8
Register 0x03 reflects the exact interrupt bits. They mean that a RX interrupt occured on rtcan0 (0x01) and a TX interrupt on rtcan1 (0x02). Now this is interesting as it seems that your system does not get those interrrupts the SJA1000s generate. Are you sure your IRQs that you specify on insmod are really the correct ones?
--
Sebastian
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [Xenomai-help] [Socketcan-users] rtcanconfig rtcansend rtcanrecv
2009-01-12 18:47 ` Charlton, John
@ 2009-01-12 20:30 ` Wolfgang Grandegger
2009-01-13 14:32 ` Charlton, John
0 siblings, 1 reply; 21+ messages in thread
From: Wolfgang Grandegger @ 2009-01-12 20:30 UTC (permalink / raw)
To: Charlton, John; +Cc: xenomai@xenomai.org, socketcan-users@domain.hid
Charlton, John wrote:
> I agree that rtcan1 transmit interrupt request is set as is rtcan0 receive request in sja1000 base + 3, but I notice that neither interrupt is enabled in the control register (offset 0). I think the command register should be 0x06 so that TIE and RIE interrupt enable bits are set. I am relying on the xeno_can_sja1000 module to set the interrupt enable bits since the xeno_can_tscan1 module should just provide access to the sja1000 registers. I don't think the xeno_can_tscan1 should program any of the sja1000 registers itself--is that assumption correct? I am specifying the correct interrupts which are jumper selected to be 5 and 7 for rtcan0 and rtcan1 respectively. The jumper settings can be checked using the TS-CAN1 base + 6 to but the driver doesn't do that yet.
The interrupt enable register (IER) is at offset 0x4 and they are all
enabled (see below). The transfer from rtcan1 to rtcan0 went fine. Just
no interrupts are triggered. And yes, the SJA100 does all relevant
accesses to the SJA1000 chips. Some more questions:
- What do your read at offset 0x6 (JMP)?
- What does /proc/interrupts return?
- Do you see any RTCAN related messages with "$ dmesg".
Wolfgang
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [Xenomai-help] [Socketcan-users] rtcanconfig rtcansend rtcanrecv
2009-01-12 20:30 ` Wolfgang Grandegger
@ 2009-01-13 14:32 ` Charlton, John
2009-01-13 15:04 ` Wolfgang Grandegger
0 siblings, 1 reply; 21+ messages in thread
From: Charlton, John @ 2009-01-13 14:32 UTC (permalink / raw)
To: Wolfgang Grandegger; +Cc: xenomai@xenomai.org, socketcan-users@domain.hid
Wolfgang,
You are right. I am just learning the sja1000 registers and modes and I was looking at the 'BasicCAN' register configuration and the sja1000 can driver is using the 'PeliCAN' mode. So it does look like everything is configured correctly and it also looks like the data are tranferred from rtcan1 to rtcan0 registers except that the interrupts do not occur to notify the socket that the data is sent and received. There does not appear to be any error messages but only debug messages in the dmesg output below (all of those Wrote/Read messages are generated by the rtcan_tscan1.c printk which I am removing to reduce the spew):
loading xeno_can_sja1000.ko:
<4>RTCAN SJA1000 driver initialized
loading xeno_can_tscan1.ko:
<4>Initializing board 0
<4>Wrote io 0x60 to port 0x155
<4>Read 0x30 from io port 0x156
<4>Writing 0x00 to port 0x104
<4>Writing 0x01 to port 0x100
<4>Read 0x21 from port 0x100
<4>Read 0x0c from port 0x102
<4>Writing 0xc8 to port 0x11f
<4>Writing 0x1a to port 0x108
<4>Writing 0xff to port 0x114
<4>Writing 0xff to port 0x115
<4>Writing 0xff to port 0x116
<4>Writing 0xff to port 0x117
<4>rtcan: registered rtcan0
<4>Initializing board 1
<4>Wrote io 0x61 to port 0x15d
<4>Read 0x22 from io port 0x15e
<4>Writing 0x00 to port 0x124
<4>Writing 0x01 to port 0x120
<4>Read 0x21 from port 0x120
<4>Read 0x0c from port 0x122
<4>Writing 0xc8 to port 0x13f
<4>Writing 0x1a to port 0x128
<4>Writing 0xff to port 0x134
<4>Writing 0xff to port 0x135
<4>Writing 0xff to port 0x136
<4>Writing 0xff to port 0x137
<4>rtcan: registered rtcan1
rtcanconfig rtcan0:
<4>Writing 0x03 to port 0x106
<4>Writing 0x1c to port 0x107
<4>Writing 0x00 to port 0x10e
<4>Writing 0x00 to port 0x10f
<4>Read 0x00 from port 0x10c
<4>Writing 0xff to port 0x104
<4>Writing 0x00 to port 0x100
rtcanconfig rtcan1:
<4>Writing 0x03 to port 0x126
<4>Writing 0x1c to port 0x127
<4>Writing 0x00 to port 0x12e
<4>Writing 0x00 to port 0x12f
<4>Read 0x00 from port 0x12c
<4>Writing 0xff to port 0x124
<4>Writing 0x00 to port 0x120
rtcansend rtcan1:
<4>Writing 0x24 to port 0x131
<4>Writing 0x60 to port 0x132
<4>Writing 0xde to port 0x133
<4>Writing 0xad to port 0x134
<4>Writing 0x03 to port 0x135
<4>Writing 0x04 to port 0x136
<4>Writing 0x05 to port 0x137
<4>Writing 0x06 to port 0x138
<4>Writing 0x07 to port 0x139
<4>Writing 0x08 to port 0x13a
<4>Writing 0x08 to port 0x130
<4>Writing 0x01 to port 0x121
rtcansend command generating the above dmesg output due to printk in
rtcan_tscan1 driver:
root@domain.hid:~$ rtcansend rtcan1 --verbose --identifier=0x123 0xde 0xad 3 4 5 6 7 8
interface rtcan1
s=1, ifr_name=rtcan1
<0x123> [8] de ad 03 04 05 06 07 08
Cleaning up...
root@domain.hid:~$ cat /proc/rtcan/rtcan0/registers
SJA1000 registers
00: 00 00 0d 01 ff 00 03 1c 1a 00 00 00 00 60 00 00
10: 08 24 60 de ad 03 04 05 06 07 08 bf 00 01 00 c8
root@domain.hid:~$ cat /proc/rtcan/rtcan1/registers
SJA1000 registers
00: 00 00 0c 02 ff 00 03 1c 1a 00 00 00 00 60 00 00
10: 08 24 60 de ad 03 04 05 06 07 08 ff 00 00 00 c8
root@domain.hid:~$
ran rtcanrecv rtcan0 --verbose --error=0xffff in a separate terminal which remains blocked after the send above.
Your other questions are answered below.
Thanks,
--John
-----Original Message-----
From: Wolfgang Grandegger [mailto:wg@domain.hid
Sent: Monday, January 12, 2009 3:31 PM
To: Charlton, John
Cc: Sebastian Smolorz; xenomai@xenomai.org; socketcan-users@domain.hid.de
Subject: Re: [Xenomai-help] [Socketcan-users] rtcanconfig rtcansend rtcanrecv
Charlton, John wrote:
> I agree that rtcan1 transmit interrupt request is set as is rtcan0 receive request in sja1000 base + 3, but I notice that neither interrupt is enabled in the control register (offset 0). I think the command register should be 0x06 so that TIE and
RIE interrupt enable bits are set. I am relying on the xeno_can_sja1000 module to set the interrupt enable bits since the xeno_can_tscan1 module should just provide access to the sja1000 registers. I don't think the xeno_can_tscan1 should program any of the sja1000 registers itself--is that assumption correct? I am specifying the correct interrupts which are jumper selected to be 5 and 7 for rtcan0 and rtcan1 respectively. The jumper settings can be checked using the TS-CAN1 base + 6 to but the driver doesn't do that yet.
The interrupt enable register (IER) is at offset 0x4 and they are all enabled (see below). The transfer from rtcan1 to rtcan0 went fine. Just no interrupts are triggered. And yes, the SJA100 does all relevant accesses to the SJA1000 chips. Some more questions:
- What do your read at offset 0x6 (JMP)?
For idx 0: 0x30, 1: 0x22
- What does /proc/interrupts return?
cat /proc/interrupts
CPU0
0: 12314 XT-PIC-XT timer
1: 146 XT-PIC-XT i8042
2: 0 XT-PIC-XT cascade
6: 0 XT-PIC-XT uhci_hcd:usb1, uhci_hcd:usb2
12: 13 XT-PIC-XT eth0
14: 0 XT-PIC-XT ide0
15: 2151 XT-PIC-XT ide1
NMI: 0 Non-maskable interrupts
TRM: 0 Thermal event interrupts
ERR: 0
cat /proc/xenomai/irq
IRQ CPU0
0: 22398 [timer]
34: 0 [virtual]
After loading xeno_can_sja1000.ko and xeno_can_tscan1.ko:
cat /proc/xenomai/irq
IRQ CPU0
0: 175260 [timer]
5: 0 SJA1000
7: 0 SJA1000
34: 0 [virtual]
- Do you see any RTCAN related messages with "$ dmesg".
Wolfgang
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: [Xenomai-help] [Socketcan-users] rtcanconfig rtcansend rtcanrecv
2009-01-13 14:32 ` Charlton, John
@ 2009-01-13 15:04 ` Wolfgang Grandegger
2009-01-14 20:50 ` Charlton, John
0 siblings, 1 reply; 21+ messages in thread
From: Wolfgang Grandegger @ 2009-01-13 15:04 UTC (permalink / raw)
To: Charlton, John; +Cc: xenomai@xenomai.org, socketcan-users@domain.hid
Charlton, John wrote:
> Wolfgang,
>
> You are right. I am just learning the sja1000 registers and modes and I was looking at the 'BasicCAN' register configuration and the sja1000 can driver is using the 'PeliCAN' mode. So it does look like everything is configured correctly and it also looks like the data are tranferred from rtcan1 to rtcan0 registers except that the interrupts do not occur to notify the socket that the data is sent and received. There does not appear to be any error messages but only debug messages in the dmesg output below (all of those Wrote/Read messages are generated by the rtcan_tscan1.c printk which I am removing to reduce the spew):
OK.
> - What do your read at offset 0x6 (JMP)?
> For idx 0: 0x30, 1: 0x22
Looks good for the IRQ selection, but I can't tell what the bit 0x02 is
good for.
> - What does /proc/interrupts return?
> cat /proc/interrupts
> CPU0
> 0: 12314 XT-PIC-XT timer
> 1: 146 XT-PIC-XT i8042
> 2: 0 XT-PIC-XT cascade
> 6: 0 XT-PIC-XT uhci_hcd:usb1, uhci_hcd:usb2
> 12: 13 XT-PIC-XT eth0
> 14: 0 XT-PIC-XT ide0
> 15: 2151 XT-PIC-XT ide1
> NMI: 0 Non-maskable interrupts
> TRM: 0 Thermal event interrupts
> ERR: 0
I just wanted to check if IRQ 3 and 5 is already used by Linux. You also
can set the Xenomai IRQ flags in your driver to
chip->irq_flags = 0;
because IRQ sharing is not required.
Maybe there are x86-related problems with the IRQs. I'm not really an
expert, but sometimes there is trouble due to improper BIOS settings,
interrupt routing, etc.
Wolfgang.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [Xenomai-help] [Socketcan-users] rtcanconfig rtcansend rtcanrecv
2009-01-13 15:04 ` Wolfgang Grandegger
@ 2009-01-14 20:50 ` Charlton, John
0 siblings, 0 replies; 21+ messages in thread
From: Charlton, John @ 2009-01-14 20:50 UTC (permalink / raw)
To: Wolfgang Grandegger; +Cc: xenomai@xenomai.org, socketcan-users@domain.hid
[-- Attachment #1: Type: text/plain, Size: 2992 bytes --]
Wolfgang,
I am attaching the latest rtcan_tscan1.c module which is now working. Thank you for the help and the tip on the hardware configuration. The problem turned out to be a bios setting in the Nano-7240 embedded PC board. All interrupts are set by default to be PCI/PnP and the TS-CAN1 PC-104 card requires ISA/EISA configuration. I set irq 5 to ISA/EISA and now it works as advertised with one interrupt. I am still not able to get irq 6 or 7 to generate an interrupt from the second TS-CAN1 so I am going to test with separate CPU boards.
One limitation of the driver is that it requires the first TS-CAN1 (rtcan0) to be at the JP1,JP2 OFF,OFF jumper setting for address 0x150, the second to be at JP1,JP2 ON,OFF for address 0x158 (rtcan1) etc. The io addresses for the sja1000 are io=0x100,0x120,0x180,0x1A0 which are the addresses specified when the driver module is loaded.
--John
-----Original Message-----
From: Wolfgang Grandegger [mailto:wg@domain.hid
Sent: Tuesday, January 13, 2009 10:05 AM
To: Charlton, John
Cc: xenomai@xenomai.org; socketcan-users@domain.hid
Subject: Re: [Socketcan-users] [Xenomai-help] rtcanconfig rtcansend rtcanrecv
Charlton, John wrote:
> Wolfgang,
>
> You are right. I am just learning the sja1000 registers and modes and I was looking at the 'BasicCAN' register configuration and the sja1000 can driver is using the 'PeliCAN' mode. So it does look like everything is configured correctly and it also looks like the data are tranferred from rtcan1 to rtcan0 registers except that the interrupts do not occur to notify the socket that the data is sent and received. There does not appear to be any error messages but only debug messages in the dmesg output below (all of those Wrote/Read messages are generated by the rtcan_tscan1.c printk which I am removing to reduce the spew):
OK.
> - What do your read at offset 0x6 (JMP)?
> For idx 0: 0x30, 1: 0x22
Looks good for the IRQ selection, but I can't tell what the bit 0x02 is good for.
This is to select the second TS-CAN1 base address at 0x158.
> - What does /proc/interrupts return?
> cat /proc/interrupts
> CPU0
> 0: 12314 XT-PIC-XT timer
> 1: 146 XT-PIC-XT i8042
> 2: 0 XT-PIC-XT cascade
> 6: 0 XT-PIC-XT uhci_hcd:usb1, uhci_hcd:usb2
> 12: 13 XT-PIC-XT eth0
> 14: 0 XT-PIC-XT ide0
> 15: 2151 XT-PIC-XT ide1
> NMI: 0 Non-maskable interrupts
> TRM: 0 Thermal event interrupts
> ERR: 0
I just wanted to check if IRQ 3 and 5 is already used by Linux. You also can set the Xenomai IRQ flags in your driver to
chip->irq_flags = 0;
because IRQ sharing is not required.
Maybe there are x86-related problems with the IRQs. I'm not really an expert, but sometimes there is trouble due to improper BIOS settings, interrupt routing, etc.
Wolfgang.
[-- Attachment #2: rtcan_tscan1.tgz --]
[-- Type: application/x-compressed, Size: 2347 bytes --]
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [Xenomai-help] [Socketcan-users] rtcanconfig rtcansend rtcanrecv
2009-01-12 16:30 ` Charlton, John
2009-01-12 17:10 ` Sebastian Smolorz
@ 2009-01-12 17:17 ` Wolfgang Grandegger
1 sibling, 0 replies; 21+ messages in thread
From: Wolfgang Grandegger @ 2009-01-12 17:17 UTC (permalink / raw)
To: Charlton, John; +Cc: xenomai@xenomai.org, socketcan-users@domain.hid
Charlton, John wrote:
> Wolfgang,
>
> Thank you for the help. I do have XENO_DRIVERS_CAN_DEBUG enabled and the registers are:
>
> root@domain.hid:~$ cat /proc/rtcan/rtcan1/registers
> SJA1000 registers
> 00: 00 00 0c 02 ff 00 03 1c 1a 00 00 00 00 60 00 00
> 10: 08 00 20 01 02 03 04 05 06 07 08 ff 20 00 00 c8
> root@domain.hid:~$ cat /proc/rtcan/rtcan0/registers
> SJA1000 registers
> 00: 00 00 0d 01 ff 00 03 1c 1a 00 00 00 00 60 00 00
> 10: 08 00 20 01 02 03 04 05 06 07 08 bf 00 01 00 c8
> root@domain.hid:~$
Looks like the data have been received by the rtcan0 chip. Then most
likely there are problems with the interrupts.
> I will focus on the transmitter and try another CAN device or CAN analyzer as you suggest.
I see that the TSCAN1 Lincan driver also writes 0 to offset 4:
outb(0x0, TSCAN1_BASE_ADDR + idx * 8 + 4);
outb(0x60 + idx, TSCAN1_BASE_ADDR + idx * 8 + 5); // set base I/O address in
// control reg
Maybe it already makes a difference?
Wolfgang.
^ permalink raw reply [flat|nested] 21+ messages in thread
[parent not found: <496605F2.1080306@domain.hid>]
* Re: [Xenomai-help] [Socketcan-users] rtcanconfig rtcansend rtcanrecv
[not found] ` <496605F2.1080306@domain.hid>
@ 2009-02-02 21:54 ` Charlton, John
2009-02-03 14:19 ` Sebastian Smolorz
0 siblings, 1 reply; 21+ messages in thread
From: Charlton, John @ 2009-02-02 21:54 UTC (permalink / raw)
To: Oliver Hartkopp; +Cc: xenomai@xenomai.org, socketcan-users@domain.hid
Thank you for the tip. I need to add the socketcan drivers to my linux kernel. I have linux-2.6.27.7 currently patched for xenomai-2.4.6.1 to which I added a rtcan_tscan1.c module to support the TS_CAN1 interface I am using. It looks like the rtcan modules only support CAN_RAW frames and I would like to use your IP point to point tunnel and other utils so I can send IP packets over the CAN interface for performance testing. I built the linux kernel using OpenEmbedded cross compiler based on the org.openembedded.stable angstrom-2007.1 build but I am currently building org.openembedded.dev using the angstrom-2008-1 distro.
In your README.isotp at http://svn.berlios.de/svnroot/repos/socketcan/trunk/README.isotp
You say that you got 27kbyte/sec which translates to 0.216Mbit/sec so that suggests about 2 times that with a 1 Mbit/sec CAN bus.
--John
-----Original Message-----
From: Oliver Hartkopp [mailto:socketcan@domain.hid
Sent: Thursday, January 08, 2009 8:56 AM
To: Charlton, John
Cc: Sebastian Smolorz; xenomai@xenomai.org; socketcan-users@domain.hid.de
Subject: Re: [Socketcan-users] [Xenomai-help] rtcanconfig rtcansend rtcanrecv
Charlton, John wrote:
> Since my primary goal at present is to test and compare CAN IP performance with ethernet IP performance, I am going to shift to the lincan driver. We are planning to use xenomai in the near future so I would like to fix the rtcan_tscan1.c module to work correctly.
>
>
> Sebastian Smolorz wrote:
>
>
> However, as Wolfgang already suggested, there is at least one driver available for plain Linux which should work with your CAN controller. If you tested this driver successfully you could take a look into its source to get further hints for your Xenomai driver.
>
Hi John,
i don't know what your planning to test with IP over CAN but i implemented a proof-of-concept for an IP tunnel over ISO-TP (ISO
15765-2) on CAN. This is on plain (non-RT) Linux 2.6 and available in the SocketCAN SVN (source and tools).
Maybe you would like to take a look on it:
http://svn.berlios.de/svnroot/repos/socketcan/trunk/README.isotp
Regards,
Oliver
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: [Xenomai-help] [Socketcan-users] rtcanconfig rtcansend rtcanrecv
2009-02-02 21:54 ` Charlton, John
@ 2009-02-03 14:19 ` Sebastian Smolorz
0 siblings, 0 replies; 21+ messages in thread
From: Sebastian Smolorz @ 2009-02-03 14:19 UTC (permalink / raw)
To: Charlton, John
Cc: Oliver Hartkopp, socketcan-users@domain.hid, xenomai@xenomai.org
Charlton, John wrote:
> Thank you for the tip. I need to add the socketcan drivers to my linux kernel.
> I have linux-2.6.27.7 currently patched for xenomai-2.4.6.1 to which I added a
> rtcan_tscan1.c module to support the TS_CAN1 interface I am using.
> It looks like the rtcan modules only support CAN_RAW frames and I would like
> to use your IP point to point tunnel and other utils so I can send IP packets
> over the CAN interface for performance testing.
The isotp tools Oliver mentioned are for SocketCAN. They do not work for
RT-Socket-CAN shipped with Xenomai. So either you have to switch to
SocketCAN or someone has to port ISO-TP over RT-Socket-CAN.
--
Sebastian
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [Xenomai-help] rtcanconfig rtcansend rtcanrecv
2009-01-07 17:28 ` Sebastian Smolorz
2009-01-07 19:56 ` Charlton, John
@ 2009-01-07 20:08 ` Charlton, John
1 sibling, 0 replies; 21+ messages in thread
From: Charlton, John @ 2009-01-07 20:08 UTC (permalink / raw)
To: Sebastian Smolorz, xenomai@xenomai.org; +Cc: socketcan-users@domain.hid
[-- Attachment #1: Type: text/plain, Size: 2488 bytes --]
I removed the ts-can1 manual to meet the list size limit and added a little more description to the first paragraph below.
I am attaching rtcan_tscan1.zip which contains the added rtcan_tscan1.c and Kconfig and Makefile modifications I made. It is possible that there is something in my kernel module that is causing the problem. I copied the rtcan_isa.c module and changed the names for the tscan1 device. The TS-CAN1 PC-104 has jumper selectable configuration registers and IRQ. The first TS-CAN1 is at the default open jumper setting which is IO address 0x150 to 0x157 and IRQ5 (both JP4 and JP5). The second TS-CAN1 is at 0x158 to 0x15F and IRQ7 (only JP5). When you write 0x60 + idx where idx is the device index to the TS-CAN1 base address + 5 it sets the SJA1000 address range depending on idx. For idx = 0 SJA1000 is at 0x100 and for idx = 1 SJA1000 is at 0x120.
Wolfgang is correct in his reply there is nothing going out on the wire or at least the receiver is not receiving anything. I used rtcanrecv rtcan0 -e 0xffff and no errors are displayed. After rtcansend the /proc/rtcan/rtcan{0|1}/info show that nothing is changed in the receiver and the sender TX-counter is incremented to 1:
After:
Device rtcan0
Controller SJA1000
Board TSCAN1-Board
Clock-Hz 8000000
Baudrate 125000
Bit-time brp=4 prop_seg=0 phase_seg1=13 phase_seg2=2 sjw=1 sam=0
Ctrl-Mode
State active
TX-Counter 0
RX-Counter 0
Errors 0
Refcount 0
After:
Device rtcan1
Controller SJA1000
Board TSCAN1-Board
Clock-Hz 8000000
Baudrate 125000
Bit-time brp=4 prop_seg=0 phase_seg1=13 phase_seg2=2 sjw=1 sam=0
Ctrl-Mode
State active
TX-Counter 1
RX-Counter 0
Errors 0
Refcount 0
-----Original Message-----
From: Sebastian Smolorz [mailto:Sebastian.Smolorz@domain.hid]
Sent: Wednesday, January 07, 2009 12:29 PM
To: xenomai@xenomai.org
Cc: Charlton, John; socketcan-users@domain.hid
Subject: Re: [Xenomai-help] rtcanconfig rtcansend rtcanrecv
Charlton, John wrote:
> I added a kernel module to the xenomai ksrc/drivers/xenomai/can/sja1000.
In an earlier post to the xenomai-help ML you said that you modified rtcan_isa.c to make your CAN adapter work. Could you share your modifications with us? Otherwise it's difficult to analyse your problem because you changed the code we know in an unknown matter and maybe you made a mistake. It's like chasing ghosts without your source code.
--
Sebastian
[-- Attachment #2: rtcan_tscan1.zip --]
[-- Type: application/x-zip-compressed, Size: 3902 bytes --]
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [Xenomai-help] rtcanconfig rtcansend rtcanrecv
2009-01-07 16:17 [Xenomai-help] rtcanconfig rtcansend rtcanrecv Charlton, John
2009-01-07 17:28 ` Sebastian Smolorz
@ 2009-01-07 18:19 ` Wolfgang Grandegger
2009-01-07 20:16 ` Charlton, John
1 sibling, 1 reply; 21+ messages in thread
From: Wolfgang Grandegger @ 2009-01-07 18:19 UTC (permalink / raw)
To: Charlton, John; +Cc: xenomai@xenomai.org, socketcan-users@domain.hid
Charlton, John wrote:
> I added a kernel module to the xenomai ksrc/drivers/xenomai/can/sja1000. It builds and installs with make modules_install for linux-2.6.27.7 and xenomai-2.4.6.1. I am using OpenEmbedded on an i686 NANO-7240 single board computer. I load the kernal modules and start for two TS_CAN1 CAN boards with the following commands:
>
> insmod xeno_can_sja1000.ko
> insmod xeno_can_tscan1.ko io=0x100,0x120 irq=5,7
> rtcanconfig rtcan0 --baudrate=125000 start
> rtcanconfig rtcan1 --baudrate=125000 start
>
> /proc/rtcan/rtcan0/info:
> Device rtcan0
> Controller SJA1000
> Board TSCAN1-Board
> Clock-Hz 8000000
> Baudrate 125000
> Bit-time brp=4 prop_seg=0 phase_seg1=13 phase_seg2=2 sjw=1 sam=0
> Ctrl-Mode
> State active
> TX-Counter 0
> RX-Counter 0
> Errors 0
> Refcount 0
>
> /proc/rtcan/rtcan1/info:
> Device rtcan1
> Controller SJA1000
> Board TSCAN1-Board
> Clock-Hz 8000000
> Baudrate 125000
> Bit-time brp=4 prop_seg=0 phase_seg1=13 phase_seg2=2 sjw=1 sam=0
> Ctrl-Mode
> State active
> TX-Counter 0
> RX-Counter 0
> Errors 0
> Refcount 0
>
> In one terminal I receive from rtcan0 as follows:
> rtcanrecv rtcan0 --verbose
> interface rtcan0
> s=0, ifr_name=rtcan0
>
> In a second terminal I send to rtcan1 as follows:
> rtcansend rtcan1 --verbose --identifier=0x123 0xde 0xad
> interface rtcan1
> s=1, ifr_name=rtcan1
> <0x123> [2] de ad
> Cleaning up...
>
> Nothing happens on the rtcanrecv side--it remains blocked. If I send a second time the rtcansend side blocks after the s=1, ifr_name=rtcan1 is displayed.
This is a clear indication that the message did not get out to the wire.
What does "/proc/rtcan/rtcan[01}/info" display after you sent the
message? Also check "/proc/xenomai/irq" and use "rtcanrecv -e 0xffff" to
receive error messages as well.
Wolfgang.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [Xenomai-help] rtcanconfig rtcansend rtcanrecv
2009-01-07 18:19 ` Wolfgang Grandegger
@ 2009-01-07 20:16 ` Charlton, John
2009-01-07 20:31 ` Wolfgang Grandegger
0 siblings, 1 reply; 21+ messages in thread
From: Charlton, John @ 2009-01-07 20:16 UTC (permalink / raw)
To: Wolfgang Grandegger; +Cc: xenomai@xenomai.org
Wolfgang,
I added a reply to you with my reply to Sebastian Smoloz request for the driver module source. Yes the transmitter shows TX-counter incremented by 1 and the receiver never receives anything. The
/proc/xenomai/irq is:
IRQ CPU0
0: 119660 [timer]
5: 0 SJA1000
7: 0 SJA1000
34: 0 [virtual]
Thanks for the help,
--John
-----Original Message-----
From: Wolfgang Grandegger [mailto:wg@domain.hid]
Sent: Wednesday, January 07, 2009 1:20 PM
To: Charlton, John
Cc: xenomai@xenomai.org; socketcan-users@domain.hid
Subject: Re: [Xenomai-help] rtcanconfig rtcansend rtcanrecv
Charlton, John wrote:
> I added a kernel module to the xenomai ksrc/drivers/xenomai/can/sja1000. It builds and installs with make modules_install for linux-2.6.27.7 and xenomai-2.4.6.1. I am using OpenEmbedded on an i686 NANO-7240 single board computer. I load the kernal modules and start for two TS_CAN1 CAN boards with the following commands:
>
> insmod xeno_can_sja1000.ko
> insmod xeno_can_tscan1.ko io=0x100,0x120 irq=5,7 rtcanconfig rtcan0
> --baudrate=125000 start rtcanconfig rtcan1 --baudrate=125000 start
>
> /proc/rtcan/rtcan0/info:
> Device rtcan0
> Controller SJA1000
> Board TSCAN1-Board
> Clock-Hz 8000000
> Baudrate 125000
> Bit-time brp=4 prop_seg=0 phase_seg1=13 phase_seg2=2 sjw=1 sam=0
> Ctrl-Mode
> State active
> TX-Counter 0
> RX-Counter 0
> Errors 0
> Refcount 0
>
> /proc/rtcan/rtcan1/info:
> Device rtcan1
> Controller SJA1000
> Board TSCAN1-Board
> Clock-Hz 8000000
> Baudrate 125000
> Bit-time brp=4 prop_seg=0 phase_seg1=13 phase_seg2=2 sjw=1 sam=0
> Ctrl-Mode
> State active
> TX-Counter 0
> RX-Counter 0
> Errors 0
> Refcount 0
>
> In one terminal I receive from rtcan0 as follows:
> rtcanrecv rtcan0 --verbose
> interface rtcan0
> s=0, ifr_name=rtcan0
>
> In a second terminal I send to rtcan1 as follows:
> rtcansend rtcan1 --verbose --identifier=0x123 0xde 0xad interface
> rtcan1 s=1, ifr_name=rtcan1 <0x123> [2] de ad Cleaning up...
>
> Nothing happens on the rtcanrecv side--it remains blocked. If I send a second time the rtcansend side blocks after the s=1, ifr_name=rtcan1 is displayed.
This is a clear indication that the message did not get out to the wire.
What does "/proc/rtcan/rtcan[01}/info" display after you sent the message? Also check "/proc/xenomai/irq" and use "rtcanrecv -e 0xffff" to receive error messages as well.
Wolfgang.
^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2009-02-03 14:19 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-07 16:17 [Xenomai-help] rtcanconfig rtcansend rtcanrecv Charlton, John
2009-01-07 17:28 ` Sebastian Smolorz
2009-01-07 19:56 ` Charlton, John
2009-01-08 10:32 ` Sebastian Smolorz
2009-01-08 13:21 ` Charlton, John
2009-01-12 15:33 ` Charlton, John
2009-01-12 16:10 ` [Xenomai-help] [Socketcan-users] " Wolfgang Grandegger
2009-01-12 16:30 ` Charlton, John
2009-01-12 17:10 ` Sebastian Smolorz
2009-01-12 18:47 ` Charlton, John
2009-01-12 20:30 ` Wolfgang Grandegger
2009-01-13 14:32 ` Charlton, John
2009-01-13 15:04 ` Wolfgang Grandegger
2009-01-14 20:50 ` Charlton, John
2009-01-12 17:17 ` Wolfgang Grandegger
[not found] ` <496605F2.1080306@domain.hid>
2009-02-02 21:54 ` Charlton, John
2009-02-03 14:19 ` Sebastian Smolorz
2009-01-07 20:08 ` [Xenomai-help] " Charlton, John
2009-01-07 18:19 ` Wolfgang Grandegger
2009-01-07 20:16 ` Charlton, John
2009-01-07 20:31 ` 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.