2011/1/14 Willy Lambert <[email protected]>
>
>
> 2011/1/13 Willy Lambert <[email protected]>
>
>
>>
>> 2011/1/13 Wolfgang Grandegger <[email protected]>
>>
>> On 01/13/2011 12:25 AM, Willy Lambert wrote:
>>> > 2011/1/12 Willy Lambert <[email protected]>
>>> >
>>> >> Because after lots of tests of moving jumpers it ended in this config.
>>> As I
>>> >> don't have serial yet it should work no ? Anyway I'll change because
>>> it is
>>> >> not an accurate choice
>>> >>
>>> >> 2011/1/12 Wolfgang Grandegger <[email protected]>
>>> >>
>>> >> Hi Willy,
>>> >>>
>>> >>> On 01/12/2011 01:55 AM, Willy Lambert wrote:
>>> >>>> Hi all,
>>> >>>>
>>> >>>> for memory I have been trying to makes socketCan working on my Ixxat
>>> >>> board
>>> >>>> for some time. It is stacked on a PC104 cpu module with a linux
>>> debian
>>> >>>> squeeze. After having a fully hardware configuration (a proper node
>>> +
>>> >>> can
>>> >>>> analyser) I tried Ixxat drivers and succeed after soldering a jumper
>>> on
>>> >>> the
>>> >>>> board and setting some BIOS values. After this I quickly tested a
>>> >>> socketCan
>>> >>>> version from svn and it seems to works (at least interrupts were
>>> >>> triggered).
>>> >>>>
>>> >>>> Cleaning time arrived and I complety reinstall the linux with only
>>> the
>>> >>>> required kernel configuration. The choosed kernel is a 2.6.35.7.
>>> >>>> My first question is : may I use kernel official sources of
>>> socketCan ?
>>> >>> or
>>> >>>> do I need to checkout something ?
>>> >>>>
>>> >>>> I activated theses options :
>>> >>>>
>>> >>>>> [*] Networking Support -->
>>> >>>>> --- [*] CAN bus subsystem support -->
>>> >>>>> ----------[*] Raw Can Protocol (raw access with CAN-ID filtering)
>>> >>>>> ----------[*] Broadcast Manager CAN Protocol (with content
>>> filtering)
>>> >>>>> ---------- CAN Device Drivers --->
>>> >>>>> ----------------- [*] Virtual Local CAN Interface (vcan)
>>> >>>>> ----------------- [*] Platform CAN drivers with Netlonk support
>>> >>>>> ----------------- [*] CAN bit-timing calculation
>>> >>>>> ----------------- [*] Philips/NXP SJA1000 devices -->
>>> >>>>> -------------------------[M] ISA Bus based legacy SJA1000 driver
>>> >>>>>
>>> >>>> All remark is welcome (espacially if I need to choose "M" instead of
>>> "*"
>>>
>>> If you select "M", the drive will be built as module otherwise it's
>>> statically linked into the kernel.
>>>
>>> > Is this usable from the current 2.6.35.7 official Linux tree ? or do I
>>> need
>>> > other sources ?
>>>
>>> Should be fine.
>>>
>>> >>> I setup my can0 interface in the rc.local script :
>>> >>>>
>>> >>>>> modprobe sja1000_isa irq=3 mem=0XD0000
>>> >>>
>>> >>> Why do you use irq=3 now. IIRC, it's used for the serial port. Why
>>> not
>>> >>> irq=5?
>>> >>>
>>> >>
>>> > same with irq5. I have the same problem with Ixxat drivers. so it's
>>> again an
>>> > interrupt problem. Do I need to activate some option into the kernel ?
>>>
>>> I'm a bit confused. What is the current status of using CAN on you
>>> system. Does the BCI driver from IXXAT now work properly?
>>>
>>
>> So am I :)
>>
>> I reinstalled Ixxat drivers and manage to find my a working state for both
>> Ixxat and SocketCan drivers. A missed a jumper positionning and had some
>> BIOS problems.
>>
>> In conclusion I have :
>> _ a proper HW wiring and 2nd node
>> _ a particular IRQ jumper working configuration on my board
>> _ a particuliar BIOS config with uncertainty about what option made things
>> working.
>> _ a brand new 2.6.35.7 system with only the few required kernel options to
>> made things working.
>>
>> I will now test BIOS options one by one to check which are required,
>> change IRQs to test several configuration, test the second CAN controller
>> and set up a test case with canplayer. I will report this as soon as i
>> finished.
>>
>>
> I am stuck with the test case setup, candump shows error messages when I
> try a cansend. I already have tricks with extended or standard data frame
> formats with Ixxat drivers. My motors seems to only accept standard frames.
> Is there a way to configure this ?
>
> I booted my target with Ixxat driver and run my test cases to validate
> everything is in order. (BIOS options, jumpers, IRQ, wiring). I only use one
> controller on IRQ11 (as it is said as "reserved" in my CPU board IRQ
> mapping)
> I may run my motor and receive SDO from him, everything seems to be OK.
>
> Without changing anything except my init script which load can drivers (in
> order to load socket can drivers instead of Ixxat ones), I rebooted my CPU.
>
> Here is the load script :
>
>> modprobe sja1000_isa irq=11 mem=0xD0000
>>
>> ip link set can0 type can bitrate 250000 restart-ms 1000
>> ifconfig can0 up
>>
>
> Here is dmesg answer (which seems correc) :
>
>> [ 3.928467] sja1000_isa sja1000_isa.0: sja1000_isa device registered
>> (reg_base=0xc00d0000, irq=11)
>> [ 3.928646] Legacy sja1000_isa driver for max. 8 devices registered
>> [ 3.938877] sja1000_isa sja1000_isa.0: setting BTR0=0x01 BTR1=0x1c
>>
>
> Here is ifconfig result :
>
>> can0 Link encap:UNSPEC HWaddr
>> 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
>> UP RUNNING NOARP MTU:16 Metric:1
>> RX packets:2 errors:0 dropped:0 overruns:0 frame:0
>> TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
>> collisions:0 lg file transmission:10
>> RX bytes:16 (16.0 B) TX bytes:0 (0.0 B)
>> Interruption:11
>>
>
> Here is /proc/iomem
>
>> 00000000-00000fff : reserved
>> 00001000-0009fbff : System RAM
>> 0009fc00-0009ffff : reserved
>> 000a0000-000bffff : Video RAM area
>> 000c0000-000c7fff : Video ROM
>> 000d0000-000d001f : sja1000_isa
>> ...
>>
>
> Here is /proc/interrupts
>
>> CPU0
>> 0: 215 IO-APIC-edge timer
>> 1: 8 IO-APIC-edge i8042
>> 2: 0 XT-PIC-XT cascade
>> 8: 97 IO-APIC-edge rtc0
>> 11: 1 IO-APIC-edge can0
>> 12: 7 IO-APIC-edge i8042
>> 14: 0 IO-APIC-edge ata_piix
>> 15: 1017 IO-APIC-edge ata_piix
>> 19: 0 IO-APIC-fasteoi uhci_hcd:usb3
>> 23: 14 IO-APIC-fasteoi ehci_hcd:usb1, uhci_hcd:usb2
>> 40: 411 PCI-MSI-edge eth0
>> NMI: 0 Non-maskable interrupts
>> LOC: 293000 Local timer interrupts
>> SPU: 0 Spurious interrupts
>> PMI: 0 Performance monitoring interrupts
>> PND: 0 Performance pending work
>> TRM: 0 Thermal event interrupts
>> THR: 0 Threshold APIC interrupts
>> MCE: 0 Machine check exceptions
>> MCP: 1 Machine check polls
>> ERR: 0
>> MIS: 0
>>
>
> I write this command to wake up everybody :
>
>> ./cansend can0 000#0100
>>
>
> And at the same time, in another terminal, I run candump with theses
> results :
>
>> ./candump any,0:0,#FFFFFFFF
>> can0 20000040 [8] 00 00 00 00 00 00 00 00 ERRORFRAME
>> can0 20000100 [8] 00 00 00 00 00 00 00 00 ERRORFRAME
>> can0 20000004 [8] 00 04 00 00 00 00 00 71 ERRORFRAME
>> can0 20000004 [8] 00 10 00 00 00 00 00 81 ERRORFRAME
>>
>
>
> Did I do something wrong ?
>
>
This simple program ended in the same candump reaction
> #include <iostream>
> #include <string.h>
>
> //can
> #include <sys/types.h>
> #include <sys/socket.h>
> #include <sys/ioctl.h>
> #include <net/if.h>
>
> #include <linux/can.h>
> #include <linux/can/raw.h>
> #include <string.h>
>
>
>
> using namespace std;
>
> int main()
> {
> cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
>
>
> /* Create the socket */
> int skt = socket( PF_CAN, SOCK_RAW, CAN_RAW );
>
> /* Locate the interface you wish to use */
> struct ifreq ifr;
> strcpy(ifr.ifr_name, "can0");
> ioctl(skt, SIOCGIFINDEX, &ifr); /* ifr.ifr_ifindex gets filled
> * with that device's index */
>
> /* Select that CAN interface, and bind the socket to it. */
> struct sockaddr_can addr;
> addr.can_family = AF_CAN;
> addr.can_ifindex = ifr.ifr_ifindex;
> bind( skt, (struct sockaddr*)&addr, sizeof(addr) );
>
> /* Send a message to the CAN bus */
> struct can_frame frame;
> frame.can_id = 0x000;
> frame.data[0] = 0x01;
> frame.data[1] = 0;
> frame.data[2] = 0;
> frame.data[3] = 0;
> frame.data[4] = 0;
> frame.data[5] = 0;
> frame.data[6] = 0;
> frame.data[7] = 0;
> frame.can_dlc = 2;
> int bytes_sent = write( skt, &frame, sizeof(frame) );
> cout << "byte sent : " << bytes_sent << endl;
>
> /* Read a message back from the CAN bus */
> int bytes_read = read( skt, &frame, sizeof(frame) );
> cout << "byte read : " << bytes_read << endl;
>
>
>
> return 0;
> }
>
>
>
>
>
>
>>
>>
>>>
>>> Wolfgang.
>>>
>>
>>
>
_______________________________________________
Socketcan-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/socketcan-users