On Monday, February 17, 2014 3:21 PM, Wolfgang Grandegger <[email protected]> 
wrote:


>Looks like memory mapped accesses are required. Please try the
>xeno_can_mem driver as show below:
>
>  # modprobe xeno_can_mem mem=0xda0000,0xdb200 irq=12,15 ocr=0xda,0xda


Yes, indeed, that improves things!  The driver indicates success in loading.


>Not sure what the output configurations register is. The driver supports
>the module parameters "ocr=" to specify the output *control* register,
>which is most likely the same register. For further information, please
>search for "ocr" in:
>
>http://www.rts.uni-hannover.de/xenomai/lxr/source/ksrc/drivers/can/sja1000/rtcan_mem.c
>
>Wolfgang.


Indeed, I see those are the same in the two drivers, as they both address the 
8th register in the SJA1000.


Next problem: "Network is down" when running Round Trip Time example 
(rtcan_rtt).  

Secondary problem: only 1 message can be sent with rtcansend.


Details:
When I do: modprobe xeno_can_mem mem=0xdb000,0xdb200 irq=12,15 ocr=0xda,0xda
Then review: lsmod
Two new entries show up:
Module                  Size  Used by
xeno_can_mem            1737  0 
xeno_can_sja1000        6333  1 xeno_can_mem


And dmesg shows new entries:
RTCAN SJA1000 driver initialized
rtcan: registered rtcan0
rtcan: registered rtcan1

Executing "./rtcan_rtt rtcan0 rtcan1" responds:
1 3
RX rxsock=896, ifr_name=rtcan1
TX txsock=897, ifr_name=rtcan0
Round-Trip-Time test rtcan0 -> rtcan1 with CAN ID 0x1
Cycle time: 10000 us
All RTT timing figures are in us.
send failed: Network is down
Messages RTTlast RTT_avg RTT_min RTT_max Overruns
< and stalls here >
No new information is found in dmesg.


Looking at the RT-Socket-CAN Utilities:
Run: ./rtcanconfig rtcan0 --baudrate=250000 start
and: ./rtcanconfig rtcan1 --baudrate=250000 start
dmesg shows new activity:
rtcan0: real bitrate 250000, sampling point 87.5%
rtcan_sja_set_bit_time: btr0=0x1 btr1=0x1c
rtcan1: real bitrate 250000, sampling point 87.5%
rtcan_sja_set_bit_time: btr0=0x1 btr1=0x9c

Then: ./rtcanrecv rtcan0 --verbose
interface rtcan0
s=0, ifr_name=rtcan0

<leave running in one SSH window, while in another:>

./rtcansend rtcan1 --verbose --identifier=0x123 0xde 0xad
interface rtcan1
s=1, ifr_name=rtcan1
<0x123> [2] de ad
Cleaning up...

No data shows up on the rtcanrecv, though a separate device watching for CAN 
activity showed the message!  Further executions of rtcansend don't show 
"Cleaning up..." automatically (like it is stalled) and ^C is required to 
regain control.  No further data is sent or seen on further attempts of 
rtcansend.  If I reboot cleanly and use rtcansend with --loop=10 only 1 message 
will be sent.

I suspect I don't see "Network is down" because rtcansend uses rt_dev_send() 
while rtcan_rtt uses send().  But in any case, I only the 1 message on the 
physical CAN bus, the first time.

cat /proc/rtcan/devices shows:
Name___________ _Baudrate State___ TX_Counter RX_Counter ____Errors
rtcan0             250000 active            0          0          0
rtcan1             250000 active            1          0          0

