AnsweredAssumed Answered

use the MC912ZVC with 16MHZ and CAN 250kb

Question asked by Thorsten Mulun on Feb 17, 2016
Latest reply on Feb 22, 2016 by Thorsten Mulun

Hello,

 

can some one help me? I find only exampels with 4MHZ Quarz with 250kb and i dont understand what i have to change in the Configbits to use a 16MHZ Quarz and 250kb

 

 

//initialises CAN communications

void CAN_init(void){

 

//initialise MSCAN

CAN0CTL0 = 0x01;

while (!(CAN0CTL1_INITAK)){}

CAN0CTL1_CANE = 1; /* Enable MSCAN module */

CAN0CTL1_CLKSRC = 0; /* Clock source is OSCCLK = 20 MHz */

CAN0CTL1_LOOPB = 0; /* Set to 1 for LoopBack Mode, 0 otherwise */

CAN0CTL1_LISTEN = 0; /* Not listen only mode */

CAN0CTL0_WUPE = 1; /* Enable WAKEUP */

 

//Baud rate = CANCLK/(Pre-scaler * time quanta)

 

CAN0BTR1_TSEG_10 = 0x0A; // that works with 4MHZ

CAN0BTR1_TSEG_20 = 0x03; // and 250kb

CAN0BTR0_BRP = 0x00; //

 

CAN0BTR0_SJW = 0x03;

CAN0BTR1_SAMP = 0;

 

Can some one tell me the right value?

 

Thanks a lot

 

Thorsten

Outcomes