最近作CAN的驱动,发现NXP的文档写得简直叫狗屎。<br />同样的CAN模块,同样的设计(我相信一定是相同的设计),三款芯片对于中断标志位IDI(ICR.8)的描述差别甚大:<br /><br />LPC2292的:<br />ID Ready Interrupt -- this bit is set if the IDIE bit in <br />CANIE is 1, and a CAN Identifier has been received.<br /><br />LPC2917的:<br />IDIE R/W ID ready interrupt enable<br /> 1 An interrupt is generated if a CAN identifier has <br /> been received in acceptance filter bypass <br /> mode.<br /> 0<br /><br />LPC2378的最离谱,看完了搞不清楚到底是与发送有关还与跟接收有关<br />IDI ID Ready Interrupt 0 (reset)<br /> 1 (set)<br /> -- this bit is set if the IDIE bit in CANxIER is 1,<br /> and a CAN Identifier has been received (a <br /> message was successfully transmitted or <br /> aborted). This bit is set whenever a message was <br /> successfully transmitted or aborted and the IDIE <br /> bit is set in the IER reg.<br /><br /><br />再看LPC2378的errate sheet,CAN的Data Overrun这个BUG描述也让人一头雾水。<br />Introduction: Each CAN controller provides a double Receive Buffer (RBX) per CAN channel to store incoming <br />messages until they are processed by the CPU. Software task should read and save received data<br />as soon as a message reception is signaled.<br />In cases, where both receive buffers are filled and the contents are not read before the third mes-<br />sage comes in, a CAN Data Overrun situation is signaled. This condition is signaled via the Status<br />register and the Data Overrun Interrupt (if enabled).<br />Problem: In a Data Overrun condition, the CAN controller is locked from further message reception. <br />Workaround: 1. Recovering from this situation is only possible with a soft reset to the CAN controller. <br />2. If software cannot read all messages in time before a third message comes in, it is recommend<br />to change the acceptance filtering by adding further acceptance filter group(s) for messages, <br />which are normally rejected. With this approach, the third incoming message is accepted and the <br />Data Overrun condition is avoided. These additional messages are received with the correspond-<br />ing group index number can be easily identified and rejected by software.<br /><br /><br />这样的文档,对开发人员简直是智商的调戏。这个CAN,做的让人吐血。<br /><br />接着再说LPC2000的VIC,一会儿用ARM的PL192,一会用ARM的PL197;再说EMC,一会自己搞一套,一会又用ARM的IP,NXP你能稳定一点不,不要来回折腾你的用户行不行。<br /><br /><br />回想NXP的LPC2000系列,从LPC2104开始就是一堆BUG,接着LPC22XX没有什么改进,一直做到LPC23XX时BUG才明显开始减少。达到ATMEL的SAM7的水平。<br /><br />LPC2000啊,用得让人头疼!! |
|