• AVR Freaks

Hot!dsPIC33E Bootloader Query

Author
Tupperware
New Member
  • Total Posts : 3
  • Reward points : 0
  • Joined: 2015/08/07 15:07:47
  • Location: 0
  • Status: offline
2018/02/27 14:59:22 (permalink)
0

dsPIC33E Bootloader Query

Hello,
 
I have implemented a CAN-based bootloader for my dsPIC33E based project (high integrity product).  The project uses the approach outlined in the application notes which maps the IVT to a jump table in the main application (bootloader does not use any interrupts).  I am happy that this working as expected and avoids hard-coding too many things into the bootloader although I have to live with the slight increase in latency due to the extra jump.
 
My query relates to the non-maskable interrupt vectors (e.g. stack, DMAC, oscillator etc.). I have handlers defined for these in the main application. However, prior to downloading the application, no handler exists so the exception would cause execution to pass to the jump table which doesn't exist!  To mitigate this problem initially I have ensured that the jump table is filled with zeros when the bootloader hex is downloaded, which should result in a device reset for any of the non-maskable interrupts.  However, this doesn't protect for partial/failed downloads by the bootloader at some point later (e.g. power failure after page erase gives FFs which translate to NOPs so we may end up executing random data in the remainder of flash).
 
What is the recommended way to handle the non-maskable interrupts? Ideally, I think I would perform a device reset whilst in bootloader for any of these exceptions, but run the designated handler when in the main application.
 
Some options I considered:
- locate exception handlers at a fixed address in a common flash page to be loaded with the bootloader but could be reflashed during download (small chance of problems during erase/write) 
- locate exception handlers for the non-maskable interrupts in the bootloader, so they are always present.  This means they can't be changed in the future
 
Thanks
T
#1
du00000001
Just Some Member
  • Total Posts : 3076
  • Reward points : 0
  • Joined: 2016/05/03 13:52:42
  • Location: Germany
  • Status: offline
Re: dsPIC33E Bootloader Query 2018/07/05 12:44:36 (permalink)
0
(Only applicable for the interrupts that cannot be disabled/masked)
  1. Implement a "valid application available" check
  2. Don't jump if you don't have a valid application. Which will require some service implemented in the boot loader itself.
This adds a bit to the non-maskable "events" latency, but this doesn't really matter as these events shouldn't happen under "normal" conditions.

PEBKAC / EBKAC / POBCAK / PICNIC (eventually see en.wikipedia.org)
#2
zimou13
New Member
  • Total Posts : 17
  • Reward points : 0
  • Joined: 2018/02/20 01:04:42
  • Location: 0
  • Status: offline
Re: dsPIC33E Bootloader Query 2018/07/05 14:33:49 (permalink)
2 (2)
Writing to program memory is a two-step process: Erase a full page of program memory and then write the program memory of the erased page using the write latches. The write latches (typically at address 0xFA0000) temporary store instructions. These instructions are then written to the program memory space by writing a key sequence and setting NVMCON to the correct value. The addresses to write are defined by TBLWTH/TBLWTL instructions. Bluestacks TextNow Photomath
post edited by zimou13 - 2018/07/06 12:25:30
#3
adward
New Member
  • Total Posts : 2
  • Reward points : 0
  • Joined: 2019/08/20 22:42:49
  • Location: 0
  • Status: offline
Re: dsPIC33E Bootloader Query 2019/10/10 21:23:11 (permalink)
1 (1)
kcaluwae motor board bootloader is finally working. ... CAN (CANopen) and UART bootloader for Microchip dsPIC33E and related microcontrollers. ...  best power bank under Rs1000
#4
ric
Super Member
  • Total Posts : 23893
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: online
Re: dsPIC33E Bootloader Query 2019/10/13 15:27:37 (permalink)
0
Post#3 and #4 are both SPAM.
Post#3 was reported last year, but is still there...
 

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#5
du00000001
Just Some Member
  • Total Posts : 3076
  • Reward points : 0
  • Joined: 2016/05/03 13:52:42
  • Location: Germany
  • Status: offline
Re: dsPIC33E Bootloader Query 2019/10/13 16:02:11 (permalink)
0
Spam has never been removed. With some luck the "member" gets blocked.

PEBKAC / EBKAC / POBCAK / PICNIC (eventually see en.wikipedia.org)
#6
Jump to:
© 2019 APG vNext Commercial Version 4.5