- 积分
- 54
贡献84
飞刀28 FD
注册时间2010-11-25
在线时间23 小时
扫一扫,手机访问本帖
|
TE2440-II中CANBUS部分,mcpcan.c中连续读取TEC,REC以及EFLG寄存器的值,但是得到的结果很让人意外,偶尔会出现不一样的情况,且差别很大(一次是0,一次是255)。在如此短的时间内TEC和REC应该不会一下子就加到255了吧,请斑竹关注一下。部分代码如下:
temp = CAN_SPI_CMD( SPI_CMD_READ, TOLONG(&(MCP2510_MAP->EFLG)), ARG_UNUSED, ARG_UNUSED );
temp1 = CAN_SPI_CMD( SPI_CMD_READ, TOLONG(&(MCP2510_MAP->EFLG)), ARG_UNUSED, ARG_UNUSED );
if(temp!=temp1)
{
printk("EFLG0 = %d\n",temp);
printk("EFLG1 = %d\n",temp1);
}
put_user(temp,(unsigned int *)arg);
temp = CAN_SPI_CMD( SPI_CMD_READ, TOLONG(&(MCP2510_MAP->TEC)), ARG_UNUSED, ARG_UNUSED );
temp1 = CAN_SPI_CMD( SPI_CMD_READ, TOLONG(&(MCP2510_MAP->TEC)), ARG_UNUSED, ARG_UNUSED );
if(temp!=temp1)
{
printk("TEC0 = %d\n",temp);
printk("TEC1 = %d\n",temp1);
}
temp = CAN_SPI_CMD( SPI_CMD_READ, TOLONG(&(MCP2510_MAP->REC)), ARG_UNUSED, ARG_UNUSED );
temp1 = CAN_SPI_CMD( SPI_CMD_READ, TOLONG(&(MCP2510_MAP->REC)), ARG_UNUSED, ARG_UNUSED );
if(temp!=temp1)
{
printk("REC0 = %d\n",temp);
printk("REC1 = %d\n",temp1);
}
结果如下:
EFLG0 = 0
EFLG1 = 255
TEC0 = 0
TEC1 = 255
REC0 = 0
REC1 = 255 |
|