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.

AWR1642BOOST: Uniflash Working Mechanism

Part Number: AWR1642BOOST
Other Parts Discussed in Thread: UNIFLASH, MMWAVE-SDK

HI Team,

I am working on AWR1642ES1.o device.For my requirement i want to flash the .bin file into the flash memory so that recently flashed image should boot up after the reset.

When I flash the .bin file using Uniflash tool i can see in the serial console that the image is booting up.But if i flash the same image using QSPIFLASH my image is not booting up.

QSPIFLASH means using CCS debugger i am loading application  where my application uses QSPIFlash_singlewrite() api to write into flash memory at memory location 0xc0000000+0x80000(metaimage-2).

My concern is what exactly Uniflash is doing while flashing it to the flash memory?

I want to know how UNiflash tool is interpreting the .bin file?

Please assist me in these.

TIA.

  • Hi Ramana,
    If you are using QSPIFLASH test application provided in SDK driver then this app may erase or overwrite the content on the same location where MetaImage was being flashed using UniFlash tool. If you want to run some specific QSPIFLASH test then please comment/remove other test and build the test-app then try it.

    Uniflash will do the flash erase (if checkbox is selected) and send the selected MetaImage file in chunk form to device whee bootloader will take care of writing these content to specified address (as per MetaImage header field).


    Regards,
    Jitendra
  • HI Jitendra,

    Uniflash will send the the selected file in chunk form to device means it will flash what ever image we provide without modification right?

    Without modification means our .bin file will be in RPRC format which has Metaimage  header field (tells about load address) .

    Does uniflash flashes only .bin file without header field?

    Or Is uniflash using Header info to load into the flash memory?

    If uniflash is loading .bin as it is then why not my flashing scenario is not working?

    I am also flashing the .bin file which is of correct RPRC format using QSPIFlash_singlewrite() api.

    My file is of 400 kb.I am flashing it in 3kb chunks using QSPIFlash_singlewrite() api.If I read the data back which I had written and compare i am able to see the correct data.But once i finish flashing all the .bin and reboot again it is not booting the image which i have flashed using QSPIFlash_singlewrite() api.

    TIA.

  • Hi,

    In this scenario UniFlash acts as a data streamer where it reads chunk by chunk data from given file and send it to device. At the beginning of it Uniflash sends sFlash partition (1st or 2nd 512KB partition) based on user selection of MetaImage 1 or 2.

    Device's ROM will read that data over UART and does the parsing of it. ROM's flashing function will check for MetaImage header and get to know the type of content and write the data on sFlash as requested.

    Now, if you are trying to write an embedded application where app will write the content to sFlash using QSPIFlash driver then you need to make sure that you do the sector-erase for that chunk first and then write the content (read back and compare).

    Here is the code snippet based on QSPIFlash test application for your reference where it writes the file content from L3 memory to sFlash.

        #define APP_SIZE_MAX_KB     384U
        #define APP_SIZE_MAX        (uint32_t) (APP_SIZE_MAX_KB * 1024U)
        
        /* L3 memory where MetaImage file content is loaded from CCS */
        #pragma LOCATION(gAppL3Buff , 0x51020000); 
        #pragma DATA_ALIGN(gAppL3Buff, 64);
        uint8_t  gAppL3Buff[APP_SIZE_MAX];
    
        flashAddr = QSPIFlash_getExtFlashAddr(QSPIFlashHandle);
    
        /* Set flash address for  the test */
        flashAddr = flashAddr;
        testDataLen = 256 * 4U;
        
        while(*spare3REG != 0);
    
        for (index = 0; index < APP_SIZE_MAX_KB; index+= 4)
        {
            /* Erase a sector for 4KB size */
            QSPIFlash_sectorErase(QSPIFlashHandle, flashAddr); //TODO JIT
    
            for (ij = 0; ij < 4; ij++)
            {
                /* write 1KB of data */
                QSPIFlash_singleWrite(QSPIFlashHandle, flashAddr, testDataLen, (uint8_t *)&gAppL3Buff[(index+ij)*testDataLen]);
    
                QSPIFlash_singleRead(QSPIFlashHandle, flashAddr, testDataLen, (uint8_t *)&readDataArray[0]);
    
                /* Check data */
                retVal = memcmp((void *)&gAppL3Buff[(index+ij)*testDataLen], (void *)&readDataArray[0], testDataLen) ;
    
                if(retVal != 0)
                {
                    System_printf ("QSPIFlash single Wr/Rd comparison failed @[%d KB] \n", index+ij);
                    while(1);
                }
            
                flashAddr += testDataLen;
            }
        }
        

  • Hi Jitendra,

    In my case i am writing 3kb data using Qspiflash.Before writing to Flash i am doing Qspi_sectorErase().

    How does Qspi_SectorErase() works?

    Does it erases sector wise?

    I am erasing flash for 4kb and i am writing 3kb data.Next time when i get the 3073 bytes data again i am doing sector erase and writing 3073 bytes data by updating flashAddr to flashAddr+datalength.

    Does it make sense doing like these?

    TIA.

  • You need to erase and write the same size of the content. With current driver and sFlash sector size to erase if 4KB.
    If you write 3KB after erasing 4KB then every time you miss few KBs, be cautious about this.

    And further, if you are planning to write an application to write secondary bootloader which writes a new application to sFlash then please refer to SBL application provided in mmWave-SDK 3.0 as your other colleague is working on the same.
    e2e.ti.com/.../744865

    Regards,
    Jitendra
  • HI,

    I am writing 3kb and erasing 4kb.Will it cause me any issue?
    If my flashAddr=100
    Then i will do sectorerase ,so that it erases 4kb.
    Now i will write 3kb data and will update flashAddr=flashAddr+3kb;
    In next iteration i will provide flashAddr which is pointing to flashAddr+3kb to QSPI_Sectorerase().
    Will I face any issue in these case?
    I want to know how QSPI_sectorerase() erases 4Kb?
    TIA.
  • Hi,
    In sFlash sector is defined as 4KB of memory page. So, either you erase first sector of 4KB and move by 1KB and call sectore erase again it'll erase current physical sector only. You need to jump for 4KB of sector to erase and then write data as size you need.

    Regards,
    Jitendra
  • HI,

    These information works for me.

    What happens if I add some random offset to flashAddr instead adding in multiples of 512kb?

    What will be the issue if I start writing data in the sFlash from some random address?

    TIA.

  • Hi,
    For writing data to sFlash address must be 8Byte aligned and for reading it can be any random address.

    And for writing multiple images to sFlash it should at every 512KB boundary as device bootloader looks for valid application image at every 512KB of sFlash memory.


    Regards,
    Jitendra