cancel
Showing results for 
Search instead for 
Did you mean: 

Hi everyone, I'm working with HAL CAN driver, but sometime I miss trame ... I mean, I send a message each 100 ms with counter and sometimes I miss one value ... On STM32L4, does someones already have this issue ? First time I see that ...

MDami.3
Associate II
 
5 REPLIES 5

Diagram this system. Assume you're not sending a telegram, and can clearly explain your situation.

You send this message to the STM32L4, or from?

Is the packet acknowledged at the sender?

You have some bus analysis showing this issue?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
MDami.3
Associate II

First, sorry for the delay, I was on week off.

Yes sure I'll try to explain what I've done :)

I reduce my system to only one board on CAN bus, and it send message each 100ms with value in increase one by one message.

To see if all message are sent, I used microchop bus analyzer and I share what I saw :

38,2452;RX;0x1F090001x;8;0x8A;0x00;0x00;0x00;0x00;0x00;0x00;0x00;

38,4442;RX;0x1F090001x;8;0x8C;0x00;0x00;0x00;0x00;0x00;0x00;0x00;

38,5442;RX;0x1F090001x;8;0x8D;0x00;0x00;0x00;0x00;0x00;0x00;0x00;

We miss 0x8B ... And with the timestamp we can see also there are 200ms difference (instead of 100ms)

For example, there is what I see in working case :

39,3402;RX;0x1F090001x;8;0x95;0x00;0x00;0x00;0x00;0x00;0x00;0x00;

39,4402;RX;0x1F090001x;8;0x96;0x00;0x00;0x00;0x00;0x00;0x00;0x00;

39,5392;RX;0x1F090001x;8;0x97;0x00;0x00;0x00;0x00;0x00;0x00;0x00;

39,6392;RX;0x1F090001x;8;0x98;0x00;0x00;0x00;0x00;0x00;0x00;0x00;

39,7383;RX;0x1F090001x;8;0x99;0x00;0x00;0x00;0x00;0x00;0x00;0x00;

39,8382;RX;0x1F090001x;8;0x9A;0x00;0x00;0x00;0x00;0x00;0x00;0x00;

39,9373;RX;0x1F090001x;8;0x9B;0x00;0x00;0x00;0x00;0x00;0x00;0x00;

40,0372;RX;0x1F090001x;8;0x9C;0x00;0x00;0x00;0x00;0x00;0x00;0x00;

40,1372;RX;0x1F090001x;8;0x9D;0x00;0x00;0x00;0x00;0x00;0x00;0x00;

40,2362;RX;0x1F090001x;8;0x9E;0x00;0x00;0x00;0x00;0x00;0x00;0x00;

you might want to show us some code, also plug in a oscilloscope and show us the canbus messages, a lot can be infered by the shape of the canbus signal

we dont need to firmware by ourselves, lets talk
MDami.3
Associate II

My code is pretty easy :

 cmpt++;
   for ( int i = 0 ; i < 8 ; i ++ )
   {
       Payload[i] = (uint8_t) (cmpt >> 8*i);
   }
   HalStatusReturn = HAL_CAN_AddTxMessage ( &hcan1, &HeaderTxCan, Payload, &TxMailbox) ; 

And this function is called each 100ms. I don't have any other device on the bus (to avoid collision), and if I plug an oscillo I won't see anything else cause this error happen about each 200 message (for example,this isn't the good value but it's the idea)

MDami.3
Associate II

And obvisouly I checked the status return of the function, which is always set to HAL_OK