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.

C2000-GANG: How to use From Image File mode C2000-GANG dll?

Part Number: C2000-GANG

I make a C2000-GANG auto download program.

and I use 'From Image File' mode

When I manually download at C2000-GANG TI S/W, It was worked.

but my code return CRC error.

I looked for examples, but there were no examples for 'From Image File'.

Is there config or a function that I need to set to use 'From Image File' mode?

Below is the code I wrote.

procedure TFrmC2000GANG.InitializeGang();
var
    status : Integer;
begin
    writeLog('C2000GANG_InitCom', true);
    status := C2000GANG_InitCom(strToPWidChar(cmbPort.Text), StrToIntDef(cmbBaudrate.Text, 19200));
    EvaluateByCode(status);

    writeLog('C2000GANG_Default_Config', true);
    status := C2000GANG_Default_Config;
    EvaluateByCode(status);

    writeLog('C2000GANG_Set_MCU_Name', true);
    status := C2000GANG_Set_MCU_Name(strToPAnsChr(cmbDeviceName.Text));
    EvaluateByCode(status);

    writeLog('C2000GANG_SetConfig(SetT)', true);
    status := C2000GANG_SetConfig(CFG_VCC_SETTLE_TIME, edtSattleTime.Value);
    EvaluateByCode(status);

    writeLog('C2000GANG_SetConfig(TarEn)', true);
    status := C2000GANG_SetConfig(CFG_TARGET_EN_INDEX, StrToIntDef(edtTargetEn.Text, $1));
    EvaluateByCode(status);

    writeLog('C2000GANG_SetConfig(OSC)', true);
    status := C2000GANG_SetConfig(CFG_DSP_OSC_FREQ_KHZ, StrToIntDef(cmbTargetOSC.Text, 10000));
    EvaluateByCode(status);

    writeLog('C2000GANG_Read_Code_File', true);
    status := C2000GANG_Read_Code_File(strToPAnsChr(edtDir.Text));
    EvaluateByCode(status);

    writeLog('C2000GANG_CFG_PROJECT_SOURCE', true);
    status := C2000GANG_SetConfig(CFG_PROJECT_SOURCE, FROM_IMAGE_FILE_MODE);
    EvaluateByCode(status);

    writeLog('C2000GANG_SelectImage', true);
    status := C2000GANG_SelectImage(edtImgIndex.Value);
    EvaluateByCode(status);                       
end;

procedure TFrmC2000GANG.btnStartClick(Sender: TObject);
var
    status : Integer;
begin
    InitializeGang;
    btnLoadClick(nil);
    writeLog('C2000GANG_MainProcess', true);
    status := C2000GANG_MainProcess(1000);
    EvaluateByCode(status);

    ShowDiagnostic;

    writeLog('Start Complete', true);
end;

procedure TFrmC2000GANG.btnLoadClick(Sender: TObject);
var
    status : Integer;
begin
    writeLog('C2000GANG_LoadImage', true);
    status := C2000GANG_ImageFileLoad(PChar(edtDir.Text), PChar(edtPW.Text), 0);
    if not EvaluateByCode(status) then Exit;
end;