AnsweredAssumed Answered

FlexCAN in mpc5746C with freertos

Question asked by 大大 许 on Dec 4, 2017

Hi ,

I meet an qustion about flexcan initial question .

Frist, in the freertos background, I call S32_SDK_MPC574xx_EAR_0.8.1 function to init flexcan0 ,I run to create semaphore address, when semaphore number is arrival to 63, semaphore is can't creat sucess.
for (i = 0; i < FEATURE_CAN_MAX_MB_NUM; i++)     //can_max_mb_num ==96
    {
        osifStat = OSIF_SemaCreate(&state->mbs[i].mbSema, 0U);
        if (osifStat != STATUS_SUCCESS)
        {
            for (j = 0; j < i; j++)
            {
                (void)OSIF_SemaDestroy(&state->mbs[j].mbSema);
            }
            return STATUS_ERROR;
        }
        state->mbs[i].isBlocking = false;
        state->mbs[i].mb_message = NULL;
        state->mbs[i].state = FLEXCAN_MB_IDLE;
    }

 

    /* Store transfer type and DMA channel number used in transfer */
    state->transferType = data->transfer_type;
#if FEATURE_CAN_HAS_DMA_ENABLE
    state->rxFifoDMAChannel = data->rxFifoDMAChannel;
#endif

 

    /* Save runtime structure pointers so irq handler can point to the correct state structure */
    g_flexcanStatePtr[instance] = state;

 

    return (STATUS_SUCCESS);

due to up code don't create 96 semaphore  ,lead an exception is show .

Then I call Flexcan send function to send a standard frame ,the system run to exception 1(IVOR1).

 

Sencond ,I try remove freertos in my project ,FlexCAN initial and flexcan send function is normal,so we think is freertos have some error that lead my flexcan init error.

But we must need adding  freertos to my project,how should i change my freertos configure.

 

Thanks.

Outcomes