CAN component bug: CAN_ReceiveMsg_Callback() has no parameter for the related mailbox?

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

cross mob
MaPf_1293106
Level 2
Level 2
5 sign-ins 10 replies posted 5 replies posted

The CAN receive call back for basic mailboxes doesn't tell the related mailbox.

I can add my own code to fix the problem but wouldn't it make sense to add the parameter to the call back?

Without the parameter rxMailbox you need to search for the mailbox again.

/*******************************************************************************

* FUNCTION NAME:   CAN_LS_ReceiveMsg

********************************************************************************

*

* Summary:

*  This function is the entry point to Receive Message Interrupt for Basic

*  mailboxes. Clears the Receive particular Message interrupt flag. Generated

*  only if one of the Receive mailboxes is designed as Basic.

*

* Parameters:

*  rxMailbox: The mailbox number that trig Receive Message Interrupt.

*

* Return:

*  None.

*

* Reentrant:

*  Depends on the Customer code.

*

*******************************************************************************/

void CAN_LS_ReceiveMsg(uint8 rxMailbox)

{

    #if (CY_PSOC3 || CY_PSOC5)

        if ((CAN_LS_RX[rxMailbox].rxcmd.byte[0u] & CAN_LS_RX_ACK_MSG) != 0u)

    #else  /* CY_PSOC4 */

        if ((CAN_LS_RX_CMD_REG(rxMailbox) & CAN_LS_RX_ACK_MSG) != 0u)

    #endif /* CY_PSOC3 || CY_PSOC5 */

        {

            /* `#START MESSAGE_BASIC_RECEIVED` */

               

            /* `#END` */

            #ifdef CAN_LS_RECEIVE_MSG_CALLBACK

                CAN_LS_ReceiveMsg_Callback();        // here the parameter "rxMailbox" is missing

            #endif /* CAN_LS_RECEIVE_MSG_CALLBACK */

            #if (CY_PSOC3 || CY_PSOC5)

                CAN_LS_RX[rxMailbox].rxcmd.byte[0u] |= CAN_LS_RX_ACK_MSG;

            #else  /* CY_PSOC4 */

                CAN_LS_RX_CMD_REG(rxMailbox) |= CAN_LS_RX_ACK_MSG;

            #endif /* CY_PSOC3 || CY_PSOC5 */

        }

}

0 Likes
8 Replies
MaPf_1293106
Level 2
Level 2
5 sign-ins 10 replies posted 5 replies posted

Is there an other way to report bugs in components?

0 Likes
ShanmathiN_06
Employee
Employee
100 replies posted 50 replies posted 25 replies posted

Hi,

You can read CSR_BUF_SR register to check which RxMailbox had received data.

You can refer to registers TRM. We have created an internal enhancement request, to pass the rxMailbox parameter to Callback function.

Thanks,

Shanmathi

0 Likes

To read CSR_BUF_SR might not return the same buffer.

Thank you for creating the enhancement request.

BR

Marc

0 Likes

Hi,

CSR_BUF_SR register could be used to retrieve the RxMailbox number.

You can refer to CAN_Full code example (ISR_CAN) for the usage of CSR_BUF_SR register.

Thanks,
Shanmathi

0 Likes

Problems when using the Callback CAN_ReceiveMsg_Callback() and again check for CSR_BUF_SR:

  1. As you can still receive CAN messages while CAN_MsgRXIsr​() is managing the current messages register CSR_BUF_SR can change.
  2. While CAN_MsgRXIsr() is managing the buffers, it will not clear CSR_BUF_SR. If several buffers are "active" a second search will not necessarily find the same mailbox like the callback would indicate in rxMailbox (worse if combined with 1.).
  3. It is much easier to add a manual callback in CAN_ReceiveMsg(uint8 rxMailbox)

For sure there is a solution but would like to see it work like it's meant to work.

0 Likes

How about the release date for the improvement?

0 Likes
MaPf_1293106
Level 2
Level 2
5 sign-ins 10 replies posted 5 replies posted

Sorry to insist, but how about this fix?

0 Likes
MaPf_1293106
Level 2
Level 2
5 sign-ins 10 replies posted 5 replies posted

Friendly reminder 🙂

0 Likes