CAN初始化到while(CAN0CTL1_INITAK!=0)过不去[求助]
- UID
- 149809
- 性别
- 男
|
CAN初始化到while(CAN0CTL1_INITAK!=0)过不去[求助]
我用的是9S08DZ60的片子,为什么CAN初始化到while(CAN0CTL1_INITAK!=0)过不去呢?
我观察CAN0CTL0为0时,CAN0CTL1_INITAK位还是1,不知道为什么?下面是我的程序:
CAN0CTL0_INITRQ = 1; //初始化模式 while(CAN0CTL1_INITAK!=1) ; //等待进入初始化模式 CAN0CTL1_CANE = 1; CAN0CTL0_INITRQ = 0; CAN0CTL1_CLKSRC = 0; /* 选择晶振频率 */ //CAN0CTL1_LOOPB = 1; CAN0CTL1_LISTEN = 0; CAN0BTR0 = 0XC7; CAN0BTR1 = 0X3A; CAN0IDAC = 0; /* two 32bit acceptance filter*/ CAN0IDMR0 = 0xFF; CAN0IDMR1 = 0xFF; CAN0IDMR2 = 0xFF; CAN0IDMR3 = 0xFF; CAN0IDMR4 = 0xFF; CAN0IDMR5 = 0xFF; CAN0IDMR6 = 0xFF; CAN0IDMR7 = 0xFF;
CAN0CTL0_INITRQ = 0; //退出初始化模式 while(CAN0CTL1_INITAK!=0); //这里过不去 CAN0RIER_RXFIE = 1; /* 接收中断使能,禁止发送中断 */ CAN0TIER = 0; |
|
|
|
|
|
- UID
- 104673
- 性别
- 男
|
http://bbs.eccn.com/dispbbs.asp?boardID=3&RootID=113744&ID=113744
|
|
|
|
|
|
- UID
- 149809
- 性别
- 男
|
用了你的程序 问题还未解决,就是CAN0CTL0_INITRQ 位变为0时,CAN0CTL1_INITAK为什么不跟着变0,我用的是9S08DZ60的样片,难道样片有问题 |
|
|
|
|
|
- UID
- 104380
- 性别
- 男
|
When INITRQ is cleared by the CPU, the MSCAN restarts and then tries to synchronize to the CAN bus. If the MSCAN is not in bus-off state, it synchronizes after 11 consecutive recessive bits on the CAN bus; if the MSCAN
is in bus-off state, it continues to wait for 128 occurrences of 11 consecutive recessive bits. |
|
|
|
|
|
- UID
- 149809
- 性别
- 男
|
对strongchen的回答表示感谢,我明白你的意思
清INITRQ位表示告诉CPU退出初始化模式,当INITAK为0时表示已退出初始化模式;
我这里INITAK一直为1表示初始化未完成
按照你的说法怎么去解决????? |
|
|
|
|
|
- UID
- 104673
- 性别
- 男
|
|
|
|
|
|
- UID
- 149809
- 性别
- 男
|
我的问题已解决啦,o(∩_∩)o...哈哈!
设CAN0CTL1_CLKSRC=1,就行了,不过还不知道为什么不能用晶振频率/ |
|
|
|
|
|