cancel
Showing results for 
Search instead for 
Did you mean: 

CAN BUS Stress Test

Luca Giuliodori
Associate III
Posted on March 30, 2018 at 14:48

I'm testing one application with 3 differente device that send a message with random command ID and random data on CAN bus every random timeout: two devices with two STM32L433 nucleo and one with STM32F446 nucleo and with TJA1044T NXP transceivers.

I implemented firmware starting with STMCube (rev. 4.0) and added my application code with all corrections that I found in the community.

For first test the command ID random range was between 0 to 50 and the timeout random range was from 10ms to 1s. In this case all work enough fine without errors or packet lost.

In second test I reduced the timeout random range and was between 1ms to 10ms. In this case some errors appear and some packet lost; In particular the most freqeuntly errors was BIT ERROR (BR error).

To stress the application again I reduced the command ID random range to 1 (only command ID 0) and set the timeout to 1ms fixed: every ms all the boards (not sincronized) send the same command ID. In this case the number of errors (BOF, STF, FOR, ACK BR and BD) and lost packets increase a lot.

To evaluate the number of errors and lost packets, I implemented specific counters

that I can read by PC SerialPort when the test is stoped.

The frequency of CAN bus is 1Mbit/s, I calculated the timing by

/external-link.jspa?url=http%3A%2F%2Fwww.bittiming.can-wiki.info%2F

(Tq = 5ns, BS1 = 13, BS2 = 2, SJW = 1) and I used a very short cable (about 30cm).

In alltests the number of sent packet by every board are about 000.

My question is: is normal this behavior? I didn't found materials in intertet about this.

#can #stm32f4 #stm32l4

Note: this post was migrated and contained many threaded conversations, some content may be missing.
13 REPLIES 13
Posted on April 03, 2018 at 14:36

I'd guess 'Error Passive', i.e. error count reaches 256.

Posted on April 03, 2018 at 14:41

In our network(s), each node includes his node ID in it's messages, which is unique (like a IP address in TCP/IP networks).

Ok, we was thinking the same idea.

Thanks.
Posted on April 03, 2018 at 14:45

Ok it could be but the device enter in 'Error Passive' only if counter TEC or REC are greater than 127 and this counters do not increase if arbitration lost.

Posted on April 06, 2018 at 17:36

I have tried the system with 3 different commands ID (0, 1 and 2) and every device send only one command ID: in this way all the system works correctly and no error or packets lost are generated.

Thank you very much!