Port COM issue with blue pills

Generic boards that are not Maple or Maple mini clones, and don't contain the additional USB reset hardware
Jekert
Posts: 3
Joined: Tue Mar 07, 2017 9:41 pm

Port COM issue with blue pills

Postby Jekert » Fri Mar 10, 2017 7:33 pm

Hi !
I'm sorry if i put this topic in the wrong category.

I received my 2 firsts STM32F103C8T6 last week (ordered on Aliexpress here). So i have followed the instructions on the wiki but i can't get the things works. I'm on Win8x64 and Arduino 1.8.1 and 1.6.3 and this serial converter.

I have replaced R10 resistor on one of the board by a 1.5kOhm resistor and flash the two "without problems" ( http://puu.sh/uD2Ed/711f287275.png and the PC13 led blinks). But when i connect the micro-usb of one of the STM32 to the USB i can't find the COM PORT and upload a sketch in Arduino IDE (1.6.3 and 1.8.1) but i can see in the device manager the board in libusb-win32 devices-> Maple DFU.

I almost try every exe in the STM32duino git, installed Due and Zero packages, but i can't find how to resolve this.

User avatar
BennehBoy
Posts: 388
Joined: Thu Jan 05, 2017 8:21 pm
Location: Yorkshire
Contact:

Re: Port COM issue with blue pills

Postby BennehBoy » Fri Mar 10, 2017 7:56 pm

The COM port won't be enabled until you upload your first sketch to them, this happens over DFU...
-------------------------------------
https://github.com/BennehBoy

Jekert
Posts: 3
Joined: Tue Mar 07, 2017 9:41 pm

Re: Port COM issue with blue pills

Postby Jekert » Fri Mar 10, 2017 8:27 pm

I tried to upload an other sketch with the Serial Adapter (BOOT0 and BOOT1 to 0) but i get this :

Code: Select all

stm32flash 0.4

http://stm32flash.googlecode.com/

Using Parser : Raw BINARY
Interface serial_w32: 2304


or this one if i use STM32duino bootloader with the serial adapter :

Code: Select all

maple_loader v0.1
Resetting to bootloader via DTR pulse
Searching for DFU device [1EAF:0003]...
dfu-util - (C) 2007-2008 by OpenMoko Inc.
This program is Free Software and has ABSOLUTELY NO WARRANTY
Couldn't find the DFU device: [1EAF:0003]


If i place BOOT0 to 1 the device manager don't recognize the board after the upload and BOOT0 to 0.

How do you upload a sketch over DFU ?

Jekert
Posts: 3
Joined: Tue Mar 07, 2017 9:41 pm

Re: Port COM issue with blue pills

Postby Jekert » Sat Mar 11, 2017 12:20 pm

I think i found how to do this : just upload a blank sketch with STM32duino bootloader on BOOT0 and BOOT1 on 0 and without a COM Port selected.

victor_pv
Posts: 957
Joined: Mon Apr 27, 2015 12:12 pm

Re: Port COM issue with blue pills

Postby victor_pv » Sun Mar 12, 2017 11:50 pm

Jekert wrote:I think i found how to do this : just upload a blank sketch with STM32duino bootloader on BOOT0 and BOOT1 on 0 and without a COM Port selected.


The stm32duino bootloader only provides for DFU upload, and does not emulate a com port. The com port will only show up once you upload a sketch.

After uploading the bootloader with a usb2serial converter or an stlink, it will not be detected as USB Serial port, but as DFU device.
At that point you can use arduino to upload sketches. Once a sketch is uploaded, you will see the Maple serial port detected.

If the sketch crash, the serial may disappear, and the board may not reset itself when trying to upload a sketch. If that happens, just manualy restart the board while uploading and the bootloader will be detected and load the sketch.

Seem like you may have found out most of the above already, but just for clarification.

User avatar
RogerClark
Posts: 5467
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Port COM issue with blue pills

Postby RogerClark » Mon Mar 13, 2017 12:25 am

Guys

We get this sooooo often, that I wonder if somehow we should change the bootloader binary so that it contains both the bootloader and an empty sketch (so that the sketch provides the serial coms)

Though I'm not entirely sure the best way to do that. I could store the sketch binary in a file, but I'm not sure how to get the linker to link it into the correct address.

Perhaps the linker .ld file can have a segment in it for the sketch, and perhaps can even put the bin in that location.

Perhaps some clever person like Rick knows how to do it ;-)

Edit. Rather than a binary, the .elf file is probably better, but I'm still not sure how to tell the linker to merge it with the bootloader binary

User avatar
Rick Kimball
Posts: 729
Joined: Tue Apr 28, 2015 1:26 am
Location: Eastern NC, US
Contact:

Re: Port COM issue with blue pills

Postby Rick Kimball » Mon Mar 13, 2017 1:38 am

* I've not tried this but it might work

load bootloader
load echo sketch using native USB
see where the code ends, round up to page boundary
use stm32flash to read from x08000000 for the length of bootloader + length of sketch save to a file ...

So assuming the bootloader + sketch use 16k of flash, you something like this:

$ stm32flash -r bootandecho.bin -S 0x08000000:16384 /dev/ttyUSB0
-rick

User avatar
RogerClark
Posts: 5467
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Port COM issue with blue pills

Postby RogerClark » Mon Mar 13, 2017 6:58 am

Rick

I can read back the bootloader + sketch using STLInk, but I'd need to do it for every variant of the bootloader and do it again if the bootloader changed

I know there is a program called mergehex which is used to merge .hex files (Nordic use it to merge their SoftDevice and the Application binary)

But it seems a very round-about route to get to a binary, i.e convert both to HEX then merge then convert the merged hex back to a binary.

I found this

http://stackoverflow.com/questions/3276 ... ker-script

Answer #4, is what I was thinking of.

I think perhaps what #4 means is

doing something like this

https://gist.github.com/mmozeiko/ed9655cf50341553d282

but the address of

.section .rodata

would need to be set (somehow)

danieleff
Posts: 106
Joined: Thu Sep 01, 2016 8:52 pm
Location: Hungary
Contact:

Re: Port COM issue with blue pills

Postby danieleff » Mon Mar 13, 2017 8:14 am

Wouldn’t it be enough to pad the bootloader bin with zeros to 8K, then append the serial-blink bin to it at the end?

Code: Select all

dd if=/dev/zero bs=1 count=BYTE_COUNT_TO_8K >> bootloader.bin
cat serialblink.bin >> bootloader.bin

User avatar
RogerClark
Posts: 5467
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Port COM issue with blue pills

Postby RogerClark » Mon Mar 13, 2017 10:45 am

Yes. That would work.

But only on Linux.

I just tried it on Windows and my dd doesnt have /dev/zero (as it appears to be picking up a copy of dd from WinAVR I installed ages ago)


Perhaps we can just tell the linker to fill to what it thinks is the end of flash

https://mcuoneclipse.com/2014/06/23/fil ... nu-linker/


Return to “Generic STM32F103”

Who is online

Users browsing this forum: MSNbot Media and 2 guests