Project Home
Project Home
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - io-pkt driver to implement socketCAN for our hardware issue: (3 Items)
   
io-pkt driver to implement socketCAN for our hardware issue  
I have written a native io-pkt driver for our CAN bus hardware.  It seems to be working but when I try to open a socket 
and send to it, the data never gets to my network driver.

I start my driver like so:
mount -vvv -Tio-pkt -obaud=1000,port=0,board_index=0,verbose devnp-canpro_g.so

then I assign it an arbitrary IP like so:
ifconfig can0 10.0.0.1

I can see the interface is up from the output of ifconfig
# ifconfig
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 33192
        inet 127.0.0.1 netmask 0xff000000
en0: flags=80008843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,SHIM> mtu 1500
        address: 00:50:ba:50:af:6a
        media: Ethernet 100baseTX full-duplex
        status: active
        inet 206.130.75.216 netmask 0xffffff00 broadcast 206.130.75.255
can0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        address: 00:01:02:03:04:05
        media: Ethernet autoselect (none full-duplex)
        status: active
        inet 10.0.0.1 netmask 0xff000000 broadcast 10.255.255.255


then I access the port using my test program like so:

        struct can_sockaddr addr;
        addr.sa_len = sizeof(addr);
        addr.sa_family = AF_INET;
        addr.iface = ifaddr;
        addr.id = ENDIAN_BE32(0xffe00000);

        s = socket(AF_INET, SOCK_RAW, 0);

I know the default protocol is tcpip.  Could the tcpip stack be deciding to not route the data to my driver?  I have 
tried playing with the netmask and using destination IPs like 10.0.0.2 with no luck either.

In the original socketCAN implementation under QNX 6.3 he had a rawcan protocol he used a a upper filter driver. Am I 
going to have to make my own to make this work and if so I don't see any samples on how to do this?

Any help would be greatly appreciated.

Thanks
Allan
Re: io-pkt driver to implement socketCAN for our hardware issue  
I have been doing some reading and research and I think what I need is the shared library lsm-nraw.so.

Unfortunately it does not seem to be included in the 6.4 or 6.5 images.

Is this library not published?

Allan
RE: io-pkt driver to implement socketCAN for our hardware issue  
It looks like you have two separate discussions. One for the driver and one for the custom protocol you are trying to 
send. 

For the driver, I would just start with the default utilities (ping, telnet, ftp) to see if the driver appears to be 
working.  

If the driver appears to be working then you can examine your custom protocol. If it is IP based you can look at 
SOCK_RAW to encapsulate your protocol in IP frames. If it is not IP based, then you can look at nraw, BPF, or your own 
custom resource manager for your driver to inject your frames onto the wire. It could depend a bit on what the rawcan io
-net module did under 6.3 and whether the frames are ethernet or raw bus frames. 

Nraw would have to be requested from your sales representative. 

Dave

-----Original Message-----
From: Allan Smith [mailto:community-noreply@qnx.com] 
Sent: July-31-12 10:13 AM
To: drivers-networking
Subject: io-pkt driver to implement socketCAN for our hardware issue

I have written a native io-pkt driver for our CAN bus hardware.  It seems to be working but when I try to open a socket 
and send to it, the data never gets to my network driver.

I start my driver like so:
mount -vvv -Tio-pkt -obaud=1000,port=0,board_index=0,verbose devnp-canpro_g.so

then I assign it an arbitrary IP like so:
ifconfig can0 10.0.0.1

I can see the interface is up from the output of ifconfig # ifconfig
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 33192
        inet 127.0.0.1 netmask 0xff000000
en0: flags=80008843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,SHIM> mtu 1500
        address: 00:50:ba:50:af:6a
        media: Ethernet 100baseTX full-duplex
        status: active
        inet 206.130.75.216 netmask 0xffffff00 broadcast 206.130.75.255
can0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        address: 00:01:02:03:04:05
        media: Ethernet autoselect (none full-duplex)
        status: active
        inet 10.0.0.1 netmask 0xff000000 broadcast 10.255.255.255


then I access the port using my test program like so:

        struct can_sockaddr addr;
        addr.sa_len = sizeof(addr);
        addr.sa_family = AF_INET;
        addr.iface = ifaddr;
        addr.id = ENDIAN_BE32(0xffe00000);

        s = socket(AF_INET, SOCK_RAW, 0);

I know the default protocol is tcpip.  Could the tcpip stack be deciding to not route the data to my driver?  I have 
tried playing with the netmask and using destination IPs like 10.0.0.2 with no luck either.

In the original socketCAN implementation under QNX 6.3 he had a rawcan protocol he used a a upper filter driver. Am I 
going to have to make my own to make this work and if so I don't see any samples on how to do this?

Any help would be greatly appreciated.

Thanks
Allan




_______________________________________________

Networking Drivers
http://community.qnx.com/sf/go/post94529
To cancel your subscription to this discussion, please e-mail drivers-networking-unsubscribe@community.qnx.com