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.

TMS320F28379D: SCI flash programming without knowing the passcode

Part Number: TMS320F28379D
Other Parts Discussed in Thread: C2000WARE

Hi, 

I'm using SCI flash programming "serial_flash_programmer.exe"

Within the exe. and input the command line"serial_flash_programmer.exe  -d f2837xD -k F2837xD_sci_flash_kernels_cpu01.txt  -a blinky_dc_cpu01.txt -b 9600 -p COM5"

I can download the flash kernel to F28379 and get the feedback:

What operation do you want to perform?
1-DFU CPU1
2-DFU CPU2
3-Erase CPU1
4-Erase CPU2
5-Verify CPU1
6-Verify CPU2
7-Unlock CPU1 Zone 1
8-Unlock CPU1 Zone 2
9-Unlock CPU2 Zone 1
10-Unlock CPU2 Zone 2
11-Run CPU1
12-Reset CPU1
13-Run CPU1 and Boot CPU2
14-Reset CPU1 and Boot CPU2
15-Run CPU2
16-Reset CPU2
0-DONE

And then I need to input my choice. For example if the device is locked: 

7-Unlock CPU1 Zone 1  then input passcode
8-Unlock CPU1 Zone 2  then input passcode

This is okay if I'm a software developer. But when the customer do this in mass production, it's complicated. Moreover, it's not that safe to let someone other than the software developer to know the passcode. So I wonder if there is a way to wrap up all these steps, and those who need to upgrade the software only need to click the mouse and it's all done.

I think the batch file should be a good choice.

I creat a .bat file and it can load the flash kernel into the device just by double click this file

"set /p num=please input com port number

serial_flash_programmer.exe  -d f2837xD -k F2837xD_sci_flash_kernels_cpu01.txt  -a blinky_dc_cpu01.txt -b 9600 -p COM%num%"

But I have trouble to wait for the flash kernel to be loaded to the device and do the appropriate choice, how can i do something like the following in a batch file

if(received packet="What operation do you want to perform?")

 1

else

 wait

Appreciate it If you have any good suggestion.

  • Hi Howard,

    I agree that using a batch file is a good solution for this problem. While I can't say absolutely what the specific syntax should be for your batch file, I believe you should consider using the FIND command to search for the string "What operation do you want to perform?" and use  a while loop-like structure to continue looping until the string is found. Loops can be achieved by creating labels as ":label" and having a "goto :label" statement at the end of the loop logic. This should simulate a "wait" command until the FIND command returns true.

    Please let me know if this helps solve your problem.


    Thanks,

    Taumer

  • Taumer,

    I've written such codes in .bat file

    "set /p num=please input com port number

    serial_flash_programmer.exe  -d f2837xD -k F2837xD_sci_flash_kernels_cpu01.txt  -a blinky_dc_cpu01.txt -b 9600 -p COM%num% -v

    type COM3 > data.txt"

    I find that windows seems to be always in "serial_flash_programmer.exe" and will not implement "type COM3 > data.txt" until I write command 0 to exit the application like below.

    If it's the case, it seems that the .bat file cannot achieve what I'm looking for unless I change "serial_flash_programmer.exe".

  • And I find that "What operation do you want to perform?" is not from the COM port, but written in "serial_flash_programmer.exe"
  • Hi Howard,

    You're correct in that the prompt is output from the serial_flash_programmer directly, so modifying the serial_flash_programmer source could be a viable option to solve your problem. If you know what inputs you plan to pass, you could essentially bypass the prompt and hard-code those options directly. The source for the serial_flash_programmer is included in C2000Ware and can be modified and built using VisualStudio.

    I've also done some digging and I am curious if you would be able to pass the input in your call to the serial_flash_programmer.exe command:

    echo 1 | serial_flash_programmer.exe  -d f2837xD -k F2837xD_sci_flash_kernels_cpu01.txt  -a blinky_dc_cpu01.txt -b 9600 -p COM%num% -v

    Do either of these options work for you?

    Thanks,

    Taumer

  • With this:

    echo 1 | serial_flash_programmer.exe  -d f2837xD -k F2837xD_sci_flash_kernels_cpu01.txt  -a blinky_dc_cpu01.txt -b 9600 -p COM%num% -v

    it kept downloading and it seems endless.

  • Hi Howard,

    It seems like the serial_flash_programmer is recording the "1" option and storing it as the response every time, causing this infinite loop. I was able to get this to work:

    echo 1 0 | serial_flash_programmer.exe -d f2837xD -k F2837xD_sci_flash_kernels_cpu01.txt -a blinky_dc_cpu01.txt -b 9600 -p COM%num% -v

    This command will choose option 1 and then option 0, exiting the application. In theory, you can do any combination of actions as long as 0 is the last choice to make the sure program exits.

    Let me know if this works for you.

    Thanks,
    Taumer
  • Thank you, it works. Could you please tell me what "|" means?

  • Hi Howard,

    The pipe operator "|" redirects output and can be used between commands: cmd A | cmd B. In our case, the first command is an echo, which just repeats the input, which is then redirected into the input of cmd B, which is the call to the serial_flash_programmer.exe. When the serial_flash_programmer defers to the console for input, the result of the echo command will be automatically inserted. Here is a link that describes more about syntax redirection in windows: .

    Thanks,

    Taumer