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.

TMS320F280041C: TMS320F280041C application going into interrupt illegal operational handler

Part Number: TMS320F280041C

Hi,

I am trying to run flashapi_ex3_live_firmware_update project for RS-485 communication. i have just made changes in the flashapi_ex3_live_firmware_update project for direction pin since RS-485 needs it. Apart from this no changes has been made. When i try to run the application it goes into interrupt illegal operational handler. See below snapshot

Can you please look into the issue?

thanks,

Suhail.B

  • Suhail,

    What specific changes did you make? Please share those.

  • Sira,

    Thanks for the reply. Since i  am tying to implement LFU in single bank i have made below changes

    1. In device.c we have made changes to work for our TMS320F280041C frequency as below: 

        SysCtl_setClock(SYSCTL_OSCSRC_OSC1 |

                        SYSCTL_IMULT(10) |

                        SYSCTL_FMULT_NONE |

                        SYSCTL_SYSDIV(1) |

                        SYSCTL_PLL_ENABLE); 

    See attached device.c file for reference ::: /cfs-file/__key/communityserver-discussions-components-files/171/device.c

    2. We have only SCI-B port available in our TMS320F280041C board. Hence SCI-B port has been configured both in SCI kernel  and flashapi_ex3_live_firmware_update application.

        Since we have RS-485 communication we are trying to perform LFU using SCI-B port. For this communication, direction pin is made high and low while reading or writing form SCI-B port.

    Example i have made below changes where ever applicable in both kernel and ex3 project. Since i don't need timer interrupts i have commented it in ex3 project. Other these changes nothing else modification is made.

     From

        uint16_t byteData = SCI_readCharBlockingNonFIFO(SCIA_BASE);

        SCI_writeCharBlockingNonFIFO(SCIA_BASE, byteData);

    To

        GPIO_writePin(MODBUS_DIRECTION_PIN, GPIO_HIGH_VALUE);// Direction read

        SysCtl_delay(APPLICATION_DELAY);

        uint16_t byteData = SCI_readCharBlockingNonFIFO(SCIB_BASE);

     

    Below definitions has been added

    #define MODBUS_TRANSMIT_PIN    12

    #define MODBUS_RECEIVE_PIN     13

    #define MODBUS_DIRECTION_PIN   11

    #define MODBUS_DIR_WRITE       0

    #define MODBUS_DIR_READ        1

    #define GPIO_HIGH_VALUE     1

    #define GPIO_LOW_VALUE     0

    #define APPLICATION_DELAY (20 * 8.68 * 10 * 16)

    Please see attached files of both SCI kernel and ex3 project for reference:

    SCI kernel files:

    /cfs-file/__key/communityserver-discussions-components-files/171/flashapi_5F00_ex2_5F00_ldfu.c

    /cfs-file/__key/communityserver-discussions-components-files/171/flashapi_5F00_ex2_5F00_sci_5F00_get_5F00_function.c

    Ex3 project file:

    /cfs-file/__key/communityserver-discussions-components-files/171/flashapi_5F00_ex3_5F00_live_5F00_firmware_5F00_update.c

    Let me know for any other details

    Thanks,

    Suhail.B

  • Suhail,

    When you use an SCI boot mode, the only port you are allowed to use is SCIA. SCIB is not allowed.

    Now in this case you are actually not using SCI boot mode, you are using Flash boot and through software you are downloading an image over SCI. So using SCIB I believe is permitted.

    So  I went through the code you modified, only the flow at a high level, and it looks to me like you have changed the pieces that need to be changed. However, as I mentioned, my analysis was not thorough, and this is not something TI can debug for you. You will have to dig in and troubleshoot where the error is occurring.

    Thanks,

    Sira

  • Sira,

    Thanks for the reply. Can you please give little more brief details of SCI boot mode and Flash boot?

    I did troubleshooting about why it is getting into interrupt illegal operational handler i could find that, in single bank LFU we are trying to overwrite application again and again. Once after application jumps to liveDFU() it doesnot know to come back as application in flash bank has been overwritten. Hence once we reset device ,bankselct() should get executed and it will jump to new application image and execution should work fine .

    But i had one observation when i do software reset by clicking restart button in ccs as shown below everything works fine.

    but when i try to reset by disconnecting debugger execution does not works fine. it is getting struck while downloading image.

    So i started to debug further. Initially i thought some initialization is missing when execution jumps to application from bankselect() so i modified bankselect() function as below:

    void bankSelect(void)
    {
    //
    // EntryAddr is used to branch to the kernel setup
    //
    volatile uint32_t EntryAddr;


    //
    // initialize device, driverlib.
    //
    Device_init();

    //
    // init interrupt and vectorTable, driverlib.
    //
    Interrupt_initModule();
    Interrupt_initVectorTable();

    //
    // Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
    //
    EINT;
    ERTM;

    //
    // Initialize the Flash API
    //
    initFlashSectors();
    //
    // If each bank doesn't contain a 'KEY' value, then a bank
    // has not been programmed using the Live DFU command
    //
    if(HWREG((uint32_t)B0_KEY_ADD) != (uint32_t)KEY)
    {
    //
    // Initialize the revision values of each bank and erase data in the
    // key address location.
    //
    revInit();

    //
    // Branch to sciGetFunction so the Live DFU command can be used to
    // program bank 1
    //
    EntryAddr = sciGetFunction(0x01);
    }
    else
    {
    asm(" LB 0x8EFF0");
    }

    }

    Now after bankselcet() modification everything works fine. But i have some questions which i am not able to figure out

    1. What is the difference between device reset by software restart using ccs and device reset by disconnecting the debugger?

    2. Whatever changes i have made in bankselect() is logically correct? Now Every time codestart will perform initialization then it will jump to application image.

    Thanks,

    Suhail.B

  • Suhail,

    I am getting confused as you are mixing up multiple things and aren't clear in your description of where exactly you are and what you are trying to fix.

    1. Offline, I helped you get the single bank LFU functionality working - with interrupts disabled.

    2. Have you now enabled interrupts and running ISR from RAM?

    3. Then you switched to SCIB from SCIA. Has that issue been fixed? 

    4. Then you say that it works with a software reset but not if you disconnect the debugger. What are the steps that were performed prior to this? Did you run a single bank LFU switch? As part of that, there is already a Watchdog reset occurring.

    Flash boot boots the device from Flash, and SCI Boot runs the SCI ROM Bootloader and allows an image to be downloaded via SCI.

    Thanks,

    Sira

  • Sira,

    Thanks for your reply and sorry for confusing much. Please ignore my previous description

    Here are the steps that i followed

    1. Offline, you helped me to get the single bank LFU functionality working - with interrupts disabled. I took this single bank LFU and modified for SCIB port instead of SCIA

    2. I dint enable any interrupts all interrupts are disabled. Whatever code changes i mentioned earlier those are the changes i made in single bank LFU.

    3. I got the RS-485 communication working using SCIB port.

    4. With the above changes mentioned in previous post i was able to perform LFU. For the very first time no image is programmed hence through bankselect(), sciGetFunction() is called and image is flashed onto flash bank 0. After this step i tried to reset the device by disconnecting the debugger application dint start running. Further more i tried to debug and when i did a software reset as shown in below screenshot application started working

    So i started to debug further. Initially i thought some initialization is missing when execution jumps to application from bankselect() so i modified bankselect() function as below:

    void bankSelect(void)
    {
    //
    // EntryAddr is used to branch to the kernel setup
    //
    volatile uint32_t EntryAddr;


    //
    // initialize device, driverlib.
    //
    Device_init();

    //
    // init interrupt and vectorTable, driverlib.
    //
    Interrupt_initModule();
    Interrupt_initVectorTable();

    //
    // Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
    //
    EINT;
    ERTM;

    //
    // Initialize the Flash API
    //
    initFlashSectors();
    //
    // If each bank doesn't contain a 'KEY' value, then a bank
    // has not been programmed using the Live DFU command
    //
    if(HWREG((uint32_t)B0_KEY_ADD) != (uint32_t)KEY)
    {
    //
    // Initialize the revision values of each bank and erase data in the
    // key address location.
    //
    revInit();

    //
    // Branch to sciGetFunction so the Live DFU command can be used to
    // program bank 1
    //
    EntryAddr = sciGetFunction(0x01);
    }
    else
    {
    asm(" LB 0x8EFF0");
    }

    }

    Now after bankselcet() modification as mentioned above, everything works fine. Even if i disconnect debugger or i do software reset both works fine.

    But i have some questions which i am not able to figure out. Hope i am not confusing again.. Please let me know for any other details

    1. What is the difference between device reset by software restart using ccs and device reset by disconnecting the debugger?

    2. Whatever changes i have made in bankselect() is logically correct? i feel Every time codestart will perform initialization and then it will jump to application image.

    Thanks,

    Suhail.B

  • Suhail,

    This is the part I am not clear about.

    I thought that the single bank LFU implementation with interrupts disabled, and Watchdog reset enabled in the Ex2 SCI kernel (using SCIA) works without any issue i.e. with the existing bankselect() function in Ex2. And by works I mean, you program the kernel, then the app image, disconnect the debugger, reset the board, then are able to run successive LFU updates.

    Am I correct or not?

  • Sira,

    Thanks. Yes single bank LFU implementation with interrupts disabled, and Watchdog reset enabled in the Ex2 SCI kernel (using SCIA) works without any issue i.e. with the existing bankselect() function in Ex2. 

    I have only configured and modified it for SCIB as required by my project. It was not able to run the application hence after i changed the bankselect() function as i mentioned it is working fine with my actual application project .

    Now it works with bankselect() function changes ,but i am not sure whatever modification i did are fine or not. That is where i need your suggestion. Please let me know your inputs

    Thanks,

    Suhail.B

  • Suhail,

    Ok, now it is clear that the changes you made were necessitated with the move from SCIA to SCIB. This is quite odd, and I don't  understand why this is required. In your previous messages, you showed how you made the changes in Ex2 from SCIA to SCIB. Likewise, did you make changes in Ex3 from SCIA to SCIB? (in main() and the numerous SCI functions like sciaflush(), sciack(), scinak(), sciarxisr(), sciagetonlyworddata())?

    Sira

  • Suhail,

    Ok good. But as I mentioned before, if this was done correctly, I am not sure why this workaround would be required. I would advise you to debug why this is required. The fact that you need the Ex2 kernel to run all the init steps that normally the Ex3 App runs tells me there might be something missing from Ex3 (after you made your changes). Just a thought.

    Thanks,

    Sira