S32K148 flexcan driver

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

S32K148 flexcan driver

1,250 Views
pranitekatpure
Contributor I
call to function "FLEXCAN_DRV_Init()", global data is getting changed. In debugging it is obsevered that after few iteration of for loop: for (i = 0; i < FEATURE_CAN_MAX_MB_NUM; i++) { 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; } it is changing global variables. Which is leading to a segmentation fault. what could be the reason?
0 Kudos
4 Replies

1,208 Views
pranitekatpure
Contributor I

@Robin_Shen could you help with it.

0 Kudos

1,193 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

I am sorry for not help you.
I am not familiar with this part, maybe you can post this question at S32 Design Studio.
My colleague should be able to help you.

Have you try to right click the mbs[i] and View Memory?

It will show you the address of them. Maybe you can check if there is a conflict with yours.

view memory.png

0 Kudos

1,234 Views
pranitekatpure
Contributor I

Hi Robin_Shen,

I'm sorry I can't share data. Actually I'm using hardware independent library of CAN which is being ported with flexcan drivers. It contains multiple global objects for example object of a structure containing callback function pointers etc. One of my structure object members, which stores pointers to callback functions, are getting changed after the call to FLEXCAN_DRV_init(). I'm observing it as expression while debugging. Is this call overlapping my previously allocated memory, as it allocates 32 state->mbs[i] during run time? Also, is it possible to view the memory of MCU during a run time like FreeRTOS task memory view?

0 Kudos

1,240 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi pranitekatpure,

Would you please show me which global variables was changed?
I don’t understand what the segmentation fault you mentioned is.
If you can capture a picture show it would be better for me to understand it.

FLEXCAN_DRV_Init.png

Best Regards,
Robin

0 Kudos