TurboStreetCar
Active member
Does anyone know if the handling of the message receipt acknowledge is handled by the Flexcan code or the transceiver chip?
Yes, i know i need the transceiver to properly communicate, but im seemingly not getting an ACK when i receive messages. So i was curious if the ACK was handled by the transceiver on its own, or if it were handled by the Flexcan/Teensy. If i knew what part of the system handles the ACK, then i can test that part of the system to try to isolate the problem.
Yea I took interest in the Rs pin on the board. As received, it used a 10k pulldown to ground, putting the chip in "slope control mode". I've since de-soldered the pulldown, and shorted the pin across the pads directly to ground with no change in function.
I guess replacement is the route I will go. What transceiver do you use? And where do you source them? I'll need 1mbps capability for my intended use.
I use the HV230 and have no issues with it. I have 4 of them here, the ones that I've posted here. at 1Mbps with 0 delay between sends, none of the nodes have issue logging the sent data.
sudo ip link set can0 down
sudo ip link set can0 type can bitrate 1000000
sudo ip link set can0 up
cangen -g 0 -i -I 0 -D i -L 1 can0 &
sudo ip link set can1 down
sudo ip link set can1 type can bitrate 1000000
sudo ip link set can1 up
cangen -g 0 -i -I 1 -D i -L 1 can1 &
cangen -g 0 -i -e -I 0 -D i -L 1 can0 &
2. Extended IDs are not enabled by default. I had to set filters before being able to receive extended ID messages. I did it by adding a filter during setup (See attached Arduino Sketch).
3. Multiple mailboxes and filters needed to be setup to ensure reception of all traffic. I attached the modified ObjectOrientedCAN.ino sketch that implements this. Many messages will be dropped if only 1 mailbox is setup.
I ran a "stress" test and tried to get the most messages captured as possible. I used the Teensy3.6 on one end with each CAN channel using the TI TCAN332 transceiver. This was my receiving node. The transmitting node was a BeagleBoneBlack running SocketCAN with can-utils. It was a short network, but a correctly terminated CAN bus with 120 ohm resistors at each end.
I issued the following commands on the BeagleBoneBlack to generate 100% bus load with standard frames that were 1 byte long (the shortest message). At the bash command prompt I entered this:
Code:sudo ip link set can0 down sudo ip link set can0 type can bitrate 1000000 sudo ip link set can0 up cangen -g 0 -i -I 0 -D i -L 1 can0 & sudo ip link set can1 down sudo ip link set can1 type can bitrate 1000000 sudo ip link set can1 up cangen -g 0 -i -I 1 -D i -L 1 can1 &
On the Teensy 3.6 at 180 MHZ, I ran the attached sketch. The output was 27168 message per second on both channels. If I only ran one channel at a time, I get about 16746 messages per second on each channel. Since I was expecting a factor of 2, I hooked up an oscilloscope to verify 100% bus load and my BBB can't generate 100% busload with both channels going. I'll scrounge up another and try layer, but I suspect the Teensy can handle it.
When I switched to transmitting extended IDs:
Code:cangen -g 0 -i -e -I 0 -D i -L 1 can0 &
My reception rate dropped to about 12069 messages per second with the o'scope trace showing a saturated bus.
If you enable the serial display, expect something like this:
6 ID: 0 Data: 94
4 ID: 1 Data: 87
5 ID: 0 Data: 95
5 ID: 1 Data: 88
6 ID: 0 Data: 6
4 ID: 1 Data: 89
5 ID: 0 Data: 7
5 ID: 1 Data: 8A
6 ID: 0 Data: 8
4 ID: 1 Data: 8B
5 ID: 0 Data: 9
5 ID: 1 Data: A4
6 ID: 0 Data: A
4 ID: 1 Data: A5
5 ID: 0 Data: B
5 ID: 1 Data: A6
6 ID: 0 Data: C
4 ID: 1 Data: A7
5 ID: 0 Data: D
5 ID: 1 Data: A8
However, the serial output just stops... I'm wondering if it's a Teensy thing or I've filled up the Arduino serial monitor. So I ran the serial monitor in a little Python program to see if it stalled. Interestingly, it started using mailboxes 4 and 5 then moved up to 5 and 6 and so on in a matter of a minute. It stayed on mailbox 9 and 10 for a while, then the serial monitor froze again after about 5 minutes but the LED kept on blinking. This is where I'm stuck. How do we keep this serial print functionality going on in perpetuity? Is the CAN RX rate higher than the Serial TX rate and I'm overflowing the Serial port buffer?
CollinK, I did some correction recently to my fork of the FlexCAN library to use proper alternative pins for T3.5. Also updated the pictures in the readme to include the alternative CAN pins. You may want to merge these changes into your fork.
That's only a pull request from H4nky84 that wasn't merged (neither on the teachop's repo nor on my fork).I see some changes regarding RTR, I believe on the Teachop repo. I really, really am against the use of RTR but I suppose there are probably some antiques that still use it. Maybe I'll merge that stuff in too.
The issue i am getting, is the Teensy 3.6, will read the same message infinitely every time CANbus0.read(rxmsg) is run.
Minor thing, but you are missing T3.5 in txAlt/rxAlt parameters description (table for begin function).OK, I think I'm up to date with all of the changes now.
I just a few days I'm going to publish 1.35-beta2, which is (probably) the last chance to get any changes into the 1.35 release.
Sadly, I *still* haven't had time to do anything with CAN protocol. I'm really depending on your feedback for what to include with 1.35. Please let me know?
Has anyone tried any functions for bitshifting?
I'm not familiar with how to translate say byte 4, bit 2 and then something with it.
There was some discussion about it in the other CAN thread, but not much that could be used in practice.