S32K144 can

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

S32K144 can

Jump to solution
3,175 Views
Ada-gc
Contributor II

I want to change the specified bit when sending CAN data. What should I do?

Adagc_0-1652780866370.png

 

0 Kudos
Reply
1 Solution
3,042 Views
Ada-gc
Contributor II

thank you very much

View solution in original post

0 Kudos
Reply
8 Replies
3,168 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

if you want to send new std ID value just modify ID standard filed of selected MB having IDE=0 and let module to send it by updating CODE field. If running SDK driver simply use Send function

PetrS_0-1652784291677.png

If you want to flip bit of sending message, to disturb a frame, then module is not able to do that.

BR, Petr 

0 Kudos
Reply
3,156 Views
Ada-gc
Contributor II

Sorry, I can describe it more clearly

When sending CAN data, the specified bit needs to be changed, and when receiving CAN data, it is necessary to judge whether the specified bit data is 0 or 1. Do you have any suggestions?

Adagc_0-1652876241958.png

 

 

0 Kudos
Reply
3,123 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

when sending message MB ID word specify teh ID to be send, when MB receive a message its ID word stores the ID received.

BR, Petr

0 Kudos
Reply
3,106 Views
Ada-gc
Contributor II

Can I do this by reading and writing this struct?

Adagc_0-1653015907185.png

 

0 Kudos
Reply
3,079 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

yes this structure is used for buffer variable used for receiving. After successful message receiving this variable is updated

/* Define receive buffer */
flexcan_msgbuff_t recvBuff;

/* Start receiving data in RX_MAILBOX. */
FLEXCAN_DRV_Receive(INST_CANCOM1, RX_MAILBOX, &recvBuff);

 

To send message below is used and the ID is parameter of Send function

flexcan_data_info_t dataInfo =
{
.data_length = 8,
.msg_id_type = FLEXCAN_MSG_ID_STD,
.enable_brs = false,
.fd_enable = false,
.fd_padding = 0U
};

/* Execute send non-blocking */
FLEXCAN_DRV_Send(INST_CANCOM1, mailbox, &dataInfo, messageId, data);

BR, Petr

0 Kudos
Reply
3,002 Views
Ada-gc
Contributor II

Excuse me, the ID data type in the structure is uint_32, and the 18th to 28th bits represent the arbitration ID?

Adagc_0-1654839226010.png

 

Tags (1)
0 Kudos
Reply
2,985 Views
PetrS
NXP TechSupport
NXP TechSupport

yes, you are right.

BR, Petr

0 Kudos
Reply
3,043 Views
Ada-gc
Contributor II

thank you very much

0 Kudos
Reply