2
\$\begingroup\$

I am a bit stuck with connecting several STM32F405 with BeagleBone black via CAN bus.

Strange things happen when I connect 3 stm32 and 1 BB. I have checked that BB works perfectly with any combination of two STM32 devices. However after connecting the third one to the bus SocketCAN starts to send error frames to user space.

There appears relatively long idle gaps, sometimes several milliseconds long as shown in picture. Which does not look like CAN bus error frame. Unfortunately linux driver provides only counter related errors and no specific reasons for my CAN controller. At the same time on stm32 I catch all possible CAN errors: stuff, bit dominant/recessive, form and etc. If I just halt one of the stm32 devices using debugger everything works well.

Total CAN bus resistance is 60 Ohm as expected.

My beaglbone CAN bus parameters (ip link output):

bitrate 100000 sample-point 0.875 
tq 625 prop-seg 6 phase-seg1 7 phase-seg2 2 sjw 1

My stm32 CAN bus configuration:

MCR = CAN_MCR_ABOM | CAN_MCR_AWUM | CAN_MCR_TXFP | CAN_MCR_NART;
BTR = (25U << CAN_BTR_BRP_Pos) |  // PCLK1 is divided by 26. Tq = 26*Tpclk = 26 * 1/(42*10^6)) = 624 nS */
      (12U << CAN_BTR_TS1_Pos) |  // 13 time quantas for the first bit segment
      (1U << CAN_BTR_TS2_Pos) |   // 2 time quantas for the second bit segment
      (0U << CAN_BTR_SJW_Pos);    // 1 time quantas for resync.

I am not much of an expert in CAN bus and I have no ideas of what is going on. What are the possible reasons?

UPDATE

I noticed that disabling CAN interface on BB removes errors. So it seems that BB CAN controller for some reason destroys traffic.

UPDATE

I have uploaded the wrong images. Large gaps were dropped messages due to many errors, this is custom feature for each message(can contain many can frames) counter is held and after it is more than threshold I drop it. Unfortunately my oscilloscope can not analyze CAN data and it is very hard to detect error frames. Since there are too many errors and it is hard to select anything particularly usefull I have attached full logic analyzer data. You can view it with salae logic software. Click "Options -> Open capture/setup". You will see protocols window, type "error" to find all errors.

Capture file: Salae Logic capture

\$\endgroup\$
4
  • 1
    \$\begingroup\$ What's that picture supposed to be? A zoomed out picture of all CAN traffic? On CANL or what? That's not much of a help, look at individual messages instead. You really can't troubleshoot this without a scope and CAN listener software both. \$\endgroup\$
    – Lundin
    Commented Mar 19, 2020 at 13:26
  • \$\begingroup\$ @Lundin please look at update \$\endgroup\$ Commented Mar 19, 2020 at 14:18
  • \$\begingroup\$ Err, no I'm not going to install some 3rd party tool just to help you. Get proper tools, CAN analysers are cheap compared to scopes and often more helpful for troubleshooting CAN. \$\endgroup\$
    – Lundin
    Commented Mar 19, 2020 at 14:30
  • \$\begingroup\$ @Lundin if you consider salae logics to be a bad tooling that is your right and I am not going to discuss it here. The only reason I have uploaded files is that there are more than 100 errors and it is impossible to make a detailed screenshot of each one of them. Having any of CAN analyzers would not solve the problem. However having required software you can check all of them in detail including all the bytes, CRCs and timings. \$\endgroup\$ Commented Mar 19, 2020 at 15:49

0