cancel
Showing results for 
Search instead for 
Did you mean: 

Some of CAN packet have trouble.

interactics_ST
Associate III

Hello. 

I am developing CAN communication protocols using STM32F429.
However there is a problem in sending CAN frame data.

 

Here is a picture which I captured in CAN TX using logic analyzer, and as you can see, the series of data is losted after first data.

interactics_ST_0-1708505983865.png

I tested this with publishing 100Hz, this problem occurred once a minute.

In normal case, it should be like this.

interactics_ST_1-1708506289458.png

 

And also I add my code for helping to understanding.

 

    __disable_irq();

	motorCANTxMailBox = HAL_CAN_GetTxMailboxesFreeLevel(&hcan1);
    HAL_CAN_AddTxMessage(&MTRL_CAN, &motorCANTxHeader, &motorCANTxData[0], &motorCANTxMailBox);

    __enable_irq();

 

I disabled the non-automatic retransimission and enabled automatic bus-off feature.

But I wonder why the retransimission did not occur.

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

I found a trouble in my system.

I had added one more CAN Slave which received the data frames from the STMF4 board, and this was the reason why the CAN BUS didn't work.

After I eliminated this board, the system worked well.

 

Thank you so much for looking into my problem.

 

 

 

View solution in original post

15 REPLIES 15
SofLit
ST Employee

Hello,

You need to provide more details:

  • Your HW: which board? Your own HW or ST board?
  • If possible schematics
  • Bus configuration, used transceivers.. termination resistors etc ..
  • What is the system clock source you're using: HSE or HSI?
  • Are you seeing some acknowledgement for the send messages?

Thank you.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

Thank you for your fast answer.

This is my own board.

Firstly, here is the schematic about CAN

interactics_ST_1-1708507490365.png

The clock source is HSE and it provide 45Mhz to APB.

I set up the configuration like below.

 

interactics_ST_3-1708507760267.png

 

Add : 

I disabled the non-automatic retransmission and enabled automatic bus-off feature.
But I wonder why the retransmission did not occur.

and attach another packet loss below

interactics_ST_0-1708508088147.png

 

What is connected in the other side of the bus? does it have the same bitrate config 100kb/s?

What is the purpose of R23/C21 and R24/C22? it was the recommendation in DS transceiver?

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

1What is connected in the other side of the bus? does it have the same bitrate config 100kb/s?

- Another ST custom board is connected in the other side. and also have 100kb/s.

2 What is the purpose of R23/C21 and R24/C22? it was the recommendation in DS transceiver?

- I mimicked a breakout board in Internet. 
here is an example.

 

interactics_ST_1-1708508802533.png

 

I just captured it in CAN TX, would it affect the signal TX?

 

 

Hello,

I don't recommend any HW schematics except the one provided by the transceiver's manufacturer.

So if this is not the case, if possible to disconnect these components from the bus.

Is JP1 is fitted?

Do you see any activity on CAN_H and CAN_L?

Could you please provide the CAN config of the other board? is it the same custom board? same FW? same system clock?

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

OK, I'll try your solution to eliminate those things.

I can see CAN_H and CAN_L activated.  

Here is a moment when the error occur. I could not analyze this because my gadget don't have the feature in CAN H and L.

interactics_ST_0-1708510314409.png

Mostly, the packet was well sending. Not every time, sometimes it happens.

Another device is STM32G0 which is also a custom board. it dose not same FW compared to above board.

So, it use CAN FD. below is the information about this.

interactics_ST_1-1708510669990.png

 

Hmm well..

And if you connect RS pin of the transceiver directly to the GND not over a 4.7K resistor?

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

OK. I will try it and post the result later.

 

However, is it those situation affect the CAN_TX? The problem take place in the CAN_TX which is located between ST MCU and the transceiver.

 

 

 

SofLit
ST Employee

Please check my points before.

Also share your two projects: STM32F429 and STM32G0 (at least the ioc files) so I can look at them later.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.