while(1)
{
// for(i=0; i < TXCOUNT; i++)
{
for(t = 0x00;t < 2;t++)
{
InitECanb();
ECanbShadow.CANTRS.all = 0;
ECanbShadow.CANTRS.bit.TRS25 = 1; // Set TRS for mailbox under test
ECanbRegs.CANTRS.all = ECanbShadow.CANTRS.all;
kk = 0;
do
{
kk = kk + 1;
// ECanbShadow.CANTRS.all = 0;
// ECanbShadow.CANTRS.bit.TRS25 = 1; // Set TRS for mailbox under test
// ECanbRegs.CANTRS.all = ECanbShadow.CANTRS.all;
ECanbShadow.CANTA.all = ECanbRegs.CANTA.all;
} while((ECanbShadow.CANTA.bit.TA25 == 0 ) && (kk < 10000)); // Wait for TA5 bit to be set..
if( kk < 10000) break;
}
if(kk<10000) j++;
// loopcount ++;
// j++;
// ECanbMboxes.MBOX25.MDL.all = j;
// ECanbMboxes.MBOX25.MDH.all = j + 1;
ECanbShadow.CANTA.all = 0;
ECanbShadow.CANTA.bit.TA25 = 1; // Clear TA5
ECanbRegs.CANTA.all = ECanbShadow.CANTA.all;
// delay();
}
}
得到的kk是小于10000的,表示应该发送成功了,但是为什么CANES.TM还是0,按照寄存器的介绍这个不应该会变1吗?请大神解答一下疑惑
Seven Han:在仿真的模式下,代码全速运行时通过Registers来看CANES.TM位还是0么?
建议用TI的ecan_back2back修改非自测模式进行测试,ECanaShadow.CANMC.bit.STM = 0;