AnsweredAssumed Answered

s32k144 CAN tx state busy

Question asked by Altamash Abdul Rahim on Mar 29, 2018
Latest reply on Apr 9, 2018 by Altamash Abdul Rahim

Hello,

I'm trying to use the s32k144 mcu for CAN communication without the SBC of EVB. I'm using a mcp2551 CAN transiever and i'm using the CAN0 instance and feeding PTE4 PTE5 (CAN rx,tx) pins to the mcp2551 transiever. Now on sending some data using the can_pal driver it return busy state. any suggestions. My code snippet is below:

 

#define TX_MAILBOX  (1UL)

status_t status;
void Delay(uint32_t count)
{
    while(count!=0)
    {
      count--;
    }
}
int main(void)
{
CLOCK_SYS_Init(g_clockManConfigsArr,CLOCK_MANAGER_CONFIG_CNT,g_clockManCallbacksArr,CLOCK_MANAGER_CALLBACK_CNT);
    CLOCK_SYS_UpdateConfiguration(0U, CLOCK_MANAGER_POLICY_FORCIBLE);
    CAN_Init(INST_CAN_PAL1, &can_pal1_Config0);
    PINS_DRV_Init(NUM_OF_CONFIGURED_PINS,g_pin_mux_InitConfigArr);
    PINS_DRV_SetPinsDirection(PTD,(LED16));
    PINS_DRV_SetPins(PTD,LED16);
    can_buff_config_t buffCfg =  {
        .enableFD = false,
        .enableBRS = false,
        .fdPadding = 0U,
        .idType = CAN_MSG_ID_STD,
        .isRemote = false
    };
    CAN_ConfigTxBuff(INST_CAN_PAL1,TX_MAILBOX, &buffCfg);
    //uint8_t toggle = 0x99;
    can_message_t message = {
        .cs = 0U,
        .id = 0x99,
        .data[0] = 0x99,
        .length = 1
    };
    for(;;)
    {
        Delay(0xFFFFF);
        //FLEXCAN_DRV_SendBlocking(INST_CANCOM1,MB,&dataInfo,ID, &toggle, 100);
        //if(FLEXCAN_DRV_Send(INST_CANCOM1, MB,&dataInfo, ID,&toggle)==STATUS_SUCCESS)
        status = CAN_Send(INST_CAN_PAL1,TX_MAILBOX,&message);
       while(CAN_GetTransferStatus(INST_CAN_PAL1,TX_MAILBOX)==STATUS_BUSY);
        PINS_DRV_TogglePins(PTD,LED16);
    }

}

Outcomes