AnsweredAssumed Answered

LPC11C24 CAN driver Communication implementation method

Question asked by na fu on Sep 19, 2018
Latest reply on Sep 20, 2018 by jeremyzhou

I'm new for CAN and LPC11C24. How to send and receive information through CAN on-chip driver? Do the specific contents of the functions in the following two structures need to be written by myself? Such as init_can()\can_transmit() and so on.

 

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////typedef struct CCAN_CALLBACKS {
    void (*CAN_rx)(uint8_t msg_obj_num);
    void (*CAN_tx)(uint8_t msg_obj_num);
    void (*CAN_error)(uint32_t error_info);
    uint32_t (*CANOPEN_sdo_read)(uint16_t index, uint8_t subindex);
    uint32_t (*CANOPEN_sdo_write)(uint16_t index, uint8_t subindex, uint8_t *dat_ptr);
    uint32_t (*CANOPEN_sdo_seg_read)(uint16_t index, uint8_t subindex, uint8_t openclose, uint8_t *length,
                                     uint8_t *data, uint8_t *last);
    uint32_t (*CANOPEN_sdo_seg_write)(uint16_t index, uint8_t subindex, uint8_t openclose, uint8_t length,
                                      uint8_t *data, uint8_t *fast_resp);
    uint8_t (*CANOPEN_sdo_req)(uint8_t length_req, uint8_t *req_ptr, uint8_t *length_resp, uint8_t *resp_ptr);
} CCAN_CALLBACKS_T;

 

typedef struct CCAN_API {
    void (*init_can)(uint32_t *can_cfg, uint8_t isr_ena);
    void (*isr)(void);
    void (*config_rxmsgobj)(CCAN_MSG_OBJ_T *msg_obj);
    uint8_t (*can_receive)(CCAN_MSG_OBJ_T *msg_obj);
    void (*can_transmit)(CCAN_MSG_OBJ_T *msg_obj);
    void (*config_canopen)(CCAN_CANOPENCFG_T *canopen_cfg);
    void (*canopen_handler)(void);
    void (*config_calb)(CCAN_CALLBACKS_T *callback_cfg);
} CCAN_API_T;

Outcomes