Flexcan - FLEXCAN_LISTEN_MODE, activity but no messages

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

Flexcan - FLEXCAN_LISTEN_MODE, activity but no messages

1,080 Views
Cdn_aye
Senior Contributor I

Hi

I got the CAN example code Test.c in MQX 4.0 working between two of our boards. I can see the messages and all is well.

What I really need to do is "listen" on the bus for any message at all, so I stopped the Tx task on the listening node and changed the mode to FLEXCAN_LISTEN_MODE. I can see the signals on the bus but I never get an Rx message. The Rx task waits on an event in the MYFLEX_ISR to set, but it never does.

I was wondering if the message filter had an effect when in FLEXCAN_LISTEN_MODE?

I am not conversant in CAN but have read through the manuals and posts available. What my questions are, is there a recommended beginners reference document on FLexcan? I find the IOUG good to know how to call the api, but not very useful as to the overall picture about Flexcan and how an app should be designed for a given goal. The other question is can someone tell me how I would modify the Test.c program to work in FLEXCAN_LISTEN_MODE please?

Thanks

Robert

0 Kudos
2 Replies

568 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi Robert:

I think you can use the below API to let the node work in FLEX_CAN_LISTEN_MODE

uint32_t FLEXCAN_Select_mode

(

   /* [IN] FlexCAN device number */

   uint8_t dev_num,

   /* [IN] operation Mode */

   uint32_t mode

)

According to reference manual

• Listen-Only mode:

The module enters this mode when the LOM bit in the Control 1 Register is asserted.

In this mode, transmission is disabled, all error counters are frozen and the module

operates in a CAN Error Passive mode. Only messages acknowledged by another

CAN station will be received. If FlexCAN detects a message that has not been

acknowledged, it will flag a BIT0 error (without changing the REC), as if it was

trying to acknowledge the message.

Regards

Daniel

0 Kudos

568 Views
Cdn_aye
Senior Contributor I

Hi Daniel

I tried the mode you mentioned but nothing is received. The reason as far as I can see is

“• Listen-Only Mode:

The module enters this mode when the LOM bit in the Control 1 Register is asserted.

In this mode, transmission is disabled, all error counters are frozen and the module

operates in a CAN Error Passive mode. Only messages acknowledged by another

CAN station will be received. If FlexCAN detects a message that has not been

acknowledged, it will flag a BIT0 error (without changing the REC), as if it was

trying to acknowledge the message.”

So as far as I can see, the receive buffer will not be updated with the receive message, protecting the message buffer from errant unsolicited messages, I think this is called the "Babbling Idiot" mode from what I have read.

The problem I have is how do I acknowledge the message in order to receive the message if the sender is not listening for a response? What I have is a CAN device that continually transmits a message. It does not receive a request to send a message and then sends a response, it just constantly transmits. I need to read the message but I am getting an error or not in Listen-Only-Mode, and not getting anything in Normal-Mode.

Thank you for the suggestion.

Robert

0 Kudos