FlexCAN asserts due to FreeRTOS nesting violation

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

FlexCAN asserts due to FreeRTOS nesting violation

ソリューションへジャンプ
556件の閲覧回数
M_SCH
Contributor III

Hello,

I have the following setup:

  • S32DS v3.5.12
  • RTD (P03, AR v4.7.0, SW v2.0.0)
  • FreeRTOS 10.5.1 v2.0.0
  • S32K148 MCU

I use a project that depends on the following drivers

  • FlexCAN
  • FreeRTOS
  • BaseNXP (selects OsifFreeRtosType)
  • others (may not be relevant to the potential bug)

When I debug the application I observe that it ends up in an assert statement through the following sequence of function calls:

  1. ISR(CAN0_ORED_0_15_MB_IRQHandler)
    1. RTD/src/FlexCAN_Ip_Irq.c at line 214
  2. FlexCAN_IRQHandler( ... )
    1. RTD/src/FlexCAN_Ip.c at line 2926
  3. FlexCAN_IRQHandlerRxMB
    1. RTD/src/FlexCAN_Ip.c at line 1342
  4. can_RX_TX_callback
    1. custom callback for to handle CAN RX/TX events, located inside the project folder
    2. calls FlexCAN_Ip_Receive
  5. FlexCAN_Ip_Receive
    1. RTD/src/FlexCAN_Ip.c at line 2046
  6. FlexCAN_SetMsgBuffIntCmd
    1. RTD/src/FlexCAN_Ip_HwAccess.c at line 1053
  7. SchM_Enter_Can_43_FLEXCAN_CAN_EXCLUSIVE_AREA_18
    1. RTD/src/SchM_Can_43_FLEXCAN.c at line 1125
  8. OsIf_SuspendAllInterrupts
    1. RTD/include/OsIf_Internal.h at line 274
  9. SuspendAllInterrupts
    1. RTD/include/OsIf_Internal.h at line 247
  10. taskENTER_CRITICAL
    1. FreeRTOS/Source/Include/task.h at line 210
  11. portENTER_CRITICAL
    1. FreeRTOS/Source/portable/GCC/ARM_CM4F/portmacro.h at line 105
  12. vPortEnterCritical
    1. FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c at line 425
    2. configASSERT

See also the debug session call sequence

 

M_SCH_0-1720689662553.png

 

 

Now I found a similar ticket where one NXP tech-support employee labels this issue as a bug, which may be resolved in a future RTD package release.

To be sure, can you

  1. confirm that this is a bug in the RTD driver
  2. present a workaround
    1. I have tried to replace the portENTER_CRITICAL call by portENTER_CRITICAL_FROM_ISR (same for the EXIT version) in the local RTD folder in the header file Osif_Internal.h and in the RTD installation folder (S32DS.3.5\S32DS\software\PlatformSDK_S32K1_S32M24\RTD\BaseNXP_TS_T40D2M20I0R0\include\Osif_Internal.h)
      But then I get another build error (Description Resource Path Location Type
      too few arguments to function 'vPortSetBASEPRI' portmacro.h /__FreeRTOS_Toggle_Led_Example_S32K148__/FreeRTOS/Source/portable/GCC/ARM_CM4F line 102 C/C++ Problem)
  3. point out if this is resolved by the RTD P04 package or when you plan to release package which fixes this isse

 

Best regards,

 

M_SCH

ラベル(1)
タグ(3)
0 件の賞賛
返信
1 解決策
509件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport

Hi,

yes, this is RTD issue and will be fixed with next RTD release. It should be version 3.0.0, not sure of the release plan.
Not able to comment more.

BR, Petr

元の投稿で解決策を見る

0 件の賞賛
返信
3 返答(返信)
510件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport

Hi,

yes, this is RTD issue and will be fixed with next RTD release. It should be version 3.0.0, not sure of the release plan.
Not able to comment more.

BR, Petr

0 件の賞賛
返信
485件の閲覧回数
M_SCH
Contributor III

Hello,

one more thing.

My current implementation relies on the FlexCAN_Ip_Receive function using interrupts. Which of the following options would you recommend for a temporary fix:

1. Modify the Osif_Internal.h file (so that it matches the implementation of the RTD AR 4.4.0, SW 1.0.0):

 

#define ResumeAllInterrupts()   ASM_KEYWORD(" cpsie i")
#define SuspendAllInterrupts()  ASM_KEYWORD(" cpsid i")​

 

2. Use FlexCAN_Ip_ReceiveBlocking - keep in mind that I have multiple message buffers to query.

 

 

Best regards,

M_SCH

 

0 件の賞賛
返信
505件の閲覧回数
M_SCH
Contributor III
Hello Petr,

thanks for the information!

Best regards, M_SCH
0 件の賞賛
返信