This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to Disable/remap Interrupts for a Bootloader

Other Parts Discussed in Thread: TMS320F28035, CONTROLSUITE

Hello!

I'm currently working on a Boootloader fro TMS320F28035 and finally reaching the end!

I'm trying to jump from my Bootloader to the main of my application, but I get some interrupts. How could I disable the interrupts before trying to jump to the new App?

I've read some documents saying that I should redo the mapping of my interrupts but my application is reloading it so it should be fine. My problem is that I don't seem to attain the application because of the interrupts.

I have the "interrupt void  TINT0_ISR(void)" showing up when I try to launch the app. Somebody have ever encountered this?

Thank you!

  • Hi Simon!

    And did you not accidentally forget to disable WD timer?

    EALLOW ;Enable EALLOW protected register access
    MOVZ DP, #7029h>>6 ;Set data page for WDCR register
    MOV @7029h, #0068h ;Set WDDIS bit in WDCR to disable WD
    EDIS ;Disable EALLOW protected register access

    Regards,

    Igor

  • No, it is disabled for the whole Bootloader

  • Hi!

    Did you use own interrupt handler of Timer0 or the interrupt handler by default? Perhaps the problem is at this (refer to DSP2803x_DefaultIsr.c):

    // INT1.7
    __interrupt void TINT0_ISR(void) // CPU-Timer 0
    {
    // Insert ISR Code here

    // To receive more interrupts from this PIE group, acknowledge this interrupt
    // PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;

    // Next two lines for debug only to halt the processor here
    // Remove after inserting ISR Code
    __asm (" ESTOP0");
    for(;;);
    }

    Regards,

    Igor

  • Hello Igor, 

    I tried your code (and some other) and I finally reach my application, but it does nothing...

    It's supposed to toggle a Led on the interruption by Timer0 (the same one we had problem with when trying to jump). Do you think it does not reactivate? Or is it that that mapping of the interrupt vector is not done properly?

    Regards, 

    Simon Brethous.

  • Hi Simon!

    Could you please attach your source code of application?

    Regards,

    Igor 

  • volatile int fla = 0;

    void main(void) {

    Cpu_Init();

    EALLOW;
    SysCtrlRegs.PCLKCR3.bit.GPIOINENCLK = 1;
    GpioCtrlRegs.GPAMUX1.bit.GPIO1 = 0;
    GpioCtrlRegs.GPADIR.bit.GPIO1 = 1;
    EDIS;
    initCan(bitRate);

    init_Library();


    Start_CAN();


    while (err == CO_FALSE) {
    FlushMbox(); // Do the CANopen job
    err = endLoop();

    if (fla == 1) {

    EALLOW;

    DSP28x_DisableInt();
    EDIS;

    EALLOW;
        SysCtrlRegs.WDCR = 0x0068;
        EDIS;
        // disable interrupts
        DINT;


    UNSIGNED32 locEntryAddr = (0x3E8952);
    (*((void(*)(void))locEntryAddr))();

    fla=0;


    }

    }

    printf("\nSTOP\n");

    while (1);
    }

    void Flag1(void) {
    fla = 1;

    }

    The function Flag1() is called from the interruption. We do the jump only when coming back to the main loop.

    I think the main problem come from the application (not the bootloader). The interrupts called by the application must still be mapped to the Bootloader, but I don't know how to change that

    Regards, 

    Simon Brethous

  • Hi!

    Simon Brethous1 said:

    The function Flag1() is called from the interruption. 

    From what interrupt handler?

    Regards,

    Igor

  • I don't really know, it's a CANOpen intterupt, but I don't think it is really relevant because I'm not executing my jump from this intterupt. I you really need it I can try to look for it but it could take a while...

  • Hi Simon!

    Just I so far do not understand how your application should work and how you use timer0 interrupt handler and where you initialize timer0 (or you don't use it? but when the INT0 takes place - is it default interrupt handler?). Well if you don't want take time then you might no look for where "void Flag1(void)" is called... But if there is no understanding of how all that should work then it is very difficult to give useful advice.

    Regards,

    Igor

  • Hi, 

    Sorry if I angered ou, it wasn't on purpose. My void Flag1() function is called from a CANOpen interrupt, and I don't really know how it is intialized, I have the whole library CANOpen but I'm not allowed to modify the code, so I don't look into it. I just have the rights to write in a callback function, and that's where I call the Flas1().

    The timer 0 isn't initialized in my bootloader code, but in my application code, that's why when I launch my application (with a jump to main) that the timer0 is initialized. But because the vector table Interrupt is the one from the bootloader I got an error.

  • Hi!

    Ok. But I would like return to my main question. You initialize timer0 at your application. But what about interrupt handler of timer0. This interrupt handler by default (from DSP2803x_DefaultIsr.c) or you assign own interrupt handler for timer0?

    Regards,

    Igor 

  • Hi!

    Sorry for the late answer.

    interrupt void timer0(){
    GPIO33Toggle();
    GPIO34Toggle();
    PieCtrlRegs.PIEACK.bit.ACK1 = 1;
    }

    This is the interrupt handler in my application, but it's not the one whos is called due to the problem of interrupt vector mapping.

  • Hi Simon!

    1 You have written that you do the jumping to your application successfuly (are you sure exactly? how do you make sure this?).

    2 You have written that after the jumping your application does nothing. How do you make sure this? (through GPIO33/34Toggle();? with oscilloscope?

    3 What PIE-vector do you assign for your timer0 handler at your application? 

    PieVectTable.TINT0 = &timer0; or NOT?

    4 What interval do you set for timer0:

    ConfigCpuTimer(&CpuTimer0, ??, ??);

    5 Did you use the example from ti\controlSUITE\device_support\f2803x\v127\DSP2803x_examples_ccsv5\cpu_timer\ for development of your source code.

    Regards,

    Igor

  • Hi!

    1) I'm sure about the jumping to the application. I tried Step by step and after that I saw that the running enters a "while" loop (I checked by comparison with the code loaded directly by CCS)

    2) The application do the initializations and then is stuck in a loop while the interrupt on timer0 toggle the leds. When I say it's not working I mean that the leds don't change state.

    3) I'm not sure I really understand your question :s

    4)

    CpuTimer0Regs.TCR.bit.TSS = 1;
     
    DINT;
    CpuTimer0Regs.TCR.bit.TIF = 1;
    PieCtrlRegs.PIEACK.bit.ACK1 = 1;
    IER |= 1;
    PieVectTable.TINT0 = timer0;
    CpuTimer0Regs.TCR.bit.TIE = 1;
    PieCtrlRegs.PIEIER1.bit.INTx7 = 1;
    EINT;

    The timer is set for 0.5 or 1s

    5) The initialization af the timer was done by someone else, I juste checked that it was working

    Regards, 

    Simon

  • Hi Simon!

    Ok. You have understood me and answered all my questions. Thanks. So.

    1 What is loop in which your code is hanging:

    a) while (err == CO_FALSE) or b) while(1)?

    2 Do not you think that you go out of this loop "while (err == CO_FALSE)"  with "all interrupts disabled"? At least it is not clear where interrupts are enabled again.

    3 Also try comment "printf("\nSTOP\n");". Sometimes there were some problem with that. More on that later...

    Regards,

    Igor

  • Hi Igor, 

    I finally found the solution to my problem. I wasn't jumping on the right address. I was jumping at the address of the main of my application while I should have jumped at the codeStart address of my application. The addresses can be found in the .map of the compiled project. After that the new application will initialize the interrupt vector by itself.

    Thanks for your help anyway!

    Regards, 

    Simon brethous

  • Hi Simon!

    I was glad to help and I'm glad you found a solution. You have to be careful when you work with addresses directly.

    Regards,

    Igor