cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F446ZCT6 CAN Bus goes to Bus-Off state

Akhila_17
Associate III

Hi everyone,

I am facing an issue with CAN communication on STM32F446ZCT6, where the CAN controller frequently enters the Bus-Off state.

Hardware Details

  • MCU: STM32F446ZCT6

  • CAN Transceiver: (TJA1042T)

I am working with CAN communication on STM32F446ZCT6, and the CAN controller is frequently going into the Bus-Off state. I am using the HSI clock, configured from 8 MHz to 42 MHz, with the CAN clock derived from APB1 = 42 MHz I have enabled Auto Bus-Off Management and tested multiple bitrates (500 kbps, 250 kbps, and 125 kbps), but the issue still occurs. I see bit errors and acknowledgment errors, which eventually cause Bus-Off.
Can you please help me to solve this issue.

1 ACCEPTED SOLUTION

Accepted Solutions

1- Again HSI is not recommended (even should not be used) and could be a source of your issue, even if where the same part number are used on the same CAN bus. We have customers had issues by using HSI. So you need to take that into account. It was working for you doesn't mean it will work forever.

2- You need to ensure you connect two terminating resistors of 120ohm at both sides of the bus. Check your wiring and connections. Check the bitrate may be you wrongly set the bitrate at one side so the bitrate is different.

3- The voltage of STB is low only.

-> Are you sure it's connected to GND and not kept floating?

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.

View solution in original post

9 REPLIES 9
mƎALLEm
ST Employee

Hello,

1- HSI clock is not recommended for the CAN communication. Please use a crystal.

2- Are there other nodes which are connected to the CAN bus? if there is no other CAN nodes connected to the bus that's normal. You need at least one node to acknowledge the sent frames.

3- What is the level voltage on STB pin of the CAN transceiver? STB pin should be set to LOW for normal mode. According to the datasheet:

mALLEm_0-1769417468018.png

Please read also the knowledge base articles:

Using CAN (bxCAN) in Normal mode with STM32 microcontrollers (Part 1)

Using CAN (bxCAN) in Normal mode with STM32 microcontrollers (Part 2)

 

 

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.
Ozone
Principal III

As mentioned, using HSI and the resulting clock deviations are most likely the cause.
> I see bit errors and acknowledgment errors, which eventually cause Bus-Off.

If I remember correctly, each failed (non-acknowledged) Tx attempt increases the TEC by 8. 
However, if you left the error-passive limit unchanged (128), the bus-off state can only be caused by additional Rx errors.

A bad wiring or improper bus termination could play a role as well.
But using HSI is not a good idea, I think you need to focus on that first.

Thanks for your reply.
For first point:
I understand that HSI is generally not recommended for CAN communication and that using an external crystal is preferred for better clock accuracy.

However, I have successfully used the HSI clock with the STM32F446VETx series, where both CAN transmission and reception worked correctly.

In the case of the STM32F446ZC series, using the same HSI-based clock configuration, CAN transmission is working properly, but CAN reception is not working.

Could you please clarify why HSI works for CAN on the F446VETx but causes reception issues on the F446ZC?
Are there any device-specific clock tolerance differences, CAN sampling constraints, or clock tree dependencies in the F446ZC that require an external crystal specifically for reception?
2) Iam using Canoe to transmit the messages, and Controller CAN node is configured as normal mode.

3- What is the level voltage on STB pin of the CAN transceiver? STB pin should be set to LOW for normal mode. According to the datasheet:
The voltage of STB is low only.
Hope can you please help me out as soon as possible.

1- Again HSI is not recommended (even should not be used) and could be a source of your issue, even if where the same part number are used on the same CAN bus. We have customers had issues by using HSI. So you need to take that into account. It was working for you doesn't mean it will work forever.

2- You need to ensure you connect two terminating resistors of 120ohm at both sides of the bus. Check your wiring and connections. Check the bitrate may be you wrongly set the bitrate at one side so the bitrate is different.

3- The voltage of STB is low only.

-> Are you sure it's connected to GND and not kept floating?

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.

Thanks for Response.
I have configured a project with using HSE clock. Can you please check it once.
My understanding is that CAN communication requires matching bitrates across nodes. In case of a bitrate mismatch, transmission would not succeed. Since transmission is working, it appears that the bitrate configuration is correct.
Thank you.


I'm not seeing an issue in your CAN configuration.

For now try to use the Loopback mode. If it works, it's a hardware issue. 

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.

> 3- What is the level voltage on STB pin of the CAN transceiver? STB pin should be set to LOW for normal mode. > > According to the datasheet:
> The voltage of STB is low only.

You can look it up in the transceiver's datasheet. But the signal name highly suggests "Standby", which would effectively turn the CAN access for the device off.

> In the case of the STM32F446ZC series, using the same HSI-based clock configuration, CAN transmission is working properly, but CAN reception is not working.

I think your assessments "working properly" / "working not properly" are not correct.
The bit pattern of a transmission might appear correct. But when the bit times are to much off, the other CAN nodes will not acknowledge the message, and thus cause the error.
And vice versa for reception - if your F447 node samples the CAN signal at incorrect times, it will not be able to  receive a correct message either.

mƎALLEm
ST Employee

Hello @Akhila_17 ,

Could you please state on this thread please? did you find a solution for the described issue? if yes, could you please share it with us? 

Otherwise, we (as administrators) we will accept one of the posts listed above as a solution .

Thank you for your understanding.

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.

Hi,

sorry for the late reply.

Yes, I was able to resolve the issue. The root cause was  CAN clock configuration.
I fixed it by Changing the clock HSI to HSE.

Thank you for your support. I am marking this as resolved.