Dan Lopez

Need help getting mscan to sync

Discussion created by Dan Lopez on Feb 13, 2012
Latest reply on Feb 13, 2012 by kef

We're using a DEMO9S08DZ60-ND. We followed the appnotes for the mscan on the hc12, and modified it a bit. But mscan keeps getting stuck on the while loop trying to sync. We tried different sample code found online, and still nothing. The pins are only outputting 0V too.


void CANInit(void) {CANCTL0_INITRQ = 1; // enter initilization modewhile(!CANCTL1_INITAK); //wait until initialization mode is readyCANCTL1_CANE = 1; //enable mscan moduleCANCTL1_LOOPB = 1; //enable loopback modeCANCTL1_LISTEN = 0; //disable listen mode//set time segment 2 tq clock cycles to 3 CANBTR1_TSEG21 = 1;//set time segment 1 tq clock cycles to 6CANBTR1_TSEG12 = 1;CANBTR1_TSEG10 = 1;//set time quante of Synchronization jump width to 3 CANBTR0_SJW1= 1;// set clk prescale value to 3CANBTR0_BRP1 = 1; //disable identifier masking with don't cares. all messages received trigger interruptsCANIDMR0 = 0xFF;CANIDMR1 = 0xFF;CANIDMR2 = 0xFF;CANIDMR3 = 0xFF;CANIDMR4 = 0xFF;CANIDMR5 = 0xFF;CANIDMR6 = 0xFF;CANIDMR7 = 0xFF;CANCTL0_INITRQ = 0; // exit initialization modewhile(CANCTL1_SLPAK==1 && CANCTL1_INITAK==1); //wait until initialization mode exit successfullywhile(CANCTL0_SYNCH==0); //wait until mscan syncs}



not sure where exactly we're going wrong.