收信使用MailBox。如何配置一个MailBox接收一个范围得报文

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

收信使用MailBox。如何配置一个MailBox接收一个范围得报文

659 Views
xiaobaby22
Contributor I

Hello, 目前使用得是S32K1xx系列得片子。然后禁用了FIFO收信。使用得MB收信。也就是一个ID对应一个MB得策略。但是目前想让一个MB对应一个范围得ID报文。有什么方式吗?比如想配置一个MB可以接收0x500~0x53F区间得报文。请问有MASK得配置吗?能否提供一下帮助,谢谢

0 Kudos
Reply
4 Replies

642 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

you can refer to https://community.nxp.com/t5/S32K-Knowledge-Base/S32K1xx-FlexCAN-Mask-Setting-Demo/ta-p/1519753

generally to receive std. ID range 0x500-0x53F into single MB, just set MB ID = 0x500<<18 and respective mask register = 0x7C0<<18, meaning lower 6 bits are don't care.

BR, Petr

0 Kudos
Reply

592 Views
xiaobaby22
Contributor I

@PetrS yep,i set MB ID = 0x500<<18 and relevant  RXIMRx register = 0x7C0<<18,but the other MBs receice will be in disorder.and all the respective  IFLAG1 register will be set 1 when just receice single ID.

0 Kudos
Reply

591 Views
xiaobaby22
Contributor I

The configuration code:

    /* Configure RX frames */
    for(u8FifoIndex = CAN_UINT8_ZEROu8FifoIndex < 12u8FifoIndex++)
    {
         const flexcan_data_info_t RxDataInfo =
         {
             FLEXCAN_MSG_ID_STD,
             8/*DLC */
             false,
             0,
             false,
             false
         };
         /* Configure RX message */
         (void)FLEXCAN_DRV_ConfigRxMb(INST_CANCOM1u8FifoIndex, &RxDataInfocastCanDrvRxParam[u8FifoIndex].u32Identifier);
         (void)FLEXCAN_DRV_Receive(INST_CANCOM1,u8FifoIndex, &can_stRecvBuf[u8FifoIndex]);

        //can_InitReceive(u8FifoIndex, castCanDrvRxParam[u8FifoIndex].u32Identifier, (uint32)castCanDrvRxParam[u8FifoIndex].u8Dlc);
    }
    FLEXCAN_DRV_SetRxMaskType(INST_CANCOM1,FLEXCAN_RX_MASK_INDIVIDUAL);
    can_InitReceive(12castCanDrvRxParam[12].u32Identifier, (uint32)castCanDrvRxParam[12].u8Dlc);
    FLEXCAN_DRV_SetRxIndividualMask(INST_CANCOM1,FLEXCAN_MSG_ID_STD,12,0xFFFFFF80);
0 Kudos
Reply

579 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

check within debugger content of MBs and mask registers if all is configured as you need. Be sure module is halted in debug mode to be able to see RXIMR.

BR, Petr

0 Kudos
Reply