Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Bandarikarthik
Level 3
Level 3
25 replies posted 100 sign-ins First like given


Hello every one!!

I am working on CAN communication module on XMC1403 series i was sucessfully Transmitting and receiving messages with two Nodes,


I am using 2 message object
1 for TX
1 for RX

I need help regarding the receiving acceptance filtering of message object Rx
where i would like to accept only a range of messages.
for example:  suppose i am using EXTENTED frame format i would like to allow only these range of IDs(18F21240 to 18F21245)into my message object.
Below is my receiving LMO2 object structure intialisation in can_node_config.c  and this is pooling method i am using.


Is there any method to receive range of messages to RX message object as there is only one mask value to the rx message object(LMO2) as i have attached file it was shown in APP Dependency in DAVE IDE.


XMC_CAN_MO_t CAN_NODE_0_LMO_02 = {

.can_mo_type = XMC_CAN_MO_TYPE_RECMSGOBJ,
.can_id_mode = XMC_CAN_FRAME_TYPE_EXTENDED_29BITS,
.can_priority = XMC_CAN_ARBITRATION_MODE_IDE_DIR_BASED_PRIO_2,
.can_ide_mask = 1U,
.can_mo_ptr = (CAN_MO_TypeDef*)CAN_MO17,
.can_data_length = 8U,

};

const CAN_NODE_LMO_t CAN_NODE_0_LMO_02_Config = {

.mo_ptr = (XMC_CAN_MO_t*)&CAN_NODE_0_LMO_02,

.number = 17U,

.tx_sr = 0U,
.rx_sr = 0U,
.tx_event_enable = false,
.rx_event_enable = true
};

Please need the solution ASAP!!

 

Bandari Karthik Kumar
0 Likes
2 Replies
Aashita_R
Moderator
Moderator
Moderator
50 likes received 100 solutions authored 250 replies posted

Hi @Bandarikarthik ,

I understand that you are trying to send a range of message ids (18F21240 to 18F21245) through message object MO2. As per my suggestions, you can try including a for loop in your code which ranges from start_id and end_id as 18F21240 to 18F21245 respectively.  You can store the mask values(CAN_IDENTIFIER_MASK) in an array and then use bitwise operation on the CAN_IDE_MASK values to store the final value in an array and use it. Below is the reference of the parameters you can come across in MO structure-

#define CAN_IDENTIFIER                     0xFF /* 11 bits/ 29 bits CAN identifier. Sets Arbitration register */
#define CAN_IDENTIFIER_MASK       0xFF /* CAN identifier Mask. Sets mask bits of Acceptance Mask Register. */
#define CAN_IDE_MASK                        1 /* Identifier Extension Bit of Message Object. Message object receives frames only with matching IDE bit */

This should be helpful to get started. Please give me some time to help you with a project, based on the availability of time. Please add here in case of any further query.

Best Regards,

Aashita

 

0 Likes
Bandarikarthik
Level 3
Level 3
25 replies posted 100 sign-ins First like given

Hello @Aashita_R  Thank you for your response!!

Here logical MO2 object is for CAN  receiving  only not for transmit  as you mentioned "I understand that you are trying to send a range of message ids (18F21240 to 18F21245) through message object MO2."

I want to receive only message ids (18F21240 to 18F21245) band  in my logical Message Object2(LMO2) as it configured for receiving CAN messages only.

As I have seen in Driver file where masking is happening after receiving the CAN message in xmc_can.c file

XMC_CAN_STATUS_t XMC_CAN_MO_Receive (XMC_CAN_MO_t *can_mo) ---> function 

can_mo->can_identifier = (can_mo->can_mo_ptr->MOAR & CAN_MO_MOAR_ID_Msk); 

#define CAN_MO_MOAR_ID_Msk (0x1fffffffUL) /*!< CAN_MO MOAR: ID (Bitfield-Mask: 0x1fffffff) */  this statement was in XMC1400.h

But in my case I would like to allow to receive only (18F21240 to 18F21245) IDs when incoming message is from CAN BUS.

Hope you have got my point. 

Thanks & Regards,

 

 

 

Bandari Karthik Kumar
0 Likes