Hot!Harmony & FreeRTOS: no CAN receive IRQ -> crash

Author
Lifebook
New Member
  • Total Posts : 5
  • Reward points : 0
  • Joined: 2011/05/03 05:39:44
  • Location: 0
  • Status: offline
2017/01/25 07:54:05 (permalink)
0

Harmony & FreeRTOS: no CAN receive IRQ -> crash

Hello,
 
I am running FreeRTOS and Harmony 1.10. I want to get an IRQ when a CAN message is received, but everyting crashes and I am not able to debug in the IRQ. My Device is a MX795.
 
 
void IntHandlerDrvCANInstance0(void)
{
    message = (CAN_RX_MSG_BUFFER *)PLIB_CAN_ReceivedMessageGet(CAN_ID_1, CAN_CHANNEL0);
    SYS_PORTS_PinToggle(PORTS_ID_0, PORT_CHANNEL_E, PORTS_BIT_POS_3);
    PLIB_CAN_ChannelUpdate(CAN_ID_1, CAN_CHANNEL0);
    PLIB_INT_SourceFlagClear(INT_ID_0, INT_SOURCE_CAN_1);
}

 
Any ideas? I am a litte bit lost...
Without FreeRTOS everything works fine.
 
Thanks!
#1

10 Replies Related Threads

    Fire8lade
    New Member
    • Total Posts : 13
    • Reward points : 0
    • Joined: 2016/09/15 05:28:33
    • Location: 0
    • Status: offline
    Re: Harmony & FreeRTOS: no CAN receive IRQ -> crash 2017/01/25 22:42:15 (permalink)
    0
    A while back I was also trying to use FreeRTOS together with CAN bus in Harmony v1.08 and had the same issue. I eventually took out the FreeRTOS and like you said the CAN bus worked. Mine would even transmit.
    #2
    Lifebook
    New Member
    • Total Posts : 5
    • Reward points : 0
    • Joined: 2011/05/03 05:39:44
    • Location: 0
    • Status: offline
    Re: Harmony & FreeRTOS: no CAN receive IRQ -> crash 2017/01/26 04:06:23 (permalink)
    0
    I tried Harmony 1.08 too with FreeRTOS 8 but that does not change anything.
    Sending is no problem (I do not use IRQs for sending).
    #3
    Vladimir Milosavljevic
    New Member
    • Total Posts : 18
    • Reward points : 0
    • Joined: 2014/10/03 09:19:00
    • Location: 0
    • Status: offline
    Re: Harmony & FreeRTOS: no CAN receive IRQ -> crash 2017/09/25 12:41:24 (permalink)
    0
    I have exactly the same problem on PIC32MZ device.
    Everything works fine without FreeRTOS, but resets device if it is used in CAN RX interrupt..
    For me also Transmission of CAN is working fine even with FreeRTOS since it is not using interrupts..
     
    Removing RTOS is not an option for me.
     
    Can you please share how did you solve this?
    Maybe small code snippet?
     
    I believe this might be a bug for Harmony + FreeRTOS. Maybe someone from Microchip support can confirm this?
    Is Harmony generating code for CAN that is compliant with FreeRTOS?
     
    Basic example for CAN "echo" can be easily used to check this behavior.
     
    Thank you!
     
    #4
    NKurzman
    A Guy on the Net
    • Total Posts : 15134
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: online
    Re: Harmony & FreeRTOS: no CAN receive IRQ -> crash 2017/09/25 16:58:31 (permalink)
    0
    What Version of Harmony are you Using?
    #5
    Vladimir Milosavljevic
    New Member
    • Total Posts : 18
    • Reward points : 0
    • Joined: 2014/10/03 09:19:00
    • Location: 0
    • Status: offline
    Re: Harmony & FreeRTOS: no CAN receive IRQ -> crash 2017/09/26 06:27:10 (permalink)
    0
    I used Harmony 1.11
    #6
    NKurzman
    A Guy on the Net
    • Total Posts : 15134
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: online
    Re: Harmony & FreeRTOS: no CAN receive IRQ -> crash 2017/09/26 09:52:48 (permalink)
    0
    V1.11 is end of life.  They will not be fixing any bugs in it.
     
    Options.
    1. Move to V2.04 and see if they fixed it.
    2. Find the Issue and Fix it yourself.
    3. Do not use their driver, code the CAN Bus your self.
     
    #7
    Vladimir Milosavljevic
    New Member
    • Total Posts : 18
    • Reward points : 0
    • Joined: 2014/10/03 09:19:00
    • Location: 0
    • Status: offline
    Re: Harmony & FreeRTOS: no CAN receive IRQ -> crash 2017/09/26 12:46:05 (permalink)
    0
    I did tested V2.04 and have even worse situation. Cannon run non RTOS version of CAN example. At least receiving CAN messages is not working. The only modification is that I selected RF4 RF5 as C1TX and C1RX pins using MHC and rebuild it. same thing I did at V1.11 and there it worked without FreeRTOS but here it doesn't work.. Did anyone tried any CAN example using "PIC32MZ Embedded Connectivity with Floating Point Unit (EF) Starter Kit" and managed to make it work on new Harmony version?
    #8
    nhaodzo
    New Member
    • Total Posts : 1
    • Reward points : 0
    • Joined: 2017/10/25 14:22:37
    • Location: 0
    • Status: offline
    Re: Harmony & FreeRTOS: no CAN receive IRQ -> crash 2017/12/07 08:05:57 (permalink)
    0
    I have the same problem, but with USART RX interrupt. I run the "uart_basic" example:
    - No OS, no interrupt: fine!
    - No OS, with interrupt: fine!
    - FreeRTOS, no interrupt: fine!
    - FreeRTOS, with interrupt: code hang!
    I'm using PIC32MZ EF Starterkit, MPLAB v4.00, Harmony V2.04, FreeRTOS 9.0.0
    #9
    jcandle
    Super Member
    • Total Posts : 218
    • Reward points : 0
    • Joined: 2011/09/19 22:01:53
    • Location: 0
    • Status: offline
    Re: Harmony & FreeRTOS: no CAN receive IRQ -> crash 2017/12/08 05:56:19 (permalink)
    0
    Vladimir, if you modified an example's pins, did you save the new config as its own BSP?  the 2.04 examples seem to revise pin selections based on bsp scripts.  Check the system definition file's pps lines to make sure it did what you think it did.
    #10
    Aiden.Morrison
    Super Member
    • Total Posts : 729
    • Reward points : 0
    • Joined: 2005/02/25 11:18:31
    • Location: Canada
    • Status: offline
    Re: Harmony & FreeRTOS: no CAN receive IRQ -> crash 2017/12/13 03:57:09 (permalink)
    0
    Harmony is in general not tested with the OS options and many of the peripherals.  I have run in to exactly this problem with the new and improved Harmony 2.0 where the USB demos crash when FreeRTOS is included in the project.  
     
    Looking deeper in to the generated code it looked like the ISR wrappers that FreeRTOS needs were properly generated, so there must be a deeper bug in Harmony.  The fact that it impacts multiple peripherals suggests that it's a common flaw in the code generation.
     
    Somewhat frustrating that 'version 2.0'+ is still thoroughly beta.
    #11
    Jump to:
    © 2017 APG vNext Commercial Version 4.5