In the code for the macro CAN init it states that when using internal CAN, to achieve the correct baud a 20MHz crystal must be used.
I need to achieve a baud of 1Mbps and am using a 32MHz crystal. I was planning on using BRGCON1 = 0x00, BRGCON2 = 0xAD and BRGCON3 = 0x02 (based on the bit timing calculator here http://www.kvaser.com/en/support/bit-ti ... lator.html. Does this mean my baud will be incorrect? Is there a workaround to achieve the correct baud when not using a 20MHz crystal?
Thanks
James
Internal CAN baud
Moderator: Benj
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
Re: Internal CAN baud
Hi James,
The comment about 20MHz crystal applies to CNF1/2/3 values calculated by Flowcode from the selected Bus Rate for the external CAN.
If you use internal CAN and set BRGCON values to those you have calculated for the 32MHz crystal then you should be OK.
Leigh
The comment about 20MHz crystal applies to CNF1/2/3 values calculated by Flowcode from the selected Bus Rate for the external CAN.
If you use internal CAN and set BRGCON values to those you have calculated for the 32MHz crystal then you should be OK.
Leigh
Re: Internal CAN baud
This may be a silly question, but what difference does HS or HS-PLL make to the CAN baud? I am using HS-PLL with a 32MHz crystal and can't get any messages through above a baud of 250kbps. Because I am using HS-PLL is this calculated 250kbps actually 1Mbps?
Thanks
James
Thanks
James
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
Re: Internal CAN baud
Yes, if you are using the PLL then you will have to take this into account when calculating the BRGCON values. You will need to check the datasheet for the processor to determine the PLL frequency and any postscaler divider from which the CAN clock is derived.