cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC™ Creator & Designer

MaPf_1293106
New Contributor II

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
New Contributor II

Is there an other way to report bugs in components?

0 Likes
ShanmathiN_06
Employee

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
MaPf_1293106
New Contributor II

To read CSR_BUF_SR might not return the same buffer.

Thank you for creating the enhancement request.

BR

Marc

0 Likes
ShanmathiN_06
Employee

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
MaPf_1293106
New Contributor II

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
MaPf_1293106
New Contributor II

How about the release date for the improvement?

0 Likes
MaPf_1293106
New Contributor II

Sorry to insist, but how about this fix?

0 Likes
MaPf_1293106
New Contributor II

Friendly reminder 🙂

0 Likes