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.

TMS320F28335: Load hex file in flash from C# GUI through UART/USB

Part Number: TMS320F28335
Other Parts Discussed in Thread: CONTROLSUITE

Hi 

I'm currently doing a coursework for my university for control CARD F28335 and my task is to load Flashing LED project (found in controlSUITE) through UART(USB) from a C# GUI. I'm new to TI products and how everything works.

What I tried so far is:

  • I tried to open serial port in C# write hex file produced by CCS, 8 bits at the time with 9600 as baudrate but nothing happened.
  • When i load Flashing LED project from CCS everything works

My task in more details is to erase all sectors, load hex file and program the hex file into flash everything from a C# GUI

Does anyone have any suggestions?

 I've been looking in many forums but couldn't find what I'm looking for.

Can anyone help please?

  • Nick,

    Please see this App Note regarding the serial flash programmer and sci flash kernel.

    www.ti.com/lit/sprabv4


    sal
  • Hi Sal

    Thanks for your suggestion, but sprabv4 provide C++ example.

    Is there examples any in C#?
  • No. We don't have an exact solution for your class assignment. But you can use the source code and solution we provide to create your own solution.

    sal
  • Hi Sal

    Thanks for clarification. One more question? Is this solution going to work only for SCI-A Boot mode? What if my boot mode is jump to flash and I would like to do a serial flash programming? is it possible ?

    Thanks
    Nick
  • It is intended to work with the SCIA boot loader. You can put a bootloading application in flash and boot to flash and begin to execute your own bootloader. You will need to modify your host application to accommodate and communicate with your bootloader. It is possible.

    Regards,
    sal
  • Thanks for response

    But I can't get to work from C#.
    Here is the main function that boot .a00 from GUI:

    .a00 is created using hex2000 like this:
    C:\ti\ccsv5\tools\compiler\c2000_6.1.0\bin\hex2000.exe" -i <My_outFile>.out -a -o <Converted_out_file>.a00 -boot -i2c8 -i2cpsc=0x1D -i2cclkh=0x05 -i2cclkl=0x0A


    I took this function from LightingDCDC source code

    public string LoadProgramFromFile(string port, string path)
    {
    try
    {
    char oldChar = 'X';

    this.Close(); //close port

    int oldBaud = Convert.ToInt32(cboBaudRate.Text);

    this.PortName = port;

    int BaudRate = 38400;

    this.Open();

    this.WriteString("A");
    int temp = Convert.ToInt32(this.ReadByte());
    if (temp == 65)
    {
    // Create an instance of StreamReader to read from a file.
    // The using statement also closes the StreamReader.
    using (StreamReader sr = new StreamReader(path))
    {
    byte[] echoedBytes = new byte[256];
    byte[] toBeTxedBytes = new byte[256];
    char readChar;
    int i = 0;

    while (sr.EndOfStream != true)
    {
    readChar = (char)(sr.Read());
    if ((readChar >= 'A' && readChar <= 'F') || (readChar >= '0' && readChar <= '9'))
    {
    if (oldChar != 'X')
    {
    byte b = (byte)(Convert.ToInt32(readChar.ToString(), 16) + (Convert.ToInt32(oldChar.ToString(), 16) * 16));

    oldChar = 'X';
    toBeTxedBytes[i] = b;
    i++;
    }
    else
    {
    oldChar = readChar;
    }
    }
    else
    {
    oldChar = 'X';
    }
    if (i == 256)
    {
    echoedBytes = this.WriteBytes(toBeTxedBytes);
    if (echoedBytes == null)
    {
    throw new InvalidProgramException();
    }
    //if (prb.Value >= 100)
    //{
    // prb.Value = 0;
    //}
    //prb.Value = prb.Value + 2;
    i = 0;
    }
    }
    if (i != 0)
    {
    byte[] byteBufferRemaining = new byte[i];
    for (int p = 0; p < i; p++)
    {
    byteBufferRemaining[p] = toBeTxedBytes[p];
    }
    echoedBytes = this.WriteBytes(byteBufferRemaining);
    if (echoedBytes == null)
    {
    throw new InvalidProgramException();
    }
    // prb.Value = 100;

    this.Close(); // close port
    BaudRate = oldBaud;
    return ("Program Successfully Loaded");
    }
    }
    this.Close(); //close port
    BaudRate = oldBaud;
    return ("Error: Program Did Not Load. Please Try Again.");
    }
    else
    {
    this.Close();
    BaudRate = oldBaud;
    return ("Error: Improper COM Port, Power is Off, Program was Already Loaded, or SCI Boot Jumper is Not Placed.");
    }


    }
    catch (Exception err)
    {
    this.Close();
    return ("Error: Program Did Not Load. Please Try Again.");
    }
    }




    any suggestions?
  • Nick,

    We will not be able to help you with this. If you have more specific questions regarding the SCI or the serial flash programmer or the bootloaders, then we will be able to provide you some more help.

    Regards,
    sal
  • Thanks

    Is really confusing and new to me all this stuff with with f28335 control card.

    Ok I read on a document that to have SCI-A boot mode I need to have GPIO 87,86 and 85 to 1 and 84 to 0, do I need to do it from CCS and push the project from CCS?

    Then I tried to use serial flash programming as you mentioned but I get assert error. I’m uploading blinky_dc_cpu_01 and blinky_dc_cpu02 by running this command :  

    serial_flash_programmer.exe -d f2803x -k f2837xD_fw_upgrade_example/blinky_dc_cpu01.txt -a f2837xD_fw_upgrade_example/blinky_dc_cpu02.txt -p COM9

    I get some assert error, do you have any suggestions?

    I also tried the GUI LIGHTING_DCDC_v2.2, on set up connection I get the right  port ,pressed on continue its says   “please make sure SCI Boot jumper is placed or that the target is flashed then try again” . My question is , what’s SCI boot jumper ? Do I physically place this jumper on docking station? If yes in which pin?

    Sorry if I ask all this question but is a bit confusing

    Thanks

    Nick