你好:
我现在在使用TMS320F280049例程can_ex2_loopback_interrupts测试CAN中断接收。看到例程使用的是CAN_INT_IE0,我想把其修改为CAN_INT_IE1,我做了如下的程序修改:
CAN_enableInterrupt(CANA_BASE, CAN_INT_IE1);
Interrupt_register(INT_CANA1, &canISR);
Interrupt_enable(INT_CANA1);
CAN_enableGlobalInterrupt(CANA_BASE, CAN_GLOBAL_INT_CANINT1);
canISR中断函数中修改CAN_clearGlobalInterruptStatus(CANA_BASE, CAN_GLOBAL_INT_CANINT1);
然后,我进行测试发现接收数据未进入到中断里。请问,我还需要修改哪些地方
user6306206:
回复 Susan Yang:
好的,谢谢
Susan Yang:
回复 user6306206:
请您参考TRM的 26.16.2.21 CAN_IP_MUX21 Register (Offset = D8h) [reset = 0h]
https://www.ti.com.cn/cn/lit/ug/sprui33c/sprui33c.pdf
在代码中您可以search一下
//***************************************************************************** // //! Set the CAN controller Interrupt Line for each mailbox //! //! \param base is the base address of the CAN controller. //! \param mux bit packed representation of which message objects should //!generate an interrupt on a given interrupt line. //! //! Selects which interrupt line each message object should assert when an //! interrupt occurs. Bit 0 corresponds to message object 32 and then bits //! 1 to 31 correspond to message object 1 through 31 respectively. Bits that //! are asserted indicate the message object should generate an interrupt on //! interrupt line 1, while bits that are not asserted indicate the message //! object should generate an interrupt on line 0. //! //! \return None. // //***************************************************************************** static inline void CAN_setInterruptMux(uint32_t base, uint32_t mux) {//// Check the arguments.//ASSERT(CAN_isBaseValid(base));//// Set the interrupt muxing for the CAN peripheral//HWREG_BP(base + CAN_O_IP_MUX21) = mux; }
user6306206:
回复 Susan Yang:
你好,很感谢你的回答,我加入了这行函数,可是,还是进不了中断。请问你有完整的有关CAN_INT_IE1的中断设置代码吗?如果有,能提供给我参考一下吗?非常感谢
Susan Yang:
回复 user6306206:
很抱歉,我这边暂时没有完整的有关CAN_INT_IE1的中断设置代码,且手边暂时没有板子,我会在周一给您详细代码。
user6306206:
回复 Susan Yang:
不用了,我这边已经测试好了,不过还是感谢你的回答。还有,现在我在测试中发现我没有加入滤波的情况下,有其他ID接收时依然可以屏蔽掉。请问,这个是F280049芯片本身已经设置好滤波了吗
Susan Yang:
回复 user6306206:
关于此问题,我之前有回复过其他客户,您可以参考下配置代码
e2echina.ti.com/…/576839