grep . /proc/rtcan/rtcan0/* shows:
/proc/rtcan/rtcan0/filters:fd __CAN_ID__ _CAN_Mask_ Inv MatchCount
/proc/rtcan/rtcan0/filters: 0 0x00000000 0x00000000  no          0
/proc/rtcan/rtcan0/info:Device     rtcan0
/proc/rtcan/rtcan0/info:Controller SJA1000
/proc/rtcan/rtcan0/info:Board      mem mapped
/proc/rtcan/rtcan0/info:Clock-Hz   8000000
/proc/rtcan/rtcan0/info:Baudrate   250000
/proc/rtcan/rtcan0/info:Bit-time   brp=2 prop_seg=6 phase_seg1=7 phase_seg2=2 
sjw=1 sam=1
/proc/rtcan/rtcan0/info:Ctrl-Mode  
/proc/rtcan/rtcan0/info:State      active
/proc/rtcan/rtcan0/info:TX-Counter 0
/proc/rtcan/rtcan0/info:RX-Counter 0
/proc/rtcan/rtcan0/info:Errors     0
/proc/rtcan/rtcan0/info:Refcount   0

grep . /proc/rtcan/rtcan1/* shows:
/proc/rtcan/rtcan1/filters:fd __CAN_ID__ _CAN_Mask_ Inv MatchCount
/proc/rtcan/rtcan1/info:Device     rtcan1
/proc/rtcan/rtcan1/info:Controller SJA1000
/proc/rtcan/rtcan1/info:Board      mem mapped
/proc/rtcan/rtcan1/info:Clock-Hz   8000000
/proc/rtcan/rtcan1/info:Baudrate   250000
/proc/rtcan/rtcan1/info:Bit-time   brp=2 prop_seg=6 phase_seg1=7 phase_seg2=2 
sjw=1 sam=1
/proc/rtcan/rtcan1/info:Ctrl-Mode  
/proc/rtcan/rtcan1/info:State      active
/proc/rtcan/rtcan1/info:TX-Counter 1
/proc/rtcan/rtcan1/info:RX-Counter 0
/proc/rtcan/rtcan1/info:Errors     0
/proc/rtcan/rtcan1/info:Refcount   0


To provide the relevant settings from my Kernel's .config: "grep XENO_.*CAN 
.config":
CONFIG_XENO_DRIVERS_CAN=y
CONFIG_XENO_DRIVERS_CAN_DEBUG=y
# CONFIG_XENO_DRIVERS_CAN_LOOPBACK is not set
CONFIG_XENO_DRIVERS_CAN_RXBUF_SIZE=1024
CONFIG_XENO_DRIVERS_CAN_MAX_DEVICES=4
CONFIG_XENO_DRIVERS_CAN_MAX_RECEIVERS=16
CONFIG_XENO_DRIVERS_CAN_BUS_ERR=y
# CONFIG_XENO_DRIVERS_CAN_CALC_BITTIME_OLD is not set
# CONFIG_XENO_DRIVERS_CAN_VIRT is not set
# CONFIG_XENO_DRIVERS_CAN_FLEXCAN is not set
CONFIG_XENO_DRIVERS_CAN_SJA1000=m
CONFIG_XENO_DRIVERS_CAN_SJA1000_ISA=m
CONFIG_XENO_DRIVERS_CAN_SJA1000_MEM=m
# CONFIG_XENO_DRIVERS_CAN_SJA1000_PEAK_PCI is not set
# CONFIG_XENO_DRIVERS_CAN_SJA1000_IXXAT_PCI is not set
CONFIG_XENO_DRIVERS_CAN_SJA1000_ADV_PCI=m
# CONFIG_XENO_DRIVERS_CAN_SJA1000_PLX_PCI is not set
# CONFIG_XENO_DRIVERS_CAN_SJA1000_EMS_PCI is not set
# CONFIG_XENO_DRIVERS_CAN_SJA1000_ESD_PCI is not set
# CONFIG_XENO_DRIVERS_CAN_SJA1000_PEAK_DNG is not set

Similar to a step in ../ksrc/drivers/can/README: "find /lib/modules/ -name 
xeno*":
/lib/modules/3.10.18/kernel/drivers/xenomai
/lib/modules/3.10.18/kernel/drivers/xenomai/can/sja1000/xeno_can_mem.ko
/lib/modules/3.10.18/kernel/drivers/xenomai/can/sja1000/xeno_can_sja1000.ko
/lib/modules/3.10.18/kernel/drivers/xenomai/can/sja1000/xeno_can_isa.ko
/lib/modules/3.10.18/kernel/drivers/xenomai/can/sja1000/xeno_can_adv_pci.ko
/lib/modules/3.10.18/kernel/drivers/xenomai/testing/xeno_rtdmtest.ko
/lib/modules/3.10.18/kernel/drivers/xenomai/serial/xeno_16550A.ko

Thanks so much for helping with this!

Wayne

_______________________________________________
Xenomai mailing list
[email protected]
http://www.xenomai.org/mailman/listinfo/xenomai

Reply via email to