Hi,
I would like to know the correct API setting with R7A6M5 for the purpose of monitoring all data on the CAN bus and its ID,
please check my current setting of AFL below,
// #define CANFD_FILTER_ID (0x03) #define MASK_ID (0xFF) #define MASK_ID_MODE (1) #define ZERO (0U) const canfd_afl_entry_t p_canfd1_afl[CANFD_CFG_AFL_CH0_RULE_NUM] = { { .id = { /* Specify the ID, ID type and frame type to accept. */ .id = CANFD_FILTER_ID, .frame_type = CAN_FRAME_TYPE_DATA, .id_mode = CAN_ID_MODE_STANDARD }, .mask = { /* These values mask which ID/mode bits to compare when filtering messages. */ .mask_id = MASK_ID, .mask_frame_type = ZERO, .mask_id_mode = MASK_ID_MODE }, .destination = { /* If DLC checking is enabled any messages shorter than the below setting will be rejected. */ .minimum_dlc = (canfd_minimum_dlc_t)ZERO, /* Optionally specify a Receive Message Buffer (RX MB) to store accepted frames. RX MBs do not have an * interrupt or overwrite protection and must be checked with R_CANFD_InfoGet and R_CANFD_Read. */ .rx_buffer = CANFD_RX_MB_0, /* Specify which FIFO(s) to send filtered messages to. Multiple FIFOs can be OR'd together. */ .fifo_select_flags = CANFD_RX_FIFO_0, } }, }
And I also have my CAN Rx function as below, please advise on how I can get, in addition to the data, the ID it belongs to.
int8_t sc_can_rx(uint8_t *rx_buf, size_t *rx_len) { //fsp_err_t err = FSP_SUCCESS; // Error status memcpy(rx_buf, &g_can_1_rx_frame.data, sizeof(g_can_1_rx_frame.data)); *rx_len = sizeof(g_can_1_rx_frame.data); return 0; }
Thanks and your advice would be greatly appreciated.
Ohtaber