FlexCAN and global mask none

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

FlexCAN and global mask none

1,241 Views
jpa
Contributor IV

I'd like to be able to configure the K60 FlexCAN module to send and receive messages on any ID.

 

I took the flexcan example from MQX and tried setting the global stdmask to 0 (mask none).  

 

The example has a mailbox configured for transmit with an identifier of 0x321 and a mailbox for receive with an identifier of 0x123.  With the global mask set to 0x000 (instead of 0x222), a message sent to this node generates a receive error of 0xa214.  Transmissions go out just fine.  

 

Why, and more importantly, how do I configure the FlexCAN to receive any message while still being able to send messages (and hopefully not receive its own)?

 

JPA

 

0 Kudos
1 Reply

349 Views
egoodii
Senior Contributor III

I have modified the Bare-Metal Kinetis example to have null filters, and to use only TX MB queue, and the RxFIFO MBs fill a further binary-sized RAM FIFO, and this can work for either or both ports on Kinetis.  I use this for J1939, and could probably take out more of that general-case example code for this specific purpose if I were ambitious.  As for 'not receiving our TX messages' there are erratta on Kinetis in regard to 'disable self reception'...

 

This is started by:

FlexCAN_Open();   //Open FlexCAN Interfaces

// Initialize CAN module

FlexCAN_Init(CAN_Bitrate, CAN0_BASE_PTR);

 

and polled thus:

 

noBytesRx = FlexCAN_Read_RxFIFOQueue(&PortID, &idRxed, &tstampRXed, bytesRx);

while(noBytesRx >0) //nonEmpty FIFO?

{

  if( PortID == 0 ) //Only CAN0 (1-wire) is currently J1939-formatted

  j1939_post(noBytesRx, &idRxed, tstampRXed, bytesRx);

  else

  {

  }

  noBytesRx = FlexCAN_Read_RxFIFOQueue(&PortID, &idRxed, &tstampRXed, bytesRx);

}

 

--ERGII