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