AnsweredAssumed Answered

S08DZ60 MSCAN initialization

Question asked by Johannes Philippi on Jul 18, 2007
Latest reply on Jan 4, 2013 by Pinak Paralkar
Hello S08-prgrammers!
 
using the code generated by the device-initialization is not bad at all.
But I still have a problem with the MSCAN-initialization.
 
The generated code ist the following:
 
Code:
 /* ### Init_MSCAN init code */  /* CANCTL0: INITRQ=1 */  CANCTL0 |= (unsigned char)0x01;                                 while(!CANCTL1_INITAK) {             /* Wait for init acknowledge */  }  /* CANCTL1: CANE=1,CLKsrc=0,LOOPB=0,LISTEN=0,BORM=0,WUPM=0,SLPAK=0,INITAK=1 */  CANCTL1 = 0x91;   CANCTL1_LISTEN = 0;                                       /* CANBTR1: SAMP=0,TSEG22=0,TSEG21=0,TSEG20=0,TSEG13=0,TSEG12=0,TSEG11=0,TSEG10=1 */  CANBTR1 = 0x01;                                        /* CANBTR0: SJW1=0,SJW0=0,BRP5=0,BRP4=0,BRP3=0,BRP2=0,BRP1=0,BRP0=1 */  CANBTR0 = 0x01;                                        /* CANIDAC: IDAM1=0,IDAM0=1,IDHIT2=0,IDHIT1=0,IDHIT0=0 */  CANIDAC = 0x10;    CANIDAC_IDAM0=1;                                      /* CANIDAR0: AC7=0,AC6=0,AC5=0,AC4=0,AC3=0,AC2=0,AC1=0,AC0=0 */  CANIDAR0 = 0x00;                                        /* CANIDAR1: AC7=0,AC6=0,AC5=0,AC4=0,AC3=0,AC2=0,AC1=0,AC0=0 */  CANIDAR1 = 0x00;                                        /* CANIDAR2: AC7=0,AC6=0,AC5=0,AC4=0,AC3=0,AC2=0,AC1=0,AC0=0 */  CANIDAR2 = 0x00;                                        /* CANIDAR3: AC7=0,AC6=0,AC5=0,AC4=0,AC3=0,AC2=0,AC1=0,AC0=0 */  CANIDAR3 = 0x00;                                        /* CANIDAR4: AC7=0,AC6=0,AC5=0,AC4=0,AC3=0,AC2=0,AC1=0,AC0=0 */  CANIDAR4 = 0x00;                                        /* CANIDAR5: AC7=0,AC6=0,AC5=0,AC4=0,AC3=0,AC2=0,AC1=0,AC0=0 */  CANIDAR5 = 0x00;                                        /* CANIDAR6: AC7=0,AC6=0,AC5=0,AC4=0,AC3=0,AC2=0,AC1=0,AC0=0 */  CANIDAR6 = 0x00;                                        /* CANIDAR7: AC7=0,AC6=0,AC5=0,AC4=0,AC3=0,AC2=0,AC1=0,AC0=0 */  CANIDAR7 = 0x00;                                        /* CANIDMR0: AM7=0,AM6=0,AM5=0,AM4=0,AM3=0,AM2=0,AM1=0,AM0=0 */  CANIDMR0 = 0x00;                                        /* CANIDMR1: AM7=0,AM6=0,AM5=0,AM4=0,AM3=0,AM2=0,AM1=0,AM0=0 */  CANIDMR1 = 0x00;                                        /* CANIDMR2: AM7=0,AM6=0,AM5=0,AM4=0,AM3=0,AM2=0,AM1=0,AM0=0 */  CANIDMR2 = 0x00;                                        /* CANIDMR3: AM7=0,AM6=0,AM5=0,AM4=0,AM3=0,AM2=0,AM1=0,AM0=0 */  CANIDMR3 = 0x00;                                        /* CANIDMR4: AM7=0,AM6=0,AM5=0,AM4=0,AM3=0,AM2=0,AM1=0,AM0=0 */  CANIDMR4 = 0x00;                                        /* CANIDMR5: AM7=0,AM6=0,AM5=0,AM4=0,AM3=0,AM2=0,AM1=0,AM0=0 */  CANIDMR5 = 0x00;                                        /* CANIDMR6: AM7=0,AM6=0,AM5=0,AM4=0,AM3=0,AM2=0,AM1=0,AM0=0 */  CANIDMR6 = 0x00;                                        /* CANIDMR7: AM7=0,AM6=0,AM5=0,AM4=0,AM3=0,AM2=0,AM1=0,AM0=0 */  CANIDMR7 = 0x00;                                        /* CANCTL0: INITRQ=0 */  CANCTL0 &= (unsigned char)~0x01;                        // here's the PROBLEM PROBLEM PROBLEM LINE
while(CANCTL1_INITAK) {              /* Wait for init exit */  }      /* CANCTL0: RXFRM=0,RXACT=0,CSWAI=0,SYNCH=0,TIME=0,WUPE=0,SLPRQ=0,INITRQ=0 */  CANCTL0 = 0x00;                                        /* CANRIER: WUPIE=0,CSCIE=0,RSTATE1=0,RSTATE0=0,TSTATE1=0,TSTATE0=0,OVRIE=0,RXFIE=0 */  CANRIER = 0x00;                                        /* CANTIER: TXEIE2=0,TXEIE1=0,TXEIE0=1 */  CANTIER = 0x01;                                        /* ### */

Everything seems to be okay, but when the  code reaches the problem-line
while(CANCTL1_INITAK) { }
the program is hanging up, the INITAK-bit is never cleared (neither in background debug mode nor in normal run mode)... As this is a read-only bit it's a bit difficult to change it by hand :smileyhappy: ...
 
What is the reason for this bit to stay set forever? It's a standard MSCAN initialization code from the device-initialization tool however. 
 
need some help!
 
Thanks,
Johannes 

Outcomes