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.

LAUNCHXL-CC1310: 15.4 Stack native OAD not working

Part Number: LAUNCHXL-CC1310
Other Parts Discussed in Thread: CC1350, CC1310

I'm trying to run the OAD examples on cc1310 launchpads and it looks like it's not working as it should. Symptoms point towards the external flash. Just trying the "erase ext. flash" hex on a cc1350 and a cc1310 I see that something's different between the platforms. As far as I understand the ext. flash is identical on both LPs so it's got to be something in software. Maybe a hard coded define to cc1350 somewhere.

Stuck with a bunch of cc1310 LPs here so any help given is much appreciated.
  • To clarify,

    I'm running 15.4 stack native OAD examples with the latest cc13x0 sdk (1.40.00.10)

    Regards,
    Martin
  • I've now tried running the NVS driver example on a CC1310 LP and it fails with error code NVS_STATUS_INV_WRITE (-7) so that's where the issue lies. There are also no checks on the actual write so it fails silently. I suspect this is what happens in the case of OAD as well.
  • Martin,
    is the NVS driver trying to write more than 256 bytes in a row? There has been a bug discovered in the NVS driver last week. As a work-around, write operations need to be limited to 256 bytes chunks.

  • As far as I can tell it's trying to write 64 byte chunks. All of it seem to work on cc1350 so it has got to be related to that, some stray define not set or set differently for cc1310.
  • Hi Martin,

    thank you for reporting. I confirm your observations and filed a bug report for the TIDRIVERS team. The NVSSPI examples do neither work on the CC1310 nor on the CC1350 launchpads. So it's actually the NVSSPI driver.

  • There's a bug in the nvs and nvsspi examples that shows up if the flash region being exercised was not in the erased state when the example first runs. A workaround is to change this code

     else {
        Display_printf(displayHandle, 0, 0, "Writing signature to flash...");
    
        /* Write signature to memory */
        NVS_write(nvsHandle, 0, (void *) signature, sizeof(signature),
        NVS_WRITE_PRE_VERIFY | NVS_WRITE_POST_VERIFY);
     }
    

    to this:

     else {
        Display_printf(displayHandle, 0, 0, "Writing signature to flash...");
    
        /* Erase the entire flash region */
        NVS_erase(nvsHandle, 0, regionAttrs.regionSize);
    
        /* Write signature to memory */
        NVS_write(nvsHandle, 0, (void *) signature, sizeof(signature),
           NVS_WRITE_PRE_VERIFY | NVS_WRITE_POST_VERIFY);
     }
    



    The examples will be fixed in 3.30.

  • There's another issue in the SPICC26XX driver that constrains SPI transfers to 1024 bytes or less. Consequently, attempts to read more than 1024 bytes from the SPI flash at a time will quietly fail. This issue can be worked around in user code by breaking the read into blocks of 1024 bytes or less.
    Another solution is to include the NVSSPI25X.c file in your project and substitute the following implementation of NVSSPI25X_read():

    /*
     *  ======== NVSSPI25X_read =======
     */
    int_fast16_t NVSSPI25X_read(NVS_Handle handle, size_t offset, void *buffer,
            size_t bufferSize)
    {
        NVSSPI25X_HWAttrs const *hwAttrs;
        size_t xferSize;
        uint8_t *dstBuf;
        int retval = NVS_STATUS_SUCCESS;
    
        hwAttrs = handle->hwAttrs;
    
        /* Validate offset and bufferSize */
        if (offset + bufferSize > hwAttrs->regionSize) {
            return (NVS_STATUS_INV_OFFSET);
        }
    
        dstBuf = buffer;
        /*
         *  Get exclusive access to the region.  We don't want someone
         *  else to erase the region while we are reading it.
         */
        SemaphoreP_pend(writeSem, SemaphoreP_WAIT_FOREVER);
    
        /*
         * break read down into 1024 byte pieces to workaround TIDRIVERS-1173
         */
        while (bufferSize) {
            if (bufferSize <= 1024) {
                xferSize = bufferSize;
            }
            else {
                xferSize = 1024;
            }
    
            retval = doRead(handle, offset, dstBuf, xferSize);
    
            if (retval != NVS_STATUS_SUCCESS) {
                break;
            }
            else {
                offset += xferSize;
                dstBuf += xferSize;
                bufferSize -= xferSize;
            }
        }
    
        SemaphoreP_post(writeSem);
    
        return (retval);
    }
    

  • This fixes the NVS example. It does not solve the original problem with 15.4 stack native oad though. I'll have a look to see if it could be a similar problem but would apprechiate if someone took a look at it from your side.

    Thanks,

    Martin