2019-12-24 08:46 PM
We are using the STM32F446 at 180 MHz and one of my engineers says he can't quite get the CAN peripheral to run at 500K (reliably?) with the available clocking system.
Anybody know any tricks to make this work ?
This is partly what he said.....
"I don't think running the AHB bus @180 MHz will work for 500K baud CAN communications. It kinda sorta works but the prescalers and time quanta settings I have to work with won't let me get quite close enough to 500K baud for it to be reliable. Too many errors. It's still preliminary right now, but it doesn't look good. If I set the N parameter in the PLL to 200 (rather than 180) I can get AHB / AHP1 / AHP2 buss frequencies of 200 / 100 / 50, which violates the requirements in section 6.3.3 but I can get the CAN frequency right on 500K baud. This appears to work but technically I'm overclocking the part."
2019-12-24 10:23 PM
I guess you are trying to attach to an existing canBus of 500KHz.
please make sure you have ABOM turned ON and the canBus line impedence is below 200R ( 60R is the correct line impedence)
You will have to use a crystal for reliable stable frequencies.
You may have to drop your frequency down to match the 500khz exactly.
you can over clock the unit slightly, but it is not recommended if you are working anywhere near the maximum temperatures.
You can read the onboard die temperature, if it is below 60C you should be ok to overclock slightly.
Better to under-clock to match the 500k exactly and stay within the ST recommended operating conditions.
2019-12-27 12:56 AM
I've used 1MBPS CAN on F427.
2019-12-28 11:39 PM
Thanks guys. I guess I will find out after the 1st of the year what the engineer's issue REALLY is.
I see calculations for Qt or is it Tq (quantum time) which comes out pretty close or perfect to 500K from an AHB of 45 MHz.
But then there are 2 more calculations for 2 register values that also involve Tq to come up with more possible issues regarding how things sync up.
I guess that CAN is just not as simple as a USART for calculating BAUD rate or bit rate.
2019-12-29 02:07 AM
With high speed, the number of well-working combinations of prescaler and time quanta becomes quite limited.
In my case (1 mbps), I recall, there was just one.
2019-12-29 02:19 AM
Found my old notes...
PCLK = 45MHz, 1/45 us = 22,22 ns
1Mbps = 1 bit/us
1000ns/22,222 ns = 45,000045
=> 45 PCLKs per bit; 45 = 5*3*3
1 Mbps:
Prescaler = 5, 1 + 2 + 3 + 3 = 9
(22,222ns * 5 * 9 = 999,999ns)
Numbers in registers need to be one less than the value used
prescaler = 4 (5-1)
(SYNC_SEG is always 1)
TimeSeg1 = 4 (2+3-1) (PROP_SEG + PHASE_SEG1)
TimeSeg2 = 2 (3-1) (PHASE_SEG2)
2019-12-29 02:23 AM
Made that to 500 kbps by doubling the prescaler.
2019-12-29 07:09 PM
Thanks for digging out your notes, turbo ! I sent this off to the guys. Hopefully it can help !
Happy new year !
2020-01-03 04:01 PM
We have successfully ran this part at 500K now.
He found 3 different number combinations that work so far.
Thank you VERY much folks for your help !
This is great !
Happy new year !
2020-01-08 12:34 AM
Can you please help me on this topic also? We are using an STM32F7XX board and we have problems with transmission