AnsweredAssumed Answered

S32K148 CAN send bug

Question asked by 张 舜毅 on Apr 11, 2019
Latest reply on Apr 15, 2019 by Petr Stancik
flexcan_state_t canCom1_State;
const flexcan_user_config_t canCom1_InitConfig0 = {
     .max_num_mb = 2,                                 /*!< The maximum number of Message Buffers
                                                     @internal gui name="Maximum number of message buffers" id="max_num_mb" */
     .pe_clock = FLEXCAN_CLK_SOURCE_PERIPH,            /*!< The clock source of the CAN Protocol Engine (PE). */
     .is_rx_fifo_needed = false,               /*!< 1 if needed; 0 if not. This controls whether the Rx FIFO feature is enabled or not.
                                         @internal gui name="Use rx fifo" id="is_rx_fifo_needed" */
     .num_id_filters = FLEXCAN_RX_FIFO_ID_FILTERS_8,/*!< The number of RX FIFO ID filters needed
                                                    @internal gui name="Number of RX FIFO ID filters" id="num_id_filters" */
     .fd_enable = false,                    /*!< Enable/Disable the Flexible Data Rate feature. */
     .flexcanMode = FLEXCAN_LOOPBACK_MODE,            /*!< User configurable FlexCAN operation modes.
                                                   @internal gui name="Flexcan Operation Mode" id="flexcanMode"*/
     .payload = FLEXCAN_PAYLOAD_SIZE_8,             /*!< The payload size of the mailboxes specified in bytes. */
     /*!< The bitrate used for standard frames or for the arbitration phase of FD frames. */  //500K
     .bitrate = {
          .propSeg = 7,           /*!< Propagation segment*/
          .phaseSeg1 = 4,          /*!< Phase segment 1*/
          .phaseSeg2 = 1,          /*!< Phase segment 2*/
          .preDivider = 0,     /*!< Clock prescaler division factor*/
          .rJumpwidth = 1          /*!< Resync jump width*/
     },
     /*!< The bitrate used for the data phase of FD frames. */
     .bitrate_cbt = {
          .propSeg = 11,          /*!< Propagation segment*/
          .phaseSeg1 = 1,          /*!< Phase segment 1*/
          .phaseSeg2 = 1,          /*!< Phase segment 2*/
          .preDivider = 0,     /*!< Clock prescaler division factor*/
          .rJumpwidth = 1          /*!< Resync jump width*/
     },
     .transfer_type = FLEXCAN_RXFIFO_USING_INTERRUPTS,/*!< Specifies if the Rx FIFO uses interrupts or DMA. */
     .rxFifoDMAChannel = 0U                     /*!< Specifies the DMA channel number to be used for DMA transfers. */
};

/* Set information about the data to be received or sended*/
flexcan_data_info_t dataInfo =
{
     .msg_id_type = FLEXCAN_MSG_ID_EXT,/*!< Type of message ID (standard or extended)*/
     .data_length = 1U,                /*!< Length of Data in Bytes*/
     .fd_enable = false,               /*!< Enable or disable FD*/
     .fd_padding = 0U,                 /*!< Set a value for padding. It will be used when the data length code (DLC)
                                                       specifies a bigger payload size than data_length to fill the MB */
     .enable_brs = true,               /*!< Enable bit rate switch inside a CAN FD format frame*/
     .is_remote = false               /*!< Specifies if the frame is standard or remote */
};


PINS_DRV_SetMuxModeSel(PORTE, ePIN_24, PORT_MUX_ALT3); //CAN_H
PINS_DRV_SetMuxModeSel(PORTE, ePIN_25, PORT_MUX_ALT3);       //CAN_L�
              
FLEXCAN_DRV_Init(canNum, &canCom1_State, &canCom1_InitConfig0);
/* Configure Rx message buffer with index 1 to receive frames with ID 2 */
FLEXCAN_DRV_ConfigRxMb(canNum, RX_MAILBOX, &dataInfo, RX_MSG_ID);
INT_SYS_EnableIRQ(CAN2_ORed_0_15_MB_IRQn);

/* Configure Tx message buffer with index 1 to send frames with ID 1 */
FLEXCAN_DRV_ConfigTxMb(canNum, TX_MAILBOX, &dataInfo, msgId);

FLEXCAN_DRV_Send(canNum, TX_MAILBOX, &dataInfo, msgId, (uint8_t *)&sendData[i]);

hello,
NXP

I 'm going to replace ".flexcanMode = FLEXCAN_LOOPBACK_MODE," with ".flexcanMode = FLEXCAN_NORMAL_MODE,",My program is not working property,in either case , my CAN module can not send data,why? whit is my problem?

 

My transceiver is TJA1044T.

Outcomes