All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfgang Grandegger <wg@domain.hid>
To: "Charlton, John" <john.charlton@domain.hid>
Cc: "xenomai@xenomai.org" <xenomai@xenomai.org>,
	"socketcan-users@domain.hid" <socketcan-users@domain.hid>
Subject: Re: [Xenomai-help] [Socketcan-users] rtcanconfig rtcansend rtcanrecv
Date: Mon, 12 Jan 2009 17:10:14 +0100	[thread overview]
Message-ID: <496B6B66.7070905@domain.hid> (raw)
In-Reply-To: <CF7FB0793253794F9F45991443E5FE2004DF784062@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.




  reply	other threads:[~2009-01-12 16:10 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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           ` Wolfgang Grandegger [this message]
2009-01-12 16:30             ` [Xenomai-help] [Socketcan-users] " 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=496B6B66.7070905@domain.hid \
    --to=wg@domain.hid \
    --cc=john.charlton@domain.hid \
    --cc=socketcan-users@domain.hid \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.