CAN PAL - Dev ASSERT Check

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

CAN PAL - Dev ASSERT Check

Jump to solution
821 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) ? 

 

0 Kudos
Reply
1 Solution
796 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @zubizeratta,

I will be supporting your issue over at your other thread in order to prevent any misunderstandings or miscommunications: CAN PAL Dev Assert Issue - NXP Community.

Best regards,
Julián

View solution in original post

0 Kudos
Reply
1 Reply
797 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @zubizeratta,

I will be supporting your issue over at your other thread in order to prevent any misunderstandings or miscommunications: CAN PAL Dev Assert Issue - NXP Community.

Best regards,
Julián

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-1968988%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%3ECAN%20PAL%20-%20Dev%20ASSERT%20Check%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1968988%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3EMCU%3A%20S32K118%3C%2FP%3E%3CP%3ESDK%20%3A%26nbsp%3BS32SDK_S32K1XX_RTM_4.0.1%3C%2FP%3E%3CP%3EIn%20the%20CAN%20Driver%2C%20can_pal.c%20%2C%20Can_AllocateState%20function%20there's%20a%20DEV_ASSERT%20check%20which%20fails%3A%26nbsp%3B%3C%2FP%3E%3CP%3E(NO_OF_FLEXCAN_INSTS_FOR_CAN%20%3D1)%3C%2FP%3E%3CP%3Efor%20(i%20%3D%200%3B%20i%20%26lt%3B%20NO_OF_FLEXCAN_INSTS_FOR_CAN%3B%20i%2B%2B)%3CBR%20%2F%3E%7B%3CBR%20%2F%3Eif%20(isAllocated%5Bi%5D%20%3D%3D%20false)%3CBR%20%2F%3E%7B%3CBR%20%2F%3EinstanceMapping%5Bi%5D%20%3D%20instance%3B%3CBR%20%2F%3EisAllocated%5Bi%5D%20%3D%20true%3B%3CBR%20%2F%3Ebreak%3B%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%7D%3C%2FP%3E%3CP%3Eif%20(i%20%26gt%3B%3D%20NO_OF_FLEXCAN_INSTS_FOR_CAN)%3CBR%20%2F%3E%7B%3CBR%20%2F%3E%2F*%20Should%20Never%20Reach%20Here%20*%2F%3CBR%20%2F%3EDEV_ASSERT(false)%3B%3CBR%20%2F%3Ei%20%3D%20(NO_OF_FLEXCAN_INSTS_FOR_CAN-1U)%3B%3CBR%20%2F%3E%7D%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EEven%20though%20value%20of%201%20is%20valid%20for%26nbsp%3BNO_OF_FLEXCAN_INSTS_FOR_CAN%20I%20don't%20get%20it%20exactly%20why%20it's%20checked%20if%20it's%20equal%20or%20greated%20than%20one.%20Shouldn't%20it%20be%20just%20%22%26gt%3B1)%20%3F%26nbsp%3B%3C%2FP%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1969168%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20CAN%20PAL%20-%20Dev%20ASSERT%20Check%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1969168%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F229964%22%20target%3D%22_blank%22%3E%40zubizeratta%3C%2FA%3E%2C%3C%2FP%3E%0A%3CP%3EI%20will%20be%20supporting%20your%20issue%20over%20at%20your%20other%20thread%20in%20order%20to%20prevent%20any%20misunderstandings%20or%20miscommunications%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2FS32K%2FCAN-PAL-Dev-Assert-Issue%2Fm-p%2F1968987%2Fhighlight%2Ffalse%23M41785%22%20target%3D%22_blank%22%3ECAN%20PAL%20Dev%20Assert%20Issue%20-%20NXP%20Community%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3EBest%20regards%2C%3CBR%20%2F%3EJuli%C3%A1n%3C%2FP%3E%3C%2FLINGO-BODY%3E