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.

320F28069, flash_program error code 0x1E

Other Parts Discussed in Thread: CONTROLSUITE

I'm getting an error code returned when I attempt to copy data into flash. An absurd lack of an cohesive documentation prevents me from figuring out what exactly is going wrong.

I am calling memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (Uint32)&RamfuncsLoadSize); before attempting the copy, so it's not because I'm attempting to write to flash while running out of flash.

relevant .cmd file parts:

FLASH_UNUSED : origin = 0x3D8000, length = 0x1BFFF
FLASHA : origin = 0x3F4000, length = 0x3F80

ramfuncs : LOAD = FLASHA,
RUN = RAML0,
LOAD_START(_RamfuncsLoadStart),
LOAD_END(_RamfuncsLoadEnd),
LOAD_SIZE(_RamfuncsLoadSize),
RUN_START(_RamfuncsRunStart),
PAGE = 0

code:

#pragma CODE_SECTION("ramfuncs");

void mycopy( void )
{
Uint16* dst_ptr = (Uint16*)0x3F0010;

Uint16 srcBuffer[10];
for (int i=0; i<10; i++)
{
srcBuffer[i] = i+200;
}

DINT;
g_status = Flash_Program( dst_ptr, srcBuffer, 10, &g_flashStatus);
EINT;
}

result:

FLASH_ST values after flash_program():

FirstFailAddr: 0x3f0010

ExpectedData: 200

ActualData: 65535 (0xFFFF)

 

g_status, the return value of Flash_Program() ends up being 0x1E

  • Ben,

    Have you referred to the documentation and example in controlSUITE (~\controlSUITE\libs\utilities\flash_api\2806x\v100a)? If not, they are sure to provide some guidance.

    Best Regards
    Chris
  • The controlsuite examples are where I got this code before working it into my application.
    Is there really no documentation for the flash API code?
    I've seen a posting saying that flash_program and flash_erase calls are TI proprietary code that won't be distributed without an NDA (or something along those lines).
    It seems to me that an API document for the programming considerations would be a no-brainer.
  • As an additional couple points of information:

    flash_program is not called anywhere in the v100a code examples.
    The first usage in the example code is in v136.

    The return value of flash_program is not explained anywhere in the code I've seen, other than to show that STATUS_SUCCESS is the good value.
    I've not seen any explanation of what other return values indicate.

  • Ben,

    Yes that is correct, the flash API source code is proprietary and requires a signed license to get access.
    I don't follow what you are seeing at (~\controlSUITE\libs\utilities\flash_api\2806x\v100a) location. Within the doc folder, the "Flash2806x_API_Readme.pdf" details some API usage as well as the return values. Additionally, both those examples do call "Flash_Program", see the "Example_Flash2806x_API.c".

    Best Regards
    Chris
  • Which version of controlsuite is that?

    The one I installed from 15 Sept 2016 does not have v100a, only v100, and that example does not have that pdf in the doc folder.

  • Ben,

    That doesn't sound correct, maybe something odd happened during installation. The F2806x Flash API v100a was added in v3.3.3 on June 19, 2015 so it is in any newer version. Additionally, there is a doc in the v100 flash API directory.

    Best Regards
    Chris
  • Yeah, no on both counts.

    v100 does not have the same file.

    These files do not discuss flash programming.

    Just downloaded the current version from ti.com.

    v100a is not in that package, either.

    If you have the file, then what does the return code of 0x1E mean?

  • Ben,

    You are looking in the device_support directory instead of the libs directory. This isn't under the device_support directory, in the root directory of controlSUITE, go to libs->utilities->flash_api->2806x and you will find the files I've described.

    Best Regards
    Chris
  • There seems to be an error in the example code.
    My setup:
    CCS Version: 6.0.1.00040
    ControlSuite circa Nov 1, 2016

    In Example_CallFlashAPI, from controlsuite/libs/utilities/flash_api/2806x/v100/example/example_flash2806x_API.c,

    //excerpt from example code
    // In this case just fill a buffer with data to program into the flash.
    for(i=0;i<WORDS_IN_FLASH_BUFFER;i++)
    {
    Buffer[i] = 0x100+i;
    }

    Flash_ptr = Sector[1].StartAddr;
    Length = 0x400;
    Status = Flash_Program(Flash_ptr,Buffer,Length,&FlashStatus);
    if(Status != STATUS_SUCCESS)
    {
    Example_Error(Status);
    }
    //end of excerpt

    In this example, WORDS_IN_FLASH_BUFFER is 0x100, but Length is 0x400.
    Running this code resuts in a value of STATUS_FAIL_ZERO_BIT_ERROR (0x31) returned from Flash_Program.
    Reducing Length to 0x100 makes the code work.
  • Ben,

    Thanks for letting us know, I've filed a bug to get this addressed and fixed.

    Best Regards
    Chris