Unable to upload program when using STM32duino BootLoader

STM32duino bootloader aka Maple bootloader
Post Reply
TTXL3099
Posts: 4
Joined: Thu Aug 15, 2024 12:27 pm

Unable to upload program when using STM32duino BootLoader

Post by TTXL3099 »

I had problems using it on my Windows10 computer. For both arduinoIDE 1.8.19 and 2.0.0, he couldn't use the stm32duino bootloarder uploader. It seems that this is not a hardware problem, but a system or software problem.I have tried Windows10PRO 22H2 (19045) and Windows10 ltsc2019(17763). It can compile normally, but cannot be uploaded using the stm32duino BootLoader. Uploading with ST-LINK is no problem. From the output, the problem appears to be coming from "jSSC" in "JAVA".Relevant pictures and logs have been uploaded to GitHub
Seehttps://github.com/rogerclarkmelbourne/ ... issues/932 for details. I have created issues on github, but they have not been resolved.
All information output from the arduinoIDE 2.0.0 upload process:https://github.com/user-attachments/fil ... E2.0.0.txt

Image
Image
Image
by ag123 » Thu Aug 15, 2024 5:30 pm
if you are using libmaple core
that is based on JDK/Java 1.8 and earlier.
Apparently, from your logs you are using a recent JDK
# JRE version: OpenJDK Runtime Environment Microsoft-7209853 (17.0.6+10) (build 17.0.6+10-LTS)
# Java VM: OpenJDK 64-Bit Server VM Microsoft-7209853 (17.0.6+10-LTS, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, windows-amd64)
In addition, those DLL, binaries are backdated to like 10 years ago, with all the recent OS updates and such, more than likely in Windows it may not work.

you can try to figure out where is jssc installed in the core folders, and perhaps install an updated JSSC from github repository replacing it.
https://github.com/java-native/jssc

if you continue to have struggles with that, I'd suggest a few ways:
- use st-link to upload (you mentioned that it works)
- or use usb-uart to upload over uart 1, requires setting boot0 and pressing reset
- manually generating the bin file and upload manually (Sketch > export compiled binary)
- then use dfu-util
https://dfu-util.sourceforge.net/
from the command line to manually upload, normally command is like

Code: Select all

dfu-util -a 2 -RD sketch.bin
but that you have to install dfu-util on your own

in addition, stm32f103c8 don't have built-in usb bootloader, you need to install that using st-link v2
https://github.com/rogerclarkmelbourne/ ... r/binaries

and that this is mainly only for stm32f103c8 or cb boards.

for 'all other' boards, the STM core is here
https://github.com/stm32duino/Arduino_Core_STM32
the wiki is here
https://github.com/stm32duino/Arduino_Core_STM32/wiki
getting started guide is here
https://github.com/stm32duino/Arduino_C ... ng-Started

the official ST programming tool is this (stm32cube programmer)
https://www.st.com/en/development-tools ... eprog.html

and normally you need st-link, usb-uart (using boot0) if you are using stm32cube programmer
or if you are using boards that support DFU (e.g. in the stm32f4xx/g4xx series)
you can use stm32cube programmer to program it, you need to set boot0 even for DFU programming.

a main problem with old binary DLL is that it may not work in your system with all the recent OS updates.
as you are having issues with that if the JSSC given above didn't help
then use the stm32cube programmer instead, this requires st-link or a usb-uart dongle (requires setting boot0)
the official ST programming tool would likely work in windows as the DLL drivers are updated

