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.

TMDSCNCD280049C: f280049C sci kernel downloading failure while using serial_flash_programmer

Part Number: TMDSCNCD280049C
Other Parts Discussed in Thread: TMDSHSECDOCK

Good afternoon, 

I'm following the document named "C2000 software Controlled Firmware Update Process". 

I had a trouble while following "4.3 Firmware Update Process" step. 

It seemed like signal doesn't transfer or receive anymore after tried one time. 

Here is the situation I am investigating. 

1. slow blinking LED example(led_ex1_blinky) is running in flash of MCU.

2. GPIO 15 (pin 63 in TMDSHSECDOCK) is connected with 1k resistor and 10nF capacitor in series and endpoint of capacitor is connected with GND pin in dock.   

2. so D2 in ControlCARD's LED(GPIO 31) is bliinking now.

3. Open the CMD and type "serial_flash_programmer.exe -d f28004x -k flashapi_ex2_sci_kernel.txt -a led_ex1_blinky.txt -b 9600 -p COM10"

4. I can see the figure above. 

I did this same thing with F28379d by following the document named "Serial Flash Programming of C2000Tm Microcontrollers"

I got the almost same trouble when I set the wrong bootmode(ex. using flash boot mode trying to download kernel using SCI). 

After I set the proper boot mode, in F28379d, showed following properly working image. 

So, I think the problem is related with something about bootmode setting. 

In document, first step is making custom boot mode. 

I checked whether the otp programming is well done or not. 

The register refer in document is set properly as I can see the value through the CCS.

And also in hardware perspective, whatever I change the boot mode switch attached in ControlCARD(S1),

