Dear:
Thanks for your attention!
I have set s12g128 MSCAN in filter mode , there are two can id should be received, id0 = 0x280, id1 = 0x1A0 ,
CAN filter configration as four 16bit mode , filter0 receive 0x280, filter1 receive 0x1A0.
During the test, it was found that only filter0 can receive normally, it could receive 0x280's message, but filter1 does not work. It can be determined that 0x1A0 information on the CAN bus is normaly.
the s12g128 MSCAN configration code as follows:
/* ---------------------------------------------------------------------- */
Hi Gao,
I cannot see any obvious issues for now.
Are you sure that these IDs are for standard type data frames?
Your filter configuration masks all messages with extended identifiers and also all remote frames.
While your receive function works with remote frames and extended format IDs by default.
For receiving also remote frames use CANIDMRx = 0x17;
Best regards
Radek
Hi Radek:
use USB-CAN tools receive the CAN BUS data , I can read the 0x280 & 0x1A0 CAN IDs data as follows pictures, thanks!
Best regards
GAO
Hi Gao,
thank you for more details.
Could you please check CANRFLG_OVRIF flag? It seems that Overrun interrupt isn't enabled.
Could you please also periodically check CANIDAC_IDHITx bits for excluding any issue on the software side?
Please check also CANIDARx and CANIDMRx registers for ensuring that correct values are presented.
CANIDAR0=0x50
CANIDMR0=0x00
CANIDAR1=0x00
CANIDMR1=0x07
CANIDAR2=0x34
CANIDMR2=0x00
CANIDAR3=0x00
CANIDMR3=0x07
BTW: how you detect that message with 0x280 didn't arrive? I guess that you probably periodically test canRxMsg global variable. Cannot be a source of issue any timing synchronization?
I would like to propose some debug GPIO pins (LEDs) toggling directly in mscan_receive() function.
Best regards
Radek
Hi Radek:
Thanks for your attention!
When received can messages, I use serial to trans them to PC, only can receive the filter0 IDs.
Tomorrow I will test according to your suggestions. The link below is the source code. Please help me check it.
Sorry, I don’t know how to upload the attachment, so I will provide it to you in the form of shared network disk.
net disk link: https://pan.baidu.com/s/1l3qu1t1NtUz23nw9K9YnfQ
Extraction code: 8wci
Thank you very much!
Best regards
GAO
Hi Gao,
Unfortunately, I was not able to found the right option of how to download it without registration or specific application. Probably just problem with web page translation.
If you want to upload attachment here, please click on Use advanced editor link at the top right corner of your reply window.
After that, you will see the attachment upload option directly under your reply.
Best regards
Radek
Hi Radek,
In today ’s test, in the MSCAN initialization mode, set CANIDAC_IDAM = 1, or set CANIDAC = 0x10, that is, four 16-bit filter modes. After the program runs, it can only receive the IDs of filter0 and filter2, and read the CANIDAC The value is still 0, that is, the value of IDAM has not been written. MSCAN also works in two 32-bit modes, so it can only receive the IDs of filter0 and filter2. After searching online, I found a netizen Encountered the same problem, just need to set the CANCTL1 = 0xC0 register in advance, and that's it. The modified code is as follows:
/* -------------------------------------------------------------------------------------- */
Hi Gao,
I am glad that it works now and I am sorry that I didn't found it before.
Thank you for sharing the solution.
Best regards
Radek
Hi Radek,
Sharing is right, and some of your suggestions gave me a better idea in debugging, thank you very much!
Best regards
GAO
Hi Radek:
Thanks for your replay!
The 0x280 and 0x1A0 are standard can data frame, not remote ,not extended . I test them on the BJ40 car can bus , so I confirm their correctness, and today I modify the filter 0 receive 0x1A0, filter 1 receive 0x280, then can only receive 0x1A0 IDs, Really confused ,:( .
thanks for your attention!
Best regards
GAO