2020-11-21 01:58 AM
I have a CAN-BUS line communicating at 50kb/s speed. There are only 2 products communicating with each other on the CAN-BUS line. One of these products has the STM32L496RGT MCU (the clock speed of the CAN module (APB1) is 80Mhz.) and the other one has the STM32F072 MCU (the clock speed of the CAN module (APB1) is 16Mhz). STM32L496RGT's CAN prescaler value is 100, time segment 1 value is 13, time segment 2 value is 2 and sample point is 87.5%. STM32F072RB's CAN prescaler value is 20, time segment 1 value is 13, time segment 2 value is 2 and sample point is 87.5%. SN65HVD232 is used as CAN-Bus transceiver in both products. In addition, 120 ohm limiting resistors are added at both ends of the line. I have added the schematic of the CAN-BUS module, which is the same in both my products.[![enter image description here][1]][1] The inductance of ACT45B coil at 50kHz is 100uH. The cutoff frequency of my low pass filter is 750kHz.I use split termination as termination type. In addition to these, I add the print circuit layouts of the CAN modules of the products.[![enter image description here][2]][2][![enter image description here][3]][3] 5. and 8. legs of the Transciever integrated are not connected legs. The schematic is taken from another version of the product.First one is generally transmitter one. The second one is generally receiver. I also use 1 meter of insulated twisted pair cable.
My problem occurs when the products are operating at 70-75 ° C ambient temperature. I monitor and log the line with kvaser can bus analyzer.As far as I follow from the temperature sensors on the products, even error frames start to occur when they reach 55-60 degrees. However, the TEC register starts to increase by 8 by 8. Even though TEC decreases one by one every time the correct message arrives, the error frames that come continuously make TEC 255.When TEC register is 255, naturally the line bus is off. STM32s have automatic bus off recovery feature. I enabled this feature. Every time TEC register is 255, ABOM (Auto bus off management) puts the line back into transmission. However, because the error frames are constantly coming, the line becomes bus off state again.LEC is bit recessive error in case of this times.
Except for the terminating resistor in the line, I removed all filter elements and tried again, but the same situation occurred.I adjusted the line to many speeds and tried it, and again I encountered the same situation.
[1]: https://i.stack.imgur.com/lJG0b.png
2020-11-21 08:03 AM
What's the primary clock source of the two STM32?
JW
2020-11-23 01:19 AM
2020-11-23 01:19 PM
I don't use CubeMX so am not familiar with these pictures.
It appears that in both cases you use internal RC oscillators. These are not particularly stable, their frequency changes significantly with temperature.
Read carefully the characteristics of these oscillators in the Datasheets. Measure. Consider using crystal oscillator.
JW
2020-11-25 04:51 AM
Thank you for answering. I do not have a chance to use an external osilator as I do not have the chance to make changes to the product's print circuit right now. But I solved the problem for now. I chose HSI 16Mhz as the clock source. With this selection, I have reduced the PLL multiplier value from 40 to 10.
In this way, I tried to reduce the change of the MCU's clock source due to environmental factors. The CAN-BUS line has now been running smoothly at 80C degrees. But as a permanent solution, we should definitely use external clock source as you said.