This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Problem with LPC1768 USB bootloader

Hi,

I have a problem with USB bootloader. I downloaded sample code from NXP site. I followed instructions AN10866.
Bootloader works fine if I load small program into LPC.
This small program uses interrupts.
But If I load large program then interrupts do not work.
Is this a problem with Vector Table? How to check it? Please help.

Parents
  • Hi All,

    in the example from NXP is an error. SP register must be set correctly before jump to the user application. I have changed execute_user_code() function:

    void execute_user_code(void)
    {
            void (*user_code_entry)(void);
    
            /* Change the Vector Table to the USER_FLASH_START
            in case the user application uses interrupts */
    
            volatile const DWORD *stack_adr = 0x00002000;
            volatile const DWORD *start_adr = 0x00002004;
    
            __MSR_MSP(*stack_adr);
    
            NVIC_SetVectorTable(NVIC_VectTab_FLASH, USER_FLASH_START);
    
            user_code_entry = (void (*)(void))(*start_adr);
            user_code_entry();
    
    }
    


    Regards

Reply
  • Hi All,

    in the example from NXP is an error. SP register must be set correctly before jump to the user application. I have changed execute_user_code() function:

    void execute_user_code(void)
    {
            void (*user_code_entry)(void);
    
            /* Change the Vector Table to the USER_FLASH_START
            in case the user application uses interrupts */
    
            volatile const DWORD *stack_adr = 0x00002000;
            volatile const DWORD *start_adr = 0x00002004;
    
            __MSR_MSP(*stack_adr);
    
            NVIC_SetVectorTable(NVIC_VectTab_FLASH, USER_FLASH_START);
    
            user_code_entry = (void (*)(void))(*start_adr);
            user_code_entry();
    
    }
    


    Regards

Children
No data