1.8.2 Fixed Location Alternate Interrupt Vector Table Devices

On some of the PIC24/dsPIC33 devices, there is an Alternate Interrupt Vector Table(AIVT). The behavior of the AIVT is identical to the IVT discussed before except that it does not have the reset vector. The AIVT is enabled by setting the AIVT enable bit. When this bit is set, all interrupts will use the (AIVT) table to determine which ISR to vector call instead of the default IVT discussed above. You cannot have both tables enabled at the same time.

 

 

By having two tables, the bootloader can use the AIVT and allow the application to use the IVT completely independently of each other since these are completely independent from each other. This simplifies the requirements on the designer. On a device with an AIVT, the designer does not need to decide if an interrupt needs to go to the bootloader or the application at design time or handle how to share the interrupt if it is required in both.

For these devices, the bootloader will use one mode and the application will use the other. Which table is used is controlled by the AIVT enable it. In many PIC24F/dsPIC33 an application remap table is still required. In many of these devices the AIVT is located in the first erase page of the device in the same page as the reset vector. This makes it impossible to update the AIVT table without risking destroying the device.

A predefined Application Interrupt Remap Table is created in the user application space at a fixed address. Each entry in the table contains a GOTO instruction that jumps to the actual application interrupt handler for the interrupt. Then each interrupt in the IVT would be programmed with the address of the corresponding table entry in the remap table. The Application Interrupt Remap Table can now be built when the application is built and the location and size or location of the actual Application interrupt handlers are no longer an issue. The interrupts will automatically get forwarded to the handler function when they occur.

Below is an example diagram that shows the bootloader and the application both using UART1 interrupts. Since there are two separate tables, each can have their own interrupt table and thus use the interrupts. The IVT is remapped to the application. The AIVT directly jumps to the bootloader interrupt functions.

 

In the example above, the interrupt table is remapped to the application space as before, but if the bootloader needs to use interrupts, it can use them without worry of conflict with the application. When an interrupt occurs, the bootloader can use it. Without an AIVT table, using an interrupt in both the application and the bootloader is more complex to implement requiring coupling between the application and bootloader.