CAN PAL Dev Assert Issue

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CAN PAL Dev Assert Issue

Jump to solution
392 Views
zubizeratta
Contributor II

Hello,

MCU: S32K118

SDK : S32SDK_S32K1XX_RTM_4.0.1

In the CAN Driver, can_pal.c , Can_AllocateState function there's a DEV_ASSERT check which fails: 

(NO_OF_FLEXCAN_INSTS_FOR_CAN =1)

for (i = 0; i < NO_OF_FLEXCAN_INSTS_FOR_CAN; i++)
{
if (isAllocated[i] == false)
{
instanceMapping[i] = instance;
isAllocated[i] = true;
break;
}
}

if (i >= NO_OF_FLEXCAN_INSTS_FOR_CAN)
{
/* Should Never Reach Here */
DEV_ASSERT(false);
i = (NO_OF_FLEXCAN_INSTS_FOR_CAN-1U);
}

 

Even though value of 1 is valid for NO_OF_FLEXCAN_INSTS_FOR_CAN I don't get it exactly why it's checked if it's equal or greated than one. Shouldn't it be just ">1) ? 

 

Tags (2)
0 Kudos
Reply
1 Solution
375 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @zubizeratta,

The second part of the CAN_AllocateState function should never be reached if the structure selected for allocating is available/correctly defined. It simply checks if the previous for cycle failed to allocate any of the available structures to the instances, hence the break statement in order to exit the function.

Have you correctly configured the instance to initialize in the CAN_Init function? Please refer to the example if needed:

Julin_AragnM_0-1728410534509.png

Best regards,
Julián

View solution in original post

0 Kudos
Reply
2 Replies
376 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @zubizeratta,

The second part of the CAN_AllocateState function should never be reached if the structure selected for allocating is available/correctly defined. It simply checks if the previous for cycle failed to allocate any of the available structures to the instances, hence the break statement in order to exit the function.

Have you correctly configured the instance to initialize in the CAN_Init function? Please refer to the example if needed:

Julin_AragnM_0-1728410534509.png

Best regards,
Julián

0 Kudos
Reply
362 Views
zubizeratta
Contributor II

Hi Julián,

It seems to be allocated but I will check again if something is wrong . Thanks.

zubizeratta_0-1728455713988.pngzubizeratta_1-1728455734907.png

 

0 Kudos
Reply