• AVR Freaks

Hot!Bootloader PIC24FJ1024GA606 App ISR issues

Author
vrJonas
New Member
  • Total Posts : 4
  • Reward points : 0
  • Status: offline
2020/10/15 22:29:43 (permalink)
0

Bootloader PIC24FJ1024GA606 App ISR issues

Hi,
 
I'm currently trying to get a serial bootloader running for the PIC24FJ1024GA606. The bootloader is based on AN1157 and has been running without issues on the PIC24FJ128GA204 we use in other projects for years.
I have modified linker scripts for both the bootloader and the app part. They are based on working examples of the PIC24FJ128GA204 but with PIC24FJ1024GA606 linker scripts.

I can successfully flash a combined hex onto the MCU and it runs through the bootloader and jumps to the app. The app runs as it should as long as I don't use interrupts. As soon as an ISR is triggered I get a reset, it then runs through the bootloader again, jumps to the app and then again resets when the ISR is called.
 
Project details:
  • MCU runs in single partition mode
  • no AIVT, no boot segment active
  • App includes bootloader as loadable to create a combined hex
  • XC16 v1.50
  • MPLAB X v5.40
Some details for the bootloader part:
  • Bootloader starts at 0x100 (original origin of the unmodified linker script) and ends at 0x1800-1 (length 0x1700)
  • The app starts at 0x1800
  • IVT is modified to point to a location in a jump table in app code (interrupt vector method 2 in AN1157)
  • Compiler linker flag --no-ivt is set
Details for the app part:
  • App program starts at 0x1800 which is the start of the jump table for the remapped IVT
  • App itself starts at 0x1988 (just after table)
  • I have a method that populates the jump table with gotos to the ISR handles (as suggested in AN1157)
  • Compiler linker flag --no-ivt is set
I can't figure out why the MCU is reset when an ISR is called. The same principle for the linker scripts and IVT jump table is applied for the PIC24FJ128GA204 and there it works without issues.
 
I attached both linker scripts as well as the ISR handles file to this post. Any help is greatly appreciated.
 
Regards,
Jonas
post edited by vrJonas - 2020/10/17 06:15:06
#1

5 Replies Related Threads

    BobAGI
    Super Member
    • Total Posts : 1734
    • Reward points : 0
    • Joined: 2011/03/09 00:04:35
    • Location: Texas and Sweden
    • Status: offline
    Re: Bootloader PIC24FJ1024GA606 ISR issues 2020/10/16 13:28:04 (permalink)
    5 (1)
    I have not looked at your code (no time), but the AN1157 BL does not need interrupt driven serial comm, in fact it should NOT use any interrupts at all. Then your application interrupts will be all vectors there are and no problems. I suspect you have used an interrupt in your BL code? If so, get rid of it.
     
    Here is a link to a post I wrote back in 2014 with further links.
     
    post edited by BobAGI - 2020/10/16 22:17:37

    --
    Bo B
    Sweden & Texas
     
    #2
    vrJonas
    New Member
    • Total Posts : 4
    • Reward points : 0
    • Status: offline
    Re: Bootloader PIC24FJ1024GA606 ISR issues 2020/10/17 06:14:22 (permalink)
    3 (1)
    The bootloader does not use interrupts, but I'll check just to make sure.
    Maybe this title wasn't the best choice :-) (modified it ;-))
     
    Thanks for the link. I think I've read most if not all of your posts in this forum up and down and tried a few of your methods and linker scripts. But couldn't get it to work. I've been scratching my head, because this method of bootloader and app works flawlessly on the PIC24FJ128GA204 we use. The bootloader code is pretty much the same, just modified to suit the other MCU (pin config, some defines, ...). For the app I created a new most basic project. Just 1 timer and a blinking LED. So, I can rule out any other issues.
     
    I'm pretty convinced that the solution to make it work is quite banal. I'm just not seeing it.
    post edited by vrJonas - 2020/10/17 06:15:54
    #3
    BobAGI
    Super Member
    • Total Posts : 1734
    • Reward points : 0
    • Joined: 2011/03/09 00:04:35
    • Location: Texas and Sweden
    • Status: offline
    Re: Bootloader PIC24FJ1024GA606 ISR issues 2020/10/17 08:58:48 (permalink)
    0
    vrJonas
    The bootloader code is pretty much the same, just modified to suit the other MCU (pin config, some defines, ...). For the app I created a new most basic project.

    Maybe it is this:
    On the PIC24 I was using it turns out that following reset the pin config is a one-time thing unless one configures it away in the control bits of the CPU so that you can define a pin more than once.
    I had to do that in order to get my projects working because inside the boot loader it was set one way and then in the application I needed different pin configs.
    But since it is 6 years back I don't remember exactly what the code to do that looked like...

    --
    Bo B
    Sweden & Texas
     
    #4
    vrJonas
    New Member
    • Total Posts : 4
    • Reward points : 0
    • Status: offline
    Re: Bootloader PIC24FJ1024GA606 ISR issues 2020/10/17 13:21:20 (permalink)
    0
    Yes, I read that in a few posts. If you're using MCC, then it's the last code line in the pin_manager.c module (I think) that locks the PPS.
     
    I set the config to allow for multiple reconfigurations, so that this wouldn't become an issue. Also, the LED is already configures as such in the bootloader. The app config for that pin is the same.
    #5
    vrJonas
    New Member
    • Total Posts : 4
    • Reward points : 0
    • Status: offline
    Re: Bootloader PIC24FJ1024GA606 ISR issues 2020/11/08 23:31:36 (permalink)
    0
    I put this issue aside for a while but want to pick it up again. Has anyone any ideas I could try or where I should take a look?
    Anything is appreciated.
    #6
    Jump to:
    © 2020 APG vNext Commercial Version 4.5