• AVR Freaks

Hot![Probably solved] PIC32MZ2064DAS176 - executing out of DDR RAM

New Member
  • Total Posts : 3
  • Reward points : 0
  • Joined: 2020/05/04 01:30:17
  • Location: 0
  • Status: offline
2020/09/25 04:37:57 (permalink)

[Probably solved] PIC32MZ2064DAS176 - executing out of DDR RAM

I am facing issue which I seem to be unable to solve.
What I have:
Custom bootloader, which is able to load firmware into one of two flash banks (1 MB per app). This bootloader resides in combined lower and upper boot flash, with reserved areas excluded in linker script.
The application is about 350 kB in size, utilising multiple I2C lanes, 2x framed mode SPIs handling 8 channels of TDM audio (in/out) and another bunch of SPI devices including GLCD and Wiznet W5500. Plus one UART and 7 DMA channels. It uses FreeRTOS with most of internal RAM reserved for it. It uses dynamic allocation for which there is reserved lower 24 MB of DDR2 RAM.
The app is Harmony-free and works fine in either standalone mode, or when loaded through bootloader.
The issue:
Another functinality I would like to get is being able to load "temporary" firmware into upper 8 MB of DDR RAM. This is acomplished by simply copying firmware into correct DDR location and jumping to its reset vector.
I thought I got this working, however after making some (in my opinion) totally unrelated changes to app, It fails to boot out of DDR RAM. Or, to be precise, it does not work as intended. It starts booting, but as soon as it gets to point where FreeRTOS should be started, it simply stops responding and is later rebooted by WDT. When I used some free rtos trace hooks, I was able to determine that first task gets selected, but never executes single line of code.
If I disable UART RX interrupt (which does not appear to be triggered according to my traces), I can see tht RTOS changes context few times and than just stops / freezes.
As I said, strange thing is that if I compile about week old version of my app, it works fine - and the changes made does not look like being able to cause such behaviour. Plus it works just fine out of flash.
I have got Pickit4, but it seems impossible to debug code loaded in such manner.
I am thinking there might be some issues with my "ramloadable" application linker script (I admit I dont really understand them that much):
"ramloadable" linker file:
post edited by Morce323 - 2020/09/25 05:40:02

1 Reply Related Threads

    New Member
    • Total Posts : 3
    • Reward points : 0
    • Joined: 2020/05/04 01:30:17
    • Location: 0
    • Status: offline
    Re: PIC32MZ2064DAS176 - executing out of DDR RAM 2020/09/25 05:39:34 (permalink)
    5 (1)
    I have been trying to solve this for the last two days without success. After posting the question a going through the code once again, I belive I found the solution.
    In bootloader, I hardly use any interrupts - with one exception, millisecond timer to be able to use millis() function. And guess who was not disabling interrupts on transition from boot flash to RAM? Thats right, me. :)
    After disabling interrupts and reenabling them from within RAM application, it all started to work, almost automagically. :)
    My guess would be that the fact it was working with previous app version was pure luck.
    Anyway, thanks to anyone who took time to at least read my topic - and of course, I would still like to get statement on my linkerfile being correct for my pruposes - from anyone whos got at least some linker file knowledge (I deffinitely dont).
    post edited by Morce323 - 2020/09/25 05:44:57
    Jump to:
    © 2020 APG vNext Commercial Version 4.5