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