Hi to all,
I'm new to Raspberry Pi3, and I need to implement a CAN protocol developing with NetBeans 8.2
I know CAN protocol and I have already use it in several embedded uP (Pic16, Pic32,etc..)
I know a little of linux but I'm not an expert
I buy this board:
http://skpang.co.uk/catalog/pican2-canb ... -1475.html
And i configure CAN over SPI in this way:
I try to sniff several can packet (of other device) with wireshark, how write in this link:
and I sniff it very well!
So I try do download an example program and i found this:
it works and compile!
Now I'm creating a new "hello word" c program in CAN, starting from the example program downloaded before (that:
http://skpang.co.uk/blog/archives/1199 ) but I found several problems...
I add to my project only lib.h for compilem after that I Import all .h file for have the reference of the function inside my code. (I'm developing on NetBeans 8.2)
In the example code, references that are missing are this: setsockopt, ioctl, socket used in this way:
if (ioctl(s, SIOCGIFINDEX, &ifr) < 0)
socket(PF_CAN, SOCK_RAW, CAN_RAW))
setsockopt(s, SOL_CAN_RAW, CAN_RAW_FILTER, NULL, 0);
[Question-1] So the first question is where I can find them?!
So I can study this function and learn how to use it...
[Question-2] How to read a can message? In the example is not explaned (and no example provided for reading) how to read a can packet.... I have no idea how to do it with this library... I suppose I must set up an interrupt (or something similar...) where a new packet is aviable and a call to function (but I have no idea what function) for read packet.
Can someone help me?