Page 1 of 1

Failed to init device STM32 using Arduino

Posted: Sun Sep 10, 2017 3:15 pm
by idir93
Hello,
This is my first time I use STM32, I have followed the instructions provided in this link http://www.oddwires.com/blog/using-a-ge ... h-arduino/ but at the end I get this:
Failed to init device.
stm32flash 0.4

http://stm32flash.googlecode.com/

Using Parser : Raw BINARY
Interface serial_w32: 230400 8E1

What could be the reason?

Re: Failed to init device STM32 using Arduino

Posted: Sun Sep 10, 2017 9:57 pm
by terraduino
Hi,

I've the same error.

Code: Select all

stm32flash -w ~/Downloads/gd32f1_generic_boot20_pc13.bin -v -g 0x0 /dev/ttyUSB0 -b 115200
stm32flash Arduino_STM32_0.9

http://github.com/rogerclarkmelbourne/arduino_stm32

Using Parser : Raw BINARY
Interface serial_posix: 115200 8E1
Failed to init device.


stm32flash -w ~/Downloads/gd32f1_generic_boot20_pc13.bin -v -g 0x0 /dev/ttyUSB0
stm32flash Arduino_STM32_0.9

http://github.com/rogerclarkmelbourne/arduino_stm32

Using Parser : Raw BINARY
Interface serial_posix: 57600 8E1
Failed to init device.
I found multiple discussions related to Linux ch34x driver issues. However, the error message was a different. Therefore, I think it is not related to a missing parity implementation.

Some system infos

Code: Select all

uname -a
Linux tfbb 4.10.0-33-generic #37~16.04.1-Ubuntu SMP Fri Aug 11 14:07:24 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

lsmod | grep usbserial
usbserial              49152  1 ch341

dmesg | grep usbserial
[ 2365.756609] usbcore: registered new interface driver usbserial
[ 2365.756639] usbcore: registered new interface driver usbserial_generic
[ 2365.756665] usbserial: USB Serial support registered for generic
[ 2365.763650] usbserial: USB Serial support registered for ch341-uart
Note, I can upload code to the BluePill with ArduinoIDE and PlatformIO using the serial adapter and DFU, respectively. I followed the wiki to burn bootloader (generic_boot20_pc13.bin) via a Windows machine and the same USB serial adapter that fails with Linux. Hence, wiring and USB serial adapter should be fine.

Would be great if someone has an idea. Couldn't find a working solution.

Thanks & Best

Re: Failed to init device STM32 using Arduino

Posted: Sun Sep 10, 2017 10:18 pm
by RogerClark
The internal serial bootloader in the F103 does not work well with all USB to Serial adaptors.

Also ST32Flash does not seem to work as well as STM's own Windows EXE program.

You could try using different baud rates, but ultimately the F103 internal serial bootloader has issues which prevent it working with some combinations of hardware and software.

The only guaranteed way to upload or flash the bootloader is using a SWD programmer like STLink, or JLink or BlackMagic Probe etc

STLink clones only cost a few dollars and are widely available.

Re: Failed to init device STM32 using Arduino

Posted: Tue Sep 12, 2017 12:30 am
by terraduino
Thanks @RogerClark for the info.
I agree, the STLink clones are cheap enough. However, I would prefer to have not another device sit on my desk. Moreover, I would be tempted to buy some STM8 to put the STLink clone to good use :) And, unfortunately, the WAF is already low here ... ;)

Thanks & best