Problem uploading a bin file to Industruino D21G
Hi everyone,
I am trying to find a way to upload a compiled bin file to Industruino D21G to be able to send updates to the clients which they could upload themselves. So far, no joy.
I have tried two ways so far.
1. Set verbose output, copy the same command used by Arduino IDE (which works fine), which in my test case looks like
C:\Users\Peter\AppData\Local\Arduino15\packages\industruino\tools\bossac\1.7.0-industruino/bossac-0x4000.exe -i -d --port=COM18 -U true -i -e -w -v C:\Users\Peter\AppData\Local\Temp\arduino_build_947395/PVMaster.ino.bin -R
But the only output it produces is "Set binary mode" output and then nothing else happens.
2. Tried installing separate BOSSA release from https://github.com/shumatech/BOSSA/releases
I am running Win7 x64, so I tried x64 version, but that one freezes on selecting the COM port.
Any ideas what could be wrong or what other way I could try?
Since no signed driver for Industruino for Windows 11, this is a modified batch file to flash D21G using bossac 1.9.1:
@echo off
echo Upgrade procedure starting.
if %1.==. goto error
set binfile=%1
set comportA=NONE
set comportB=NONE
::if not exist %binfile% goto error
for /f "usebackq" %%B in (`wmic path Win32_SerialPort Where "PNPDeviceID LIKE '%%USB\\VID_2E78&PID_804D%%'" Get DeviceID ^| FIND "COM"`) do set comportA=%%B
if %comportA%==NONE goto nodevice
echo Com Port for Arduino device is detected as %comportA%.
echo Reset Arduino into bootloader
mode %comportA%: baud=12 > nul
timeout 2 > nul
for /f "usebackq" %%B in (`wmic path Win32_SerialPort Where "PNPDeviceID LIKE '%%USB\\VID_2E78&PID_004D%%'" Get DeviceID ^| FIND "COM"`) do set comportB=%%B
if %comportB%==NONE goto nobldevice
echo Com Port for Arduino bootloader device is detected as %comportB%.
echo.
echo Starting Uploader...
bossac.exe --port=%comportB% --offset=0x4000 -i -e -w -v %binfile% -R
goto upgradedone
:nodevice
echo No matching module found, you should connect the module you want to upgrade.
goto end
:nobldevice
echo Reset into bootloader failed, please try again...
goto end
:error
Echo Missing parameter or file, you should provide the full filename of an existing .bin file you want to use.
goto end
:upgradedone
echo.
echo Upgrade done!
:end
Hi Tom, that was exactly what was needed!
I succeeded with the following .bat file that takes .bin file as a parameter
@echo off
echo Upgrade procedure starting.
if %1.==. goto error
set binfile=%1
set comportA=NONE
set comportB=NONE
::if not exist %binfile% goto error
for /f "usebackq" %%B in (`wmic path Win32_SerialPort Where "Caption LIKE '%%Industruino D21G%%'" Get DeviceID ^| FIND "COM"`) do set comportA=%%B
if %comportA%==NONE goto nodevice
echo Com Port for Arduino device is detected as %comportA%.
echo Reset Arduino into bootloader
mode %comportA%: baud=12 > nul
timeout 2 > nul
for /f "usebackq" %%B in (`wmic path Win32_SerialPort Where "Caption LIKE '%%Industruino D21G%%'" Get DeviceID ^| FIND "COM"`) do set comportB=%%B
if %comportB%==NONE goto nobldevice
echo Com Port for Arduino bootloader device is detected as %comportB%.
echo.
echo Starting Uploader...
bossac-0x4000.exe -i -d --port=%comportB% -U true -i -e -w -v %binfile% -R
goto upgradedone
:nodevice
echo No matching module found, you should connect the module you want to upgrade.
goto end
:nobldevice
echo Reset into bootloader failed, please try again...
goto end
:error
Echo Missing parameter or file, you should provide the full filename of an existing .bin file you want to use.
goto end
:upgradedone
echo.
echo Upgrade done!
:end
Hi, i think the command you took from the Arduino IDE should work, but the D21G has to be put into bootloader mode first. The IDE does this like this: "Forcing reset using 1200bps open/close on port /dev/ttyACM0"
On my Linux laptop i can do this at the command line:
stty -F /dev/ttyACM0 ispeed 1200 ospeed 1200
Sorry i have no idea how to do this on Windows
If you want to test this manually first, you could hit the reset button on the bottom of the baseboard twice, that will also activate the bootloader, then the board is ready to receive the .bin
Your answer
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
Keep Informed
About This Forum
This community is for professionals and enthusiasts of our products and services.
Read GuidelinesQuestion tools
Stats
Asked: 11/5/19, 9:21 AM |
Seen: 2620 times |
Last updated: 11/30/22, 4:38 PM |
I tried this script on Windows 11, but it hangs when the bossac command is invoked. Any ideas?