关于S32K144芯片CAN发送报文的疑问

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

关于S32K144芯片CAN发送报文的疑问

8,439 Views
_simple_
Contributor III

    您好,我在使用S32K144这个芯片的CAN功能,使用过程中需要抓取CAN总线上所有不同ID的报文(即不需要ID过滤),所以我把寄存器RXMGMASK、RX14MASK、RX15MASK都设置为0,我在接收中断里打断点,看到是可以接收到报文,但RXMGMASK、RX14MASK、RX15MASK都设置为0后,使用其他MB发送报文时,发送产生的IFLAG会出问题(IFLAG会同时有两位置1),不知道怎么解决,请问您可以帮助我定位一下问题出在哪里吗?我看了好几遍手册,没找到RXMGMASK、RX14MASK、RX15MASK会影响相关的发送。

捕获.PNG

8 Replies

6,095 Views
Hal_9000
Contributor II
Hello,I also met a  same CAN recieve and tranfer problem,so i send this message for you .Look forward to your reply.
 
I use S32K144 CAN1, PORT PTE12 for RX and PTE13 for TX. I use MB0 for receiving and MB1 for transferring. Now I enable MB0 interrupt and disable MB1 interrupt in IMASK1 register,only enable receiving and transferring successfully interrupt by using INT_SYS_SetPriority(CAN1_ORed_0_15_MB_IRQn,2); and not enable other interrupt source.In interrupt Handler —— CAN1_ORed_0_15_MB_IRQHandler ,when I received frame,I clearing MB0 bit in IFLAG1 and sending a permanent TX frame to MB1.
 
Now i say my problem ,if I delete send function in CAN1_ORed_0_15_MB_IRQHandler ,everything will be ok,When I send a frame to board by using upper computer,I can successfully received a frame ,clear MB0 to IFLAG1 register and not continued enter in CAN1_ORed_0_15_MB_IRQHandler .But adding send function,when I received a RX frame ,the TX frame is sent and quit CAN1_ORed_0_15_MB_IRQHandler ,it will also continue entering in CAN1_ORed_0_15_MB_IRQHandler endlessly .When using PE debug ,I found MB0 in IFLAG1 register changed to 1,it can explain this phenomenon. But I had clean this bit by writing 1 to this bit .Why cause this?
0 Kudos

6,095 Views
_simple_
Contributor III

和下面是同一个问题哈

0 Kudos

6,096 Views
Hal_9000
Contributor II

我也出现了同样的问题!!我将接收中断开启没有开启发送中断,我在接收中断里面,如果去掉发送函数,一切正常但如果加上了发送函数,就会不停的进接收中断

我用MB0作为接收邮箱,MB1作为发送邮箱,上面已经提到,我在接收中断里面已经成功清除了对应的IFLAG1,但是好像用MB1发送成功后,又会将MB0的IFLAG1对应位置位,于是就会频繁进入接收中断,不知道原因为何??

0 Kudos

6,096 Views
_simple_
Contributor III

检查下MCR寄存器,SRXDIS位的状态,你会得到你想要的答案。这个位置位就可以了。

6,096 Views
Hal_9000
Contributor II

谢了兄弟!困扰了很久!居然是这个位,网上例程都没有专门set这个位

0 Kudos

6,096 Views
shenlanzeng
Contributor I

您好,您使用寄存器操作can,接收是可以的吗?我也是用寄存器开发,但是CAN能发不能收,能请教下吗,能否加下QQ:357929237,我现在也在调试CAN,纠结好久了,始终收不到报文,谢谢!

0 Kudos

6,096 Views
_simple_
Contributor III

一晃三年过去了

0 Kudos

6,096 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

Please use English so we can more easily read the question and understand the issue.

 

The RX MASK registers have nothing with the TX operation.

The MB’s flag is set in both situation.

Once the message is successfully received and moved into MB the respective MB flag in IFLAG register is set.

Once the message is successfully transmitted the respective MB flag in IFLAG register is set.

BR, Petr

0 Kudos