Internal CAN baud

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
gritt
Posts: 11
Joined: Tue May 25, 2010 12:06 pm
Been thanked: 1 time

Internal CAN baud

Post by gritt »

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

User avatar
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

Post by LeighM »

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

gritt
Posts: 11
Joined: Tue May 25, 2010 12:06 pm
Been thanked: 1 time

Re: Internal CAN baud

Post by gritt »

Thanks, Leigh. I'll give it a go.

James

gritt
Posts: 11
Joined: Tue May 25, 2010 12:06 pm
Been thanked: 1 time

Re: Internal CAN baud

Post by gritt »

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

User avatar
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

Post by LeighM »

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.

Post Reply