From: "Charlton, John" Date: Mon, 12 Jan 2009 10:33:06 -0500 Message-ID: References: <200901071828.31323.Sebastian.Smolorz@domain.hid> <4965D651.5010808@domain.hid> In-Reply-To: Content-Language: en-US Content-Type: multipart/mixed; boundary="_002_CF7FB0793253794F9F45991443E5FE2004DF784062us194mx002tyc_" MIME-Version: 1.0 Subject: Re: [Xenomai-help] rtcanconfig rtcansend rtcanrecv List-Id: Help regarding installation and common use of Xenomai List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Sebastian Smolorz Cc: "xenomai@xenomai.org" , "socketcan-users@domain.hid" --_002_CF7FB0793253794F9F45991443E5FE2004DF784062us194mx002tyc_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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 conf= igured 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 b= lock 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=3D125000 start mode: start (0x1) baudrate: 125000 root@domain.hid:~$ rtcanconfig rtcan1 --verbose --baudrate=3D125000 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=3D0xffff interface rtcan0 s=3D0, ifr_name=3Drtcan0 Using err_mask=3D0xffff >>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=3D4 prop_seg=3D0 phase_seg1=3D13 phase_seg2=3D2 sjw=3D1 sam= =3D0 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=3D4 prop_seg=3D0 phase_seg1=3D13 phase_seg2=3D2 sjw=3D1 sam= =3D0 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=3D0xffff --filter= =3D-1:-1:1:1 Filter #0: id=3D0xffffffff mask=3D0xffffffff Filter #1: id=3D0x00000001 mask=3D0x00000001 interface rtcan0 s=3D0, ifr_name=3Drtcan0 Using err_mask=3D0xffff 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=20 -----Original Message----- From: socketcan-users-bounces@domain.hid [mailto:socketcan-users-boun= ces@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 rtcanre= cv Sebastian, Thank you for looking at the rtcan_tscan1.c source code. You are right, th= ere are two distinct IO regions in the TS-CAN1, but rtcan_sja1000_regs.h on= ly 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 n= ot 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 bas= e + 5 register is the one that selects the SJA1000 base address. Setting o= nly bit 6 of TS-CAN1 + 5 maps the SJA1000 to 0x100 - 0x11F. The rtcan_tsca= n1.c module sets the lower three bits of the TS-CAN1 + 5 to the idx paramet= er which maps the SJA1000 to 0x120 - 0x13F if idx is 1 and so on. The io a= ddresses 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-CAN= 1 is set to the default base address of 0x150 and irq 5 and the second is set to 0x158 an= d irq 7 and the module is loaded as follows: insmod xeno_can_tscan1.ko io=3D0x100,0x120 irq=3D5,7 Note that the io base address array is set to the SJA1000 base addresses an= d not the TS-CAN1 addresses. The rtcan_tscan1.c module takes care of setti= ng the TS-CAN1 base address + 5 so that the SJA1000 IO region is as specifi= ed 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=20 > contains the added rtcan_tscan1.c and Kconfig and Makefile=20 > modifications I made. It is possible that there is something in my=20 > kernel module that is causing the problem. I copied the rtcan_isa.c=20 > module and changed the names for the tscan1 device. The TS-CAN1 > PC-104 has jumper selectable configuration registers and IRQ. The=20 > first TS-CAN1 is at the default open jumper setting which is IO=20 > 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 a= nd 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 corre= ctly. A look into rtcan_sja1000_regs.h may help you. However, as Wolfgang already suggested, there is at least one driver availa= ble for plain Linux which should work with your CAN controller. If you test= ed this driver successfully you could take a look into its source to get fu= rther hints for your Xenomai driver. -- Sebastian _______________________________________________ Socketcan-users mailing list Socketcan-users@domain.hid https://lists.berlios.de/mailman/listinfo/socketcan-users --_002_CF7FB0793253794F9F45991443E5FE2004DF784062us194mx002tyc_ Content-Type: application/x-compressed; name="rtcan_tscan1.tgz" Content-Description: rtcan_tscan1.tgz Content-Disposition: attachment; filename="rtcan_tscan1.tgz"; size=2348; creation-date="Mon, 12 Jan 2009 10:24:47 GMT"; modification-date="Mon, 12 Jan 2009 10:24:47 GMT" Content-Transfer-Encoding: base64 H4sIAG5ga0kAA+1Ze3PaSBLfv/kUba6yBbZ42s5jsVPBWI7Z5XUCkvXtpVSyNMDsyhqih22yu9/9 umckECCcx93W1V0xlTKmp6efv+7pcfzQtjwzDPBnrWx/95esKq7nJyf0WXtxWk1/0q8n9eMX39Vq tePai3rt+THSa3Vih+pfY876ioLQ8gHws/ri9FX91W6+p/f/R1flMAeH0BLzhc+nsxAKrSLUMV3w XriTqeVN4a1veQ6bTpkPZw/TN9Pl17It7l7j6UwBp5oSM2S3VhByy4PhnXCF/4m4d66zJXs5Zn8T hJFTjjxemlm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