DT Instant Interrupt and Bootloader


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2006
    Location
    Italy
    Posts
    72

    Default DT Instant Interrupt and Bootloader

    Good morning,
    I'm facing a problem using DT instant interrupts and a bootloader I've wrote by myself using PBP.
    The chip I'm using is a 18F4685 and the bootloader is located at the bottom of the memory map, about 0x17620.

    I'm going to the bootloader section using a @ goto 0x17620 from the main program.
    The problem is that the bootloader keep resetting the chip. I suppose because there is still some interrupt vector mapped because of the use of the DT instant interrupts.

    If I move in the other way round, meaning the bootloader on the top and the main program at 0x00B00, everything SEEMS to works as expected: bootloader correctly do the job, the main program too.... BUT DT instant interrupts does not fire anymore.
    Probably because at location 0x0008 there is something else, related to the code of the bootloader...

    So, the question is:
    How to use the DT instant interrupts into the main program, once the main program has been relocated by the directive RESET_ORG?
    OR
    How to keep the main program on the top of the memory (so the DT interrupts are happy) but preventing them to destroy the path of the bootloader? Can I disable the instant interrupts in the bootloader code?

    P.S. The instant interrupts I've enabled are 2: TMR1_INT (every 100ms) and RX_INT.

    Best regards, and thank in advance.

    Mike.

  2. #2
    Join Date
    Sep 2009
    Posts
    737


    Did you find this post helpful? Yes | No

    Default Re: DT Instant Interrupt and Bootloader

    You must disable int before entering bootloader. And to exit from bootloader just execute @ RESET, and you are back on ORG 0, and your main program will setup interrupts again, same way as it setup when device is power on.
    Just keep in mind that you have some data in RAM from bootloader, so putting CLEAR in your main program is good idea.

  3. #3
    Join Date
    Aug 2006
    Location
    Italy
    Posts
    72


    Did you find this post helpful? Yes | No

    Default Re: DT Instant Interrupt and Bootloader

    Hi pedja089,
    I did the whole process EXACTLY as you described.
    The things I've missed was to disable the interrupt before go to the bootloader.
    Probably, the reason why I did not disabled it, is because I thought that since the "@ goto xxxx" happen BEFORE any "@ INT_ENABLE TMR1_INT", this was enough to avoid the interrupt handler.
    Seems that is needed to call "@ INT_DISABLE TMR1_INT" even if is not specifically enabled before. Doing that... IT WORKS!
    Thank you.

    So, here is the trick:
    Code:
         READ 836,x
         if x = 1 then      'There is a firmware update available
            SEROUT2 PORTD.4,6,[13,10,"Update process start...",13,10]
    @ INT_DISABLE TMR1_INT
    @ INT_DISABLE RX_INT
            INTCON.7 = 0    'Disable Global Interrupt
            INTCON.6 = 0
            PIE1.5 = 0      'Disable USART RX Interrupt
            T1CON.0 = 0     'Disable Timer1
    @ goto 0x17680          'This is where my bootloader start
         endif
    Thank you again for the suggestions.

  4. #4
    Join Date
    Sep 2009
    Posts
    737


    Did you find this post helpful? Yes | No

    Default Re: DT Instant Interrupt and Bootloader

    I'm glad that I could help.
    Also keep in mind that when you enter bootloader your registers are not in reset state. So I always disable interrupt and timers in bootloader.

Similar Threads

  1. Instant Interrupt and USART
    By sirvo in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 23rd July 2008, 04:08
  2. DT Instant Interrupt counting
    By jderson in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 9th March 2008, 23:47
  3. Usart with Darrel Instant Interrupt
    By Pedro Pinto in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 17th February 2008, 01:09
  4. Bootloader and Instant Interrupts Atn:_DT_
    By Josuetas in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 16th May 2007, 02:59
  5. Instant Interrupt Error
    By cool_justin in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 9th June 2006, 00:40

Members who have read this thread : 1

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts