LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Flashing A Firmware

Solved!
Go to solution

Thank you, but I don't know how to do that. Do u know any good tutorials online that can help me with the same. 

0 Kudos
Message 11 of 19
(1,331 Views)

All you need is to know is about string manipulation (Format into String, Concatenate Strings and alike) and file I/O.

Those are quite general and easy tasks.There are examples in the general tutorials and the LabVIEW help.

What's the main difficulty?

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 12 of 19
(1,326 Views)

Thank you, I am not talking about labview, I am talking about the cmd file. I am not sure how to make the cmd file accept input from an outer source. 

0 Kudos
Message 13 of 19
(1,320 Views)
Solution
Accepted by topic author govindsankar

I got a look at the documentation. For example, you may have an initial command string like

"STMFlashLoader -c --pn 2 -i STM8_32K"

then you concatenate the name of the chosen file:

"STMFlashLoader -c --pn 2 -i STM8_32K" + " -d --fn " + "chosenfile.hex"

then you decide to activate protection and concatenate another option:

"STMFlashLoader -c --pn 2 -i STM8_32K -d --fn chosenfile.hex" + " -p --erp".

The resulting string can be written to a text file with .cmd extension (example name: download.cmd).

 

Disclaimer: I'm not sure the example I gave is syntactically correct

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 14 of 19
(1,319 Views)

@govindsankar  ha scritto:

Thank you, I am not talking about labview, I am talking about the cmd file. I am not sure how to make the cmd file accept input from an outer source. 


No need to accept input from whatever: you want to generate the complete command line.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 15 of 19
(1,318 Views)

Thank You,

 

I created the cmd file and it is able to download into device. Now I try running the cmd file in labview using system-exec.vi. But it is not working. I have attached two screenshots. One is the sreenshot when I just run the cmd file. There it works properly. Next when I run the cmd file using labview system-exec.vi. Then it is just opening an empty  cmd page. I have attached the screenshot of that as well. Why is that. I have saved the cmd as .bat file. Is that the problem. 

Download All
0 Kudos
Message 16 of 19
(1,274 Views)

The empty command window is expected behaviour since the default for SystemExec() is to wait for the command to terminate "wait for completion? = True" and in that case the standard IO for the console is redirected to the LabVIEW SystemExec() and returned through the "standard output" string control in the front panel together with the "standard error", if the program reported any error. Since LabVIEW captured the standard IO, there is nothing for the command window to display.

 

You can set "run minimized" to true to not have that empty command line window popup on your screen.

 

You most likely do not want to set "wait for completion?" to False, as you really want to know when your flash script has finished.

 

But you can review the result of the command in the standard output and standard error controls of your System Exec VI.

 

Rolf Kalbermatter
My Blog
0 Kudos
Message 17 of 19
(1,269 Views)

Thank You, I just did what u said and I got it in standard output. But is there a way to have it in the cmd window or else, it is also fine if it is in standard output window as well. The problem is it takes around 30 seconds to flash the firmware and then verify. So when I do it in labview it will look like this 30 seconds nothing is happening and after 30 seconds the whole thing will appear in standard output. But if run it only in cmd window without labview then the cmd will show downloading line by line and not just the whole thing at the end. Is there a way to show that in labview as well that is line by line and not the whole thing together at the end in standard output. Thank You. 

0 Kudos
Message 18 of 19
(1,263 Views)

Not sure if it works: try redirecting output to a file, like this:

STMFlashLoader -c --pn 2 -i STM8_32K -d --fn chosenfile.hex > C:\temp\flashloader-output.txt

This command line should redirect the STMFlashLoader program output to a text file, located in a directory of your choice (here, C:\temp).

While the program is running, you may try to read and parse the file content. Not really super easy.

But not all the console programs support outputting to a file. Furthermore, the output file could be locked while opened by STMFlashLoader.

Give it a quick try.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 19 of 19
(1,254 Views)