you can use stm32cube programmer to manually upload the bin file even with (roger's) libmaple core.
select st-link as upload method and build
use the Sketch > export compiled binary option
you get your file in the project folder
then you can run stm32cube programmer to upload using st-link / usb-uart (set boot0, normally pa9 tx, pa10 rx) / DFU (usb) requires a supported device/board e.g. stm32f4xx / stm32g4xx
Go to full post
ag123
Posts: 1796
Joined: Thu Dec 19, 2019 5:30 am
Answers: 28

Re: Unable to upload program when using STM32duino BootLoader

Post by ag123 »

if you are using libmaple core
that is based on JDK/Java 1.8 and earlier.
Apparently, from your logs you are using a recent JDK
# JRE version: OpenJDK Runtime Environment Microsoft-7209853 (17.0.6+10) (build 17.0.6+10-LTS)
# Java VM: OpenJDK 64-Bit Server VM Microsoft-7209853 (17.0.6+10-LTS, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, windows-amd64)
In addition, those DLL, binaries are backdated to like 10 years ago, with all the recent OS updates and such, more than likely in Windows it may not work.

you can try to figure out where is jssc installed in the core folders, and perhaps install an updated JSSC from github repository replacing it.
https://github.com/java-native/jssc

if you continue to have struggles with that, I'd suggest a few ways:
- use st-link to upload (you mentioned that it works)
- or use usb-uart to upload over uart 1, requires setting boot0 and pressing reset
- manually generating the bin file and upload manually (Sketch > export compiled binary)
- then use dfu-util
https://dfu-util.sourceforge.net/
from the command line to manually upload, normally command is like

Code: Select all

dfu-util -a 2 -RD sketch.bin
but that you have to install dfu-util on your own

in addition, stm32f103c8 don't have built-in usb bootloader, you need to install that using st-link v2
https://github.com/rogerclarkmelbourne/ ... r/binaries

and that this is mainly only for stm32f103c8 or cb boards.

for 'all other' boards, the STM core is here
https://github.com/stm32duino/Arduino_Core_STM32
the wiki is here
https://github.com/stm32duino/Arduino_Core_STM32/wiki
getting started guide is here
https://github.com/stm32duino/Arduino_C ... ng-Started

the official ST programming tool is this (stm32cube programmer)
https://www.st.com/en/development-tools ... eprog.html

and normally you need st-link, usb-uart (using boot0) if you are using stm32cube programmer
or if you are using boards that support DFU (e.g. in the stm32f4xx/g4xx series)
you can use stm32cube programmer to program it, you need to set boot0 even for DFU programming.

a main problem with old binary DLL is that it may not work in your system with all the recent OS updates.
as you are having issues with that if the JSSC given above didn't help
then use the stm32cube programmer instead, this requires st-link or a usb-uart dongle (requires setting boot0)
the official ST programming tool would likely work in windows as the DLL drivers are updated

you can use stm32cube programmer to manually upload the bin file even with (roger's) libmaple core.
select st-link as upload method and build
use the Sketch > export compiled binary option
you get your file in the project folder
then you can run stm32cube programmer to upload using st-link / usb-uart (set boot0, normally pa9 tx, pa10 rx) / DFU (usb) requires a supported device/board e.g. stm32f4xx / stm32g4xx
Last edited by ag123 on Thu Aug 15, 2024 6:02 pm, edited 1 time in total.
TTXL3099
Posts: 4
Joined: Thu Aug 15, 2024 12:27 pm

Re: Unable to upload program when using STM32duino BootLoader

Post by TTXL3099 »

ag123 wrote: Thu Aug 15, 2024 5:30 pm if you are using libmaple core
that is based on JDK/Java 1.8 and earlier.
I uninstalled JAVA8 and installed JDK17, but the problem persists. :(
Yes, using ST-LINK you can download programs, but ST-LINK doesn't have a serial port, right? Maple has a virtual serial port, which is something that stlink can't do.

#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000007110b5db, pid=28052, tid=26100
#
# JRE version: Java(TM) SE Runtime Environment (17.0.12+8) (build 17.0.12+8-LTS-286)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (17.0.12+8-LTS-286, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, windows-amd64)
# Problematic frame:
# C [jSSC-2.8_x86_64.dll+0xb5db]
#
# No core dump will be written. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# E:\G\Mixly2.0RC4\arduino-cli\Arduino15\packages\stm32duino\tools\stm32tools\2021.3.18\win\hs_err_pid28052.log
#
# If you would like to submit a bug report, please visit:
# https://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
GonzoG
Posts: 459
Joined: Wed Jan 15, 2020 11:30 am
Answers: 32
Location: Prudnik, Poland

Re: Unable to upload program when using STM32duino BootLoader

Post by GonzoG »

Bootloader does not have VCP.
It's a normal USB port on board.
ag123
Posts: 1796
Joined: Thu Dec 19, 2019 5:30 am
Answers: 28

Re: Unable to upload program when using STM32duino BootLoader

Post by ag123 »

there are many serial port/terminal apps around
try things like putty
https://www.putty.org/

you don't need Arduino IDE for the serial port

the serial port normally works *only* after you install your *sketch*, e.g.

Code: Select all

void setup() {
	Serial.begin()
	while(!Serial);
	Serial.println("what is your name");
}

void loop() {
	if(Serial.available()) {
		Serial.print("hello ");
		int c = ' ';
		while(c != '\r') {
			while(!Serial.available());
			int c = Serial.read();
			Serial.print(c);	
		}		
	}
}
Last edited by ag123 on Thu Aug 15, 2024 6:11 pm, edited 2 times in total.
TTXL3099
Posts: 4
Joined: Thu Aug 15, 2024 12:27 pm

Re: Unable to upload program when using STM32duino BootLoader

Post by TTXL3099 »

ag123 wrote: Thu Aug 15, 2024 5:30 pm if you are using libmaple core
that is based on JDK/Java 1.8 and earlier.
Apparently, from your logs you are using a recent JDK
# JRE version: OpenJDK Runtime Environment Microsoft-7209853 (17.0.6+10) (build 17.0.6+10-LTS)
# Java VM: OpenJDK 64-Bit Server VM Microsoft-7209853 (17.0.6+10-LTS, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, windows-amd64)
In addition, those DLL, binaries are backdated to like 10 years ago, with all the recent OS updates and such, more than likely in Windows it may not work.

you can try to figure out where is jssc installed in the core folders, and perhaps install an updated JSSC from github repository replacing it.
https://github.com/java-native/jssc

if you continue to have struggles with that, I'd suggest a few ways:
- use st-link to upload (you mentioned that it works)
- or use usb-uart to upload over uart 1, requires setting boot0 and pressing reset
- manually generating the bin file and upload manually (Sketch > export compiled binary)
- then use dfu-util
https://dfu-util.sourceforge.net/
from the command line to manually upload, normally command is like

Code: Select all

dfu-util -a 2 -RD sketch.bin
but that you have to install dfu-util on your own

in addition, stm32f103c8 don't have built-in usb bootloader, you need to install that using st-link v2
https://github.com/rogerclarkmelbourne/ ... r/binaries

and that this is mainly only for stm32f103c8 or cb boards.

for 'all other' boards, the STM core is here
https://github.com/stm32duino/Arduino_Core_STM32
the wiki is here
https://github.com/stm32duino/Arduino_Core_STM32/wiki
getting started guide is here
https://github.com/stm32duino/Arduino_C ... ng-Started

the official ST programming tool is this (stm32cube programmer)
https://www.st.com/en/development-tools ... eprog.html

and normally you need st-link, usb-uart (using boot0) if you are using stm32cube programmer
or if you are using boards that support DFU (e.g. in the stm32f4xx/g4xx series)
you can use stm32cube programmer to program it, you need to set boot0 even for DFU programming.

a main problem with old binary DLL is that it may not work in your system with all the recent OS updates.
as you are having issues with that if the JSSC given above didn't help
then use the stm32cube programmer instead, this requires st-link or a usb-uart dongle (requires setting boot0)
the official ST programming tool would likely work in windows as the DLL drivers are updated

you can use stm32cube programmer to manually upload the bin file even with (roger's) libmaple core.
select st-link as upload method and build
use the Sketch > export compiled binary option
you get your file in the project folder
then you can run stm32cube programmer to upload using st-link / usb-uart (set boot0, normally pa9 tx, pa10 rx) / DFU (usb) requires a supported device/board e.g. stm32f4xx / stm32g4xx
I can't express how excited I am. Thank you, bro!
you can try to figure out where is jssc installed in the core folders, and perhaps install an updated JSSC from github repository replacing it.
I replaced the old version of jssc with the latest one and apparently it worked!

Code: Select all

maple_loader v0.1
Resetting to bootloader via DTR pulse
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Searching for DFU device [1EAF:0003]...
Reset via USB Serial Failed! Did you select the right serial port?
Assuming the board is in perpetual bootloader mode and continuing to attempt dfu programming...

Found it!

Opening USB Device 0x1eaf:0x0003...
Found Runtime: [0x1eaf:0x0003] devnum=1, cfg=0, intf=0, alt=2, name="STM32duino bootloader v1.0  Upload to Flash 0x8002000"
Setting Configuration 1...
Claiming USB DFU Interface...
Setting Alternate Setting ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
Transfer Size = 0x0400
bytes_per_hash=286
Starting download: [##################################################] finished!
state(8) = dfuMANIFEST-WAIT-RESET, status(0) = No error condition is present
Done!
Resetting USB to switch back to runtime mode
error resetting after download: usb_reset: could not reset device, win error: ָ�������ڵ��豸��



Used library Version Path
SimpleTimer          E:\G\Mixly2.0RC4\arduino-cli\libraries\SimpleTimer

Used platform      Version   Path
stm32duino:STM32F1 2021.3.18 E:\G\Mixly2.0RC4\arduino-cli\Arduino15\packages\stm32duino\hardware\STM32F1\2021.3.18
==Upload successful (took 10s)==
Everything works fine, all functions are working!
TTXL3099
Posts: 4
Joined: Thu Aug 15, 2024 12:27 pm

Re: Unable to upload program when using STM32duino BootLoader

Post by TTXL3099 »

GonzoG wrote: Thu Aug 15, 2024 5:56 pm Bootloader does not have VCP.
It's a normal USB port on board.
When using the STM32duino BootLoader, the data sent and received by the Serial program will also go through Maple Serial. This obviously eliminates the need for a USB to TTL module like the CH340. :D
ag123
Posts: 1796
Joined: Thu Dec 19, 2019 5:30 am
Answers: 28

Re: Unable to upload program when using STM32duino BootLoader

Post by ag123 »

libmaple (roger's) core use usb-serial by default,
in STM core
https://github.com/stm32duino/Arduino_Core_STM32
select USB (CDC) Serial as your serial port from the menu before you build.
that is the thing that gives you the VCP from the board/stm32 side.

you can use any terminal program, e.g. putty mentioned earlier
or arduino IDE if you prefer.
GonzoG
Posts: 459
Joined: Wed Jan 15, 2020 11:30 am
Answers: 32
Location: Prudnik, Poland

Re: Unable to upload program when using STM32duino BootLoader

Post by GonzoG »

TTXL3099 wrote: Thu Aug 15, 2024 6:11 pm
GonzoG wrote: Thu Aug 15, 2024 5:56 pm Bootloader does not have VCP.
It's a normal USB port on board.
When using the STM32duino BootLoader, the data sent and received by the Serial program will also go through Maple Serial. This obviously eliminates the need for a USB to TTL module like the CH340. :D
It's not a maple serial, it's a USB port of the MCU. The driver calls it "maple serial". It has nothing to do with bootloader or upload method.
Post Reply

Return to “USB bootloader”