CAN FIFO Handle

Hi,


I'm using RA6M5 in my project and I'm trying to implement CAN communication, but I have some problems receiving data. I handling manually received messages, I have more than 32 messages, so I group messages in different buffer using ID MASK to control what messages manage. In my main program I use R_CANFD_InfoGet function to know if data is received and using rx_mb_status I know in which mailbox I received data, every works fine, but sometimes the received data don't correspond to sent data. When data is received, we use ID to know to which message corresponds, but sometimes ID is from one message and data from another message from this configured mailbox. Is any way to avoid that? Can I configure something to solve this problem?

Thanks in advance

 

Parents
  • Hello,

    Are you reading from RX FIFO or RX message buffers ?

    In case of RX FIFO it is recommended to receive with an interrupt driver logic, while in case of RX message buffers R_CANFD_InfoGet and R_CANFD_Read are used to poll and read the message.

    Have you actually verified that the correct CAN frame is transmitted on the bus and it is received incorrectly on the RA6M5 ? Or do you check only the received messages and compare them to the desired results ? What I am trying to say is that is it possible that a transmitted message has wrong ID or data bytes ?

  • Hello,

    I am using this:

    But I cannot use callback interrupt to read messages, because it's not supported (Renesas confirm that), so I need to use polling mode, using the functions R_CANFD_InfoGet and R_CANFD_Read

    I'm sending messages using PCAN explorer so I know the value of sending messages and IDs, for that reason I know that the reading data is not OK, always I send the same values but not always are readed the same values in the software.

  • The interrupt driven reception is supported and also recommended for RX FIFO but I assume you refer to the FSP bug of the r_canfd driver which being under development.

    The rx_mb_status is the value of CFDRMND0 register which refers to the RX Message Buffer

    So if you are checking this value, you are checking only the status of RX message buffers not RX FIFO.

Reply Children
  • Hello,

    Finally I have disabled the FIFO and I am doing by polling but instead of parsing in the main program I am using a 500us timer to check if something new is received with the function R_CANFD_InfoGet and using can_rx_info_ch0.rx_mb_status I can know in which mailbox I have received data. The data is saved in an intermediate array and in the main program I process the saved data.
    Now it seems to work fine.