it only run by flash boot mode(I didn't connect any resistor and capacitor at "GPIO 15" at this moment). 

So It means "GPIO 15" is properly set to custom boot mode and fixed by flash boot mode while LOW(0).

Then I connected 1k resistor and 10nF capactior to "GPIO 15", modified the kernel code explained in the 

document section "4.2 Flash Kernel Modifications" and build by 7 CPU1_RAM mode, and get the 

"flashapi_ex2_sci_kernel.txt" file from workspace folder, and tried to download the kernel. and It won't work as shown in top of this thread. 

I checked example "sci_ex4_echoback" test to verify the sci-rx tx hadware parts were ok. and it worked fine. 

So hardware part has no problem I think.  

I tried to use new mcu device which is not configured custom boot mode as above, selected the switch as SCI boot mode at s1, 

It shows proper downloading finish result as shown below

I think "request firmware update" of Figure 3, firmware update flow, and drive boot code from GPIO 15, this process is missing. 

 

Is there any recommendation about this trouble?

Thank you. 

  • Hello, 

    Can you see if GPIO 15 is actually changing values when being driven from high to low or vice versa? From the console output it is not clear if the boot mode is actually changing. 

    Thanks, 

    Anu

  • Thank you for sharing your recommendation.

    As you mentioned, GPIO 15 wasn't changing at all while trying to downloading kernel.

    I checked with the oscilloscope. 

    Below is the code I modified for kernel.

    I'm not sure about "Request firmware upgrade" command to MCU. 

    Is it given by trying to run kernel file with serial_flash_programming? 

    How can my stored application enters the "firmware update mode" explained in section 4.3 in "C2000 software Controlled Firmware Update Process". 

    or something the way I missing?  

    Thank you for your help.

    flashapi_ex2_sci_get_function.c

    #include "flashapi_ex2_bootrom.h"
    #include "flashapi_ex2_commands.h"
    #include "flashapi_ex2_erase.h"
    #include "flashapi_ex2_verify.h"
    #include "driverlib.h"
    #include "device.h"
    #include "stdint.h"
    #include "flashapi_ex2_ldfu.h"
    
    //
    // Globals
    //
    typedef struct
    {
       uint16_t status;
       uint32_t address;
       uint16_t flashAPIError;
       uint32_t flashAPIFsmStatus;
    }  StatusCode;
    StatusCode statusCode;
    
    uint16_t checksum;
    
    //
    // getWordData is a pointer to the function that interfaces to the peripheral.
    // Each loader assigns this pointer to it's particular getWordData function.
    //
    extern uint16fptr getWordData;
    
    
    //
    // Function Prototypes (Private)
    //
    uint16_t sciaGetWordData(void);
    uint16_t sciaGetOnlyWordData(void);
    void sendACK(void);
    void sendNAK(void);
    inline uint16_t sciaGetACK(void);
    void sciaFlush(void); 
    void sciaInit(uint32_t  BootMode);
    void sciPinmuxOption(uint32_t BootMode);
    uint32_t sciGetFunction(uint32_t  BootMode);
    uint16_t sciGetPacket(uint16_t* length, uint16_t* data);
    uint16_t sciSendPacket(uint16_t command, uint16_t status, uint16_t length,
                          uint16_t* data1, uint16_t flashAPIError, uint16_t* data2);
    void sciSendWord(uint16_t word);
    void sciSendChecksum(void);
    
    //
    // Function Prototypes (External)
    //
    extern uint32_t sciBoot(uint32_t BootMode);
    extern void sharedErase(uint32_t sectors);
    extern void copyData(void);
    extern void verifyData(void);
    extern uint32_t getLongData(void);
    extern void readReservedFn(void);
    
    //
    // sciGetFunction -  This function first initializes SCIA and performs
    //                   an autobaud lock. It contains a while loop waiting on
    //                   commands from the host.  It processes each
    //                   command and sends a response except for Run and
    //                   Reset commands.  On Run the kernel exits and branches
    //                   to the Entry Point.  On Reset, the kernel exits the
    //                   while loop and does a WatchDog Time-out.
    //
    uint32_t sciGetFunction(uint32_t BootMode)
    {
        volatile uint32_t EntryAddr;
        uint16_t command;
        uint16_t data[10]; // 16*10 = 128 + 32
        uint16_t length;
    
        //
        // Assign GetWordData to the SCI-A version of the
        // function. GetWordData is a pointer to a function.
        //
        getWordData = sciaGetWordData;
    
        //
        // Initialize the SCI-A port for communications
        // with the host.
        //
        sciaInit(BootMode);
    
        //
        // driverlib autobaud lock:
        //
        SCI_lockAutobaud(SCIA_BASE);
    
        //
        // echo back the autoBaud success, driverlib.
        //
        uint16_t byteData = SCI_readCharBlockingNonFIFO(SCIA_BASE);
        SCI_writeCharBlockingNonFIFO(SCIA_BASE, byteData);
    
        //
        // get user command through console.
        //
        command = sciGetPacket(&length, data);
    
        while(command != RESET_CPU1)
        {
            //
            // Reset the statusCode.
            //
            statusCode.status = NO_ERROR;
            statusCode.address = 0x12345678;
            checksum = 0;
    
            //
            // The LDFU build configurations only support the Live DFU command;
            // the Live DFU command is not included in other build configurations
            //
            #ifdef LIVE_UPDATE
    
            //
            // Live DFU
            //
            if (command == LIVE_DFU_CPU1)
            {
                liveDFU();
            }
    
            #endif
    
            #ifndef LIVE_UPDATE
    
            //
            // CPU1_UNLOCK_Z1
            //
            if(command == CPU1_UNLOCK_Z1)
            {
                //
                // driverlib struct for csmKey.
                //
                DCSM_CSMPasswordKey psCMDKey;
    
                psCMDKey.csmKey0 = (uint32_t)data[0] | ((uint32_t)data[1] << 16);
                psCMDKey.csmKey1 = (uint32_t)data[2] | ((uint32_t)data[3] << 16);
                psCMDKey.csmKey2 = (uint32_t)data[4] | ((uint32_t)data[5] << 16);
                psCMDKey.csmKey3 = (uint32_t)data[6] | ((uint32_t)data[7] << 16);
    
    
                //
                // Unlock the zone 1, driverlib.
                //
                DCSM_unlockZone1CSM(&psCMDKey);
    
                //
                // check if it is unlocked.
                //
                if(DCSM_getZone1CSMSecurityStatus() == DCSM_STATUS_LOCKED) {
                    statusCode.status = UNLOCK_ERROR;
                }
    
            }
    
            //
            // CPU1_UNLOCK_Z2
            //
            else if(command == CPU1_UNLOCK_Z2)
            {
                //
                // driver lib implementation of csmKeys
                //
                DCSM_CSMPasswordKey psCMDKey;
    
                psCMDKey.csmKey0 = (uint32_t) data[0] | ((uint32_t) data[1] << 16);
                psCMDKey.csmKey1 = (uint32_t) data[2] | ((uint32_t) data[3] << 16);
                psCMDKey.csmKey2 = (uint32_t) data[4] | ((uint32_t) data[5] << 16);
                psCMDKey.csmKey3 = (uint32_t) data[6] | ((uint32_t) data[7] << 16);
    
                //
                // Unlock the zone 2, driverlib.
                //
                DCSM_unlockZone2CSM(&psCMDKey);
    
                //
                // check if zone 2 is unlocked.
                //
                if (DCSM_getZone2CSMSecurityStatus() == DCSM_STATUS_LOCKED)
                {
                    statusCode.status = UNLOCK_ERROR;
                }
            }
    
            //
            // DFU_CPU1
            //
            else if(command == DFU_CPU1)
            {
                //
                // loads application into CPU1 FLASH
                //
                EntryAddr = sciBoot(BootMode);
                if(statusCode.status == NO_ERROR)
                {
                    statusCode.address = EntryAddr;
                }
            }
    
            //
            // ERASE_CPU1
            //
            else if(command == ERASE_CPU1)
            {
                uint32_t sectors = (uint32_t)(((uint32_t)data[1] << 16) |
                                          (uint32_t)data[0]);
                sharedErase(sectors);
            }
    
            //
            // VERIFY_CPU1
            //
            else if(command == VERIFY_CPU1)
            {
                verifyData();
            }
    
            //
            // RUN_CPU1
            //
            else if(command == RUN_CPU1)
            {
                EntryAddr = (uint32_t)(((uint32_t)data[1] << 16) | (uint32_t)data[0]);
                return(EntryAddr);
            }
    
            //
            // COMMAND_ERROR
            //
            else
            {
                statusCode.status = COMMAND_ERROR;
            }
    
            //
            // Send the packet and if NAK send again.
            //
            while(sciSendPacket(command, statusCode.status, 12,
                  (uint16_t*)&statusCode.address, statusCode.flashAPIError,
                  (uint16_t*)&statusCode.flashAPIFsmStatus)){}
    
            #endif
    
            GPIO_setPadConfig(15, GPIO_PIN_TYPE_STD);
            GPIO_setDirectionMode(15, GPIO_DIR_MODE_OUT);
            GPIO_writePin(15, 0);
            DEVICE_DELAY_US(50);
            //
            // Get next Packet
            //
            //command = sciGetPacket(&length, data); //get next packet
            command = RESET_CPU1;
        }
    
        //
        // Reset with WatchDog Timeout
        //
        EALLOW;
    
        //
        // driverlib, Watchdog reset enable = WDENINT->0 and WDOVERRIDE->0
        //
        SysCtl_setWatchdogMode(SYSCTL_WD_MODE_RESET);
    
        //
        // enable the Watchdog, driverlib; 
        // same as HWREGH(WD_BASE + SYSCTL_O_WDCR) = SYSCTL_WD_CHKBITS;
        //
        SysCtl_enableWatchdog();
        EDIS;
    
        while(1){}
    }
    
    
    //
    // sciSendPacket -  Sends a Packet to the host which contains
    //                  status in the data and address.  It sends the
    //                  statusCode global variable contents.  It then waits
    //                  for an ACK or NAK from the host.
    //
    uint16_t sciSendPacket(uint16_t command, uint16_t status, uint16_t length,
                          uint16_t* data1, uint16_t flashAPIError, uint16_t* data2)
    {
        int i;
    
        sciaFlush();
    
        //
        // driverlib's version of delay
        //
        DEVICE_DELAY_US(100000);
        sciSendWord(0x1BE4);
        sciSendWord(length);
    
        checksum = 0;
        sciSendWord(command);
        sciSendWord(status);
    
        for(i = 0; i < 2; i++)
        {
            sciSendWord(*(data1 + i));
        }
        sciSendWord(flashAPIError);
        for(i = 0; i < 2; i++)
        {
            sciSendWord(*(data2 + i));
        }
    
        sciSendChecksum();
        sciSendWord(0xE41B);
    
        //
        // Receive an ACK or NAK
        //
        return sciaGetACK();
    }
    
    //
    // sciaGetACK - Gets 1-byte ACK from the host.
    //
    inline uint16_t sciaGetACK()
    {
        uint16_t wordData;
    
        //
        // wait for and read a char blocking nonFIFO, driverlib.
        //
        wordData = SCI_readCharBlockingNonFIFO(SCIA_BASE);
    
        if(wordData != ACK)
        {
            return(1);
        }
    
        return(0);
    }
    
    //
    // sciSendChecksum - Sends the Global checksum value
    //
    void sciSendChecksum()
    {
        //
        // wait for SCIA_TX to be free and write LSB of checksum to it.
        //
        SCI_writeCharBlockingNonFIFO(SCIA_BASE, (checksum & 0xFF));
    
        sciaFlush();
        sciaGetACK();
    
        //
        // wait for SCIA_TX to be free and write MSB of checksum to it.
        //
        SCI_writeCharBlockingNonFIFO(SCIA_BASE, ((checksum >> 8) & 0xFF));
    
        sciaFlush();
        sciaGetACK();
    }
    
    //
    // sciSendWord - Sends a uint16_t word.
    //
    void sciSendWord(uint16_t word)
    {
        //
        // send LSB of word, driverlib.
        //
        SCI_writeCharBlockingNonFIFO(SCIA_BASE, (word & 0xFF));
    
        checksum += word & 0xFF;
    
        sciaFlush();
        sciaGetACK();
    
        //
        // send MSB of word, driverlib.
        //
        SCI_writeCharBlockingNonFIFO(SCIA_BASE, ((word>>8) & 0xFF));
    
        checksum += word>>8 & 0xFF;
    
        sciaFlush();
        sciaGetACK();
    }
    
    //
    // sciaInit - Initialize the SCI-A port for communications with the host.
    //
    void sciaInit(uint32_t  BootMode)
    {
        //
        // Enable the SCI-A clocks
        //
        EALLOW;
    
        //
        // Device_enableAllPeripherals enabled PCLKCR7.SCI_A already.
        //
    
        //
        // TRM, 0x0007 -> scaler of 14. OSCLOK low speed scaling for SCI.
        //
        SysCtl_setLowSpeedClock(SYSCTL_LSPCLK_PRESCALE_14);
    
        // reset SCI channels.
        SCI_resetChannels(SCIA_BASE);
    
        //
        // 1 stop bit, No parity, 8-bit character
        // No loopback
        //
        // CLK speed and Baud rate get overwritten in autobaud_lock function later.
        //
        SCI_setConfig(
                SCIA_BASE, DEVICE_LSPCLK_FREQ, DEFAULT_BAUD,
                SCI_CONFIG_WLEN_8 | SCI_CONFIG_STOP_ONE | SCI_CONFIG_PAR_NONE);
    
    
        //
        // Enable TX, RX, Use internal SCICLK
        //
        SCI_enableModule(SCIA_BASE);
    
        //
        // Disable RxErr, Sleep, TX Wake,
        // Disable Rx Interrupt, Tx Interrupt
        //
        SCI_disableInterrupt(
                SCIA_BASE,
                SCI_INT_RXRDY_BRKDT | SCI_INT_TXRDY | SCI_INT_RXERR | SCI_INT_TXRDY);
    
        //
        // Relinquish SCI-A from reset
        //
        SCI_performSoftwareReset(SCIA_BASE);
        EDIS;
    
        // pick SCIA TX and RX GPIO pin according to BootMode.
        sciPinmuxOption(BootMode);
    
        return;
    }
    
    //
    // sciaGetWordData -  This routine fetches two bytes from the SCI-A
    //                    port and puts them together to form a single
    //                    16-bit value.  It is assumed that the host is
    //                    sending the data in the order LSB followed by MSB.
    //
    uint16_t sciaGetWordData(void)
    {
       uint16_t wordData;
       uint16_t byteData;
    
       wordData = 0x0000;
       byteData = 0x0000;
    
       //
       // Fetch the LSB and verify back to the host
       //
       wordData = SCI_readCharBlockingNonFIFO(SCIA_BASE); // wait until RX is rdy then read.
    
    #if !checksum_enable
    
       //
       // wait until TX is rdy then write.
       //
       SCI_writeCharBlockingNonFIFO(SCIA_BASE, wordData);
    
    #endif
    
       //
       // Fetch the MSB and verify back to the host
       //
       byteData = SCI_readCharBlockingNonFIFO(SCIA_BASE); // read
    
    #if !checksum_enable
    
       //
       // write
       //
       SCI_writeCharBlockingNonFIFO(SCIA_BASE, wordData);
    
    #endif
    
    //
    // form checksum.
    //
    #if checksum_enable
        checksum += wordData + byteData;
    #endif
    
       //
       // form the wordData from the MSB:LSB
       //
       wordData |= (byteData << 8);
    
       return wordData;
    }
    
    //
    // sciaGetOnlyWordData -  This routine fetches two bytes from the SCI-A
    //                        port and puts them together to form a single
    //                        16-bit value.  It is assumed that the host is
    //                        sending the data in the order LSB followed by MSB.
    //
    uint16_t sciaGetOnlyWordData(void)
    {
       uint16_t wordData;
       uint16_t byteData;
    
       wordData = 0x0000;
       byteData = 0x0000;
    
       //
       // Fetch the LSB and verify back to the host
       //
       wordData = SCI_readCharBlockingNonFIFO(SCIA_BASE);
    
       //
       // Fetch the MSB and verify back to the host
       //
       byteData = SCI_readCharBlockingNonFIFO(SCIA_BASE);
    
       // compute checksum.
       checksum += wordData + byteData;
    
       //
       // form the wordData from the MSB:LSB
       //
       wordData |= (byteData << 8);
    
       return wordData;
    }
    
    //
    // sciGetPacket -  This routine receives the packet, returns the
    //                 command and puts the data length in Uin16* length
    //                 and data in uint16_t* data
    //
    uint16_t sciGetPacket(uint16_t* length, uint16_t* data)
    {
        if(sciaGetOnlyWordData() != 0x1BE4)
        {
            sendNAK();
    
            //
            // start packet error
            //
            return(100);
        }
    
        *length = sciaGetOnlyWordData();
    
        //
        // checksum of command and data
        //
        checksum = 0;
        uint16_t command = sciaGetOnlyWordData();
    
        int i = 0;
        for(i = 0; i < (*length)/2; i++)
        {
            *(data+i) = sciaGetOnlyWordData();
        }
    
        uint16_t dataChecksum = checksum;
        if(dataChecksum != sciaGetOnlyWordData())
        {
            sendNAK();
    
            //
            // checksum error
            //
            return(101);
        }
        if(sciaGetOnlyWordData() != 0xE41B)
        {
            sendNAK();
    
            //
            // end packet error
            //
            return(102);
        }
    
        sendACK();
        return(command);
    }
    
    //
    // sendACK - This routine transmits ACK.
    //
    void sendACK(void)
    {
        //
        // write ACKowledged.
        //
        SCI_writeCharBlockingNonFIFO(SCIA_BASE, ACK);
    
        sciaFlush();
    }
    
    //
    // sendNAK - This routine transmits NAK.
    //
    void sendNAK(void)
    {
        //
        // write NotAcKowledged.
        //
        SCI_writeCharBlockingNonFIFO(SCIA_BASE, NAK);
    
        sciaFlush();
    }
    
    //
    // sciaFlush - This routine flushes SCIA.
    //
    void sciaFlush(void)
    {
        //
        // wait while TX is busy.
        //
        while(SCI_isTransmitterBusy(SCIA_BASE))
        {
        }
    }
    
    //
    // sciPinmuxOption -     This routine configures correct set of GPIO pins
    //                       as SCI pins according to BootMode :-
    //                       1) Configure GPIO Tx as SCITXDA pin
    //                       2) Configure GPIO Rx as SCIRXDA pin
    //                       3) Configure GPIO Rx as asynchronous pin
    //
    void sciPinmuxOption(uint32_t BootMode)
    {
        if(BootMode == SCI_BOOT)
        {
            // Configure GPIO29 as SCITXDA (Output pin)
            // Configure GPIO28 as SCIRXDA (Input pin)
            //
    
            //
            // GPIO29 is the SCI Tx pin.
            //
            GPIO_setMasterCore(DEVICE_GPIO_PIN_SCITXDA, GPIO_CORE_CPU1); 
            GPIO_setPinConfig(DEVICE_GPIO_CFG_SCITXDA);
            GPIO_setDirectionMode(DEVICE_GPIO_PIN_SCITXDA, GPIO_DIR_MODE_OUT);
            GPIO_setPadConfig(DEVICE_GPIO_PIN_SCITXDA, GPIO_PIN_TYPE_STD);
            GPIO_setQualificationMode(DEVICE_GPIO_PIN_SCITXDA, GPIO_QUAL_ASYNC);
    
            //
            // GPIO28 is the SCI Rx pin.
            //
            GPIO_setMasterCore(DEVICE_GPIO_PIN_SCIRXDA, GPIO_CORE_CPU1);
            GPIO_setPinConfig(DEVICE_GPIO_CFG_SCIRXDA);
            GPIO_setDirectionMode(DEVICE_GPIO_PIN_SCIRXDA, GPIO_DIR_MODE_IN);
            GPIO_setPadConfig(DEVICE_GPIO_PIN_SCIRXDA, GPIO_PIN_TYPE_STD);
            GPIO_setQualificationMode(DEVICE_GPIO_PIN_SCIRXDA, GPIO_QUAL_ASYNC);
    
        }
        else if(BootMode == SCI_BOOT_ALT1)
        {
            //
            // Configure GPIO16 as SCITXDA (Output pin)
            // Configure GPIO17 as SCIRXDA (Input pin)
            //
    
            //
            // GPIO16 is the SCI Tx pin.
            //
            GPIO_setMasterCore(16, GPIO_CORE_CPU1);
            GPIO_setPinConfig(GPIO_16_SCIA_TX);
            GPIO_setDirectionMode(16, GPIO_DIR_MODE_OUT);
            GPIO_setPadConfig(16, GPIO_PIN_TYPE_STD);
            GPIO_setQualificationMode(16, GPIO_QUAL_ASYNC);
    
            //
            // GPIO17 is the SCI Rx pin.
            //
            GPIO_setMasterCore(17, GPIO_CORE_CPU1);
            GPIO_setPinConfig(GPIO_17_SCIA_RX);
            GPIO_setDirectionMode(17, GPIO_DIR_MODE_IN);
            GPIO_setPadConfig(17, GPIO_PIN_TYPE_STD);
            GPIO_setQualificationMode(17, GPIO_QUAL_ASYNC);
        }
        else if(BootMode == SCI_BOOT_ALT2)
        {
            //
            // Configure GPIO8 as SCITXDA (Output pin)
            // Configure GPIO9 as SCIRXDA (Input pin)
            //
    
            //
            // GPIO8 is the SCI Tx pin.
            //
            GPIO_setMasterCore(8, GPIO_CORE_CPU1);
            GPIO_setPinConfig(GPIO_8_SCIA_TX);
            GPIO_setDirectionMode(8, GPIO_DIR_MODE_OUT);
            GPIO_setPadConfig(8, GPIO_PIN_TYPE_STD);
            GPIO_setQualificationMode(8, GPIO_QUAL_ASYNC);
    
            //
            // GPIO9 is the SCI Rx pin.
            //
            GPIO_setMasterCore(9, GPIO_CORE_CPU1);
            GPIO_setPinConfig(GPIO_9_SCIA_RX);
            GPIO_setDirectionMode(9, GPIO_DIR_MODE_IN);
            GPIO_setPadConfig(9, GPIO_PIN_TYPE_STD);
            GPIO_setQualificationMode(9, GPIO_QUAL_ASYNC);
    
        }
        else if(BootMode == SCI_BOOT_ALT4)
        {
            //
            // Configure GPIO24 as SCITXDA (Output pin)
            // Configure GPIO25 as SCIRXDA (Input pin)
            //
    
            //
            // GPIO24 is the SCI Tx pin.
            //
            GPIO_setMasterCore(24, GPIO_CORE_CPU1);
            GPIO_setPinConfig(GPIO_24_SCIA_TX);
            GPIO_setDirectionMode(24, GPIO_DIR_MODE_OUT);
            GPIO_setPadConfig(24, GPIO_PIN_TYPE_STD);
            GPIO_setQualificationMode(24, GPIO_QUAL_ASYNC);
    
            //
            // GPIO25 is the SCI Rx pin.
            //
            GPIO_setMasterCore(25, GPIO_CORE_CPU1);
            GPIO_setPinConfig(GPIO_25_SCIA_RX);
            GPIO_setDirectionMode(25, GPIO_DIR_MODE_IN);
            GPIO_setPadConfig(25, GPIO_PIN_TYPE_STD);
            GPIO_setQualificationMode(25, GPIO_QUAL_ASYNC);
    
        }
    }

    flashapi_ex2_sciKernel.c

        //
        // initialize device and GPIO, driverlib.
        //
        Device_init();
        Device_initGPIO();
    
        //
        // init interrupt and vectorTable, drivelib.
        //
        Interrupt_initModule();
        Interrupt_initVectorTable();
    
        //
        // Drive GPIO pin to high
        //
        GPIO_setPadConfig(15, GPIO_PIN_TYPE_STD);
        GPIO_setDirectionMode(15, GPIO_DIR_MODE_OUT);
        GPIO_writePin(15, 1);
        DEVICE_DELAY_US(50);
        //
        // Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
        //
        EINT;
        ERTM;
    
        //
        // initialize flash_sectors, fapi + driverlib
        //
        initFlashSectors();
        //
        // GPIO28 is the SCI Rx pin.
        //
        GPIO_setMasterCore(DEVICE_GPIO_PIN_SCIRXDA, GPIO_CORE_CPU1);
        GPIO_setPinConfig(DEVICE_GPIO_CFG_SCIRXDA);
        GPIO_setDirectionMode(DEVICE_GPIO_PIN_SCIRXDA, GPIO_DIR_MODE_IN);
        GPIO_setPadConfig(DEVICE_GPIO_PIN_SCIRXDA, GPIO_PIN_TYPE_STD);
        GPIO_setQualificationMode(DEVICE_GPIO_PIN_SCIRXDA, GPIO_QUAL_ASYNC);
    
        //
        // GPIO29 is the SCI Tx pin.
        //
        GPIO_setMasterCore(DEVICE_GPIO_PIN_SCITXDA, GPIO_CORE_CPU1);
        GPIO_setPinConfig(DEVICE_GPIO_CFG_SCITXDA);
        GPIO_setDirectionMode(DEVICE_GPIO_PIN_SCITXDA, GPIO_DIR_MODE_OUT);
        GPIO_setPadConfig(DEVICE_GPIO_PIN_SCITXDA, GPIO_PIN_TYPE_STD);
        GPIO_setQualificationMode(DEVICE_GPIO_PIN_SCITXDA, GPIO_QUAL_ASYNC);
        uint32_t EntryAddr;
    
        //
        // parameter SCI_BOOT for GPIO28 (RX),29 (TX) is default.
        //
        EntryAddr = sciGetFunction(SCI_BOOT);
        return(EntryAddr);
    }
    
    
    //
    // initFlashSectors - Initializes the flash API
    //
    void initFlashSectors(void)
    {
        EALLOW;
    
        Fapi_StatusType oReturnCheck;
        oReturnCheck = Fapi_initializeAPI(F021_CPU0_BASE_ADDRESS, 100);
        if(oReturnCheck != Fapi_Status_Success)
        {
            exampleError(oReturnCheck);
        }
        oReturnCheck = Fapi_setActiveFlashBank(Fapi_FlashBank0);
        if(oReturnCheck != Fapi_Status_Success)
        {
            exampleError(oReturnCheck);
        }
    
        EDIS;
    }
    
    //
    // Functions are not placed in RAM for the Live DFU configurations
    //
    #ifndef LIVE_UPDATE
    
    #ifdef __cplusplus
    #pragma CODE_SECTION(".TI.ramfunc");
    #else
    #pragma CODE_SECTION(exampleError,".TI.ramfunc");
    #endif
    
    #endif
    
    //
    // Example_Error - Error function that will halt debugger
    //
    void exampleError(Fapi_StatusType status)
    {
        //
        // Error code will be in the status parameter
        //
        __asm("    ESTOP0");
    }

  • Hello, 

    The kernel code modifications look fine. The code snippets mentioned in Section 4.1 need to be added to your application so that it can request a firmware upgrade. The application needs to drive GPIO15 high and then have a 50 us delay before resetting the device. After the device reset, the device will be in SCI Boot mode and the kernel can be used. 

    Thanks

    Anu

  • Thank you for your reply. 

    I finally understand my mistake.

    I thought the code in section 4.1, blinky code, is same as the code provided by C2000 example. 

    Different from section 4.1, blinking code is in the infinity loop.

    so "I NEED ADDITIONAL REQUEST FOR GETTING OUT OF THE LOOP" to make it GPIO 15 high and system reset.

    But the code from section 4.1 it ends after 5 cycles of blinking, and it automatically make the GPIO 15 HIGH and system reset.  

    This is my final question.

    In normal application which has infinity loop, should I make the code for getting out for the loop? 

    Literally firmware update request code. 

    Because this document is intended to run the firmware update by software controlling.  

    Thank you. 

  • Miles, 

    Yes, in order to see the firmware update request happen, the infinite loop would need to be changed in the blinky example. 

    Thanks

    Anu

  • Thank you for kind help.