Interrupts not working after loading app with bootloader

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Interrupts not working after loading app with bootloader

976 Views
cavebiker
Contributor V

Hey Fellow Embedded People,

Running this on a K20DX256ZVMD10 using MQX4.0 and CW10.3

I have an app using an interrupt from SPI and everything works great if I load and start the app from address 0x0000_0000. I put the SPI interrupt ISR vector directly into vectors.c

Next, I fired up the MSD bootloader to bootload starting at address 0x0000_C000.

Next, in the app:

Set '#define MQX_ROM_VECTORS   0' in user_config.h and small_ram_config.h

Changed intflash.lcf to:

   vectorrom   (RX): ORIGIN = 0x0000C000, LENGTH = 0x00000400  # TJ changed from 0000 to C000

   cfmprotrom  (RX): ORIGIN = 0x0000C400, LENGTH = 0x00000020  # TJ changed from 0400 to C400

   rom         (RX): ORIGIN = 0x0000C420, LENGTH = 0x00033BE0  # Code + Const data TJ changed from 0420 to C420, & 3FBE0 to 33BE0

   ram         (RW): ORIGIN = 0x1FFF8000, LENGTH = 0x00010000  # SRAM - RW data

   3. Cleaned the project and re-built.

Now, after I load the application with the bootloader and restart, the application loads and runs but the SPI interrupt never gets serviced.

Looking at the SRAM area where the vector table should have been copied to, address 0x1FFF_8000, I do not see my SPI ISR vector in the table. ??? n

Any ideas or help is much appreciated.

Cheers,

Tom

0 Kudos
3 Replies

617 Views
cavebiker
Contributor V

I copied my SPI2 interrupt vector from address 0x0000_C0B0 in FLASH to the SRAM vector area at 0x1FFF_80B0 and now everything works (SPI2 is my only external interrupt).

So the only thing MQX is not doing for me is automatically copying my external interrupt vectors to the SRAM area.

Does anyone know of a way to fix this problem without adding code to manually copy the vectors to SRAM?

Thanks in advance.

Cheers,

Tom

0 Kudos

617 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi Tom,

Actually, MQX automatically installs the spi isr when it initializes this module, please kindly refer to the following for details.

1.PNG.png

You may set a breakpoint there to see if the ISR copy done correctly by step trace for your case. if you want to use a custom ISR instead, you may install it after that with the api _int_install_isr().

2.PNG.png

Hope that helps,

B.R

Kan

617 Views
cavebiker
Contributor V

I am using a baremetal ISR here (I modified the vectors.c and hard-coded my ISR there)

The solution here was adding this code at the start of the application:

#ifdef BOOTLOADER_ENABLE
// Copy Application Stored Interrupt Vector table for SPI2 to SRAM
pdst=(uint_32*)0x1FFF80B0;     // SPI2 interrupt vector in SRAM.  
psrc=(uint_32*)0x0000C0B0;     // SPI2 interrupt vector in Flash.
for (i=0;i<0x1;i++,pdst++,psrc++) 
{
    *pdst=*psrc;
}

#endif

BUT this was using MQX 3.8. Now I'm using MQX 4.0 and I'm having the same problems.

0 Kudos