SOLVED Can driver
Hello, I have connected my raspberry with the can bus with a separate can hat. I manage to get the bus visible with the can sniffer. Do I have to do some changes in the driver in rexygen? Somehow I wasn't able to receive any data with the Canrecv block.
Hi, could you provide some more information?
- What device are you trying to communicate with via the CAN bus?
- Can you share your Rexygen project here?
- What type of CAN Bus Sniffer do you have?
For the CAN driver to work properly, you need to edit the file /etc/rexcore/rexcore.env.d/80-candrvt.sh on your Raspberry Pi. Uncomment lines from "REX_CAN_DEV=can0" onwards and fill the proper value to the "REX_CAN_BITRATE=...".
Hi, I'm not so good at english, so I use links to explain. Sorry for that.
So I try communicate with car engine control unit. Using this shield ->
I made settings to /boot/config.txt what shield user manual wanted, and install can-utils what include that cansniffer. -> https://github.com/linux-can/can-utils
Using this I'm able to receive data properly.
If I open /etc/rexcore/rexcore.env.d/80-candrvt.sh there is no line REX_CAN_DEV=can0
#for setting CAN-Network-interface bitrate uncomment next line ant set devicename and bitrate
#ip link set can0 type can bitrate 1000000 restart -ms 1000
#ip link set can0 up
I try uncomment 1, 3 and 4 line, set bitrate 500000, but no help. Before this, after reboot need use those same ip link commands to get cansniffer work, but now there is no need use those, so think maybe it's right settings?
I use a demo license, I guess it doesn't matter?
I use example project 0406-01 station 2, only change Can0_recv block filterId -> 0x288. Also try second time use FilterIdMask 0x1 instead 0xFFF
Using cansniffer it looks like ->
288 05 57 13 00 00 5B 00 00
388 83 02 00
480 15 20 00 00 00 00 00 00
your settings in the 80-candrvt.sh file is correct. Please follow these steps:
- Open RexDraw and connect to your Raspberry Pi (in the menu Target -> Connect or F7 key).
- Click on Target menu again and select Configure System Log.
- Check the I/O driver messages -> Information box (as marked on attached figure) and hit the OK button.
- Download your project again to your Raspberry Pi (Project -> Compile and Download or F6 key)
- Open Target -> Show System Log, make a printscreen of this log and post it here.
That should show us what's going wrong.
Thanks for your cooperation,
@reitinge I send picture tomorrow. I buy also rexcore professional licence and notice that not include can-licence? Is it possible buy can licence separately?
Hi, look like this. Could it be licensing problem?
Hi, yes, it's almost certainly a licensing issue. Please check your mail. I will send you further instructions.
Now i'm able receive data correctly, thanks. Next question is, am I uderstant FilterIdMask wrong. Now I receive data exsample ID288 05 57 13 00 00 5B 00 00, but it reversed in rexygen, like 00 00 5B 00 00 13 57 05. If I want use bit 1 (or 6 in reversed?) , in exsample HEX 57, can't use FilterIdMask to block other bytes?There is picture how ID/bytes is going in my project, this ID288 byte2 is Coolant temp, but if use FilterID 0x288 and FilterIdMask 0x1 it wont work? Is there some good idea how this should do?
FilterIdMask can be used for filtering messages from more devices. In your case, there is only one device, so you can set FilterIdMask as 0xfff. For message decomposing, use the INTSM blocks (www.rexygen.com/doc/ENGLISH/MANUALS/BRef/INTSM.html). The basic example of using INTSM block can be found in this thread: https://forum.rexygen.com/topic/174/reading-and-writing-4-byte-floating-point-from-modbus?_=1609251284153
For decomposing a byte value into bits can be used block BDOCT(www.rexygen.com/doc/ENGLISH/MANUALS/BRef/BDOCT.html).