Setup of STM32F103CBT6 (Maple Mini) board

Generic boards that are not Maple or Maple mini clones, and don't contain the additional USB reset hardware
Phil333
Posts: 23
Joined: Mon Jan 16, 2017 3:26 pm

Setup of STM32F103CBT6 (Maple Mini) board

Post by Phil333 » Mon Jan 16, 2017 3:48 pm

Hello guys,

I bought an STM32F103CBT6 board from aliexpress because I found it on a quick search to be Arduino compatible.

As it arrived I followed all the steups on Rogers instrutions in my Win7 x64 PC.

After that was done I chose in the Arduino IDE the board "Generic STM32F103C series", as variant "STM32F103CB", changed the CPU frequency and the upload method for all cases.
I tried to Upload just with an USB-cable (no FTDI Adapter involved because some Instructions I found with that didnt work)

I always got the Error:
============================
Failed to init device.
stm32flash 0.4

http://stm32flash.googlecode.com/

Using Parser : Raw BINARY
Interface serial_w32: 230400 8E1
============================

As Port I had chosen something like "Com32 (Maple Serial)" - I'm not sure what it was exactly called.

After I found someone with a similar issue and it was given the advice to select "Maple (Rev 3)" as board I tried that.
It compiled and loaded the sketch (blink) to the board and it worked.

BUT: Since then the Port (Com32 (Maple Serial) ) is gone and I have no option to do any serial communication to the board via the Serial Monitor of the Arduino IDE.
I also found this "device" (something with maple or DFU) in the hardware manager of my Windows PC.
Now I cant see anything anymore.

I can still upload sketches, but there is NO Port selected in the IDE.
It seems to chose a "hidden" Port that I cant find and not communicate with.

If I upload another blink sketch, I get:
============================
maple_loader v0.1
Resetting to bootloader via DTR pulse
Reset via USB Serial Failed! Did you select the right serial port?
Searching for DFU device [1EAF:0003]...
Assuming the board is in perpetual bootloader mode and continuing to attempt dfu programming...
============================

It stops here and I have to manually push the reboot button on the board. Then it keeps going on with:
============================
Found it!

Opening USB Device 0x1eaf:0x0003...
Found Runtime: [0x1eaf:0x0003] devnum=1, cfg=0, intf=0, alt=1, name="DFU Program FLASH 0x08005000"
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=258
Starting download: [##################################################] finished!
error resetting after download: usb_reset: could not reset device, win error: Das System kann die angegebene Datei nicht finden.


state(8) = dfuMANIFEST-WAIT-RESET, status(0) = No error condition is present
Done!
Resetting USB to switch back to runtime mode
============================

Can you tell me what I am doing wrong and what I could do to get also the serial communication working for debugging stuff and so on?

Thanks a lot!
Last edited by Phil333 on Tue Jan 17, 2017 1:41 pm, edited 1 time in total.

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

Re: Setup of STM32F104CBT6 board

Post by danieleff » Mon Jan 16, 2017 4:04 pm

That board is the Maple Mini http://wiki.stm32duino.com/index.php?title=Maple_Mini , so perhaps by selecting that in the boards menu will fix your problem.

Phil333
Posts: 23
Joined: Mon Jan 16, 2017 3:26 pm

Re: Setup of STM32F104CBT6 board

Post by Phil333 » Mon Jan 16, 2017 4:32 pm

Thanks a lot danieleff!!

This worked with 72MHz and the Original Bootloader to show the COM Port (COM32 (Maple Mini) again.

What is the 48MHz (Slow - with USB) and the Booloader for?
I flashed the 72MHz also with USB.

After flashing this, I can not flash the Bootloader 2.0 sketch.

I get this message:
===================================
maple_loader v0.1
Resetting to bootloader via DTR pulse
Searching for DFU device [1EAF:0003]...
Found it!
Cannot set alternate interface: usb_set_altinterface: could not set alt interface 0/2: win error: Es sind keine Daten mehr verfügbar.



Opening USB Device 0x1eaf:0x0003...
Found Runtime: [0x1eaf:0x0003] devnum=1, cfg=0, intf=0, alt=2, name="UNDEFINED"
Setting Configuration 1...
Claiming USB DFU Interface...
Setting Alternate Setting ...
===================================

So simply upload the Bootloader by choosing it at the IDE doesnt work?
Should I then use this Sketch and upload it via the "Original" bootloader and then let it "update" using the Serial commands?
Or will I destroy the board then :D

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

Re: Setup of STM32F104CBT6 board

Post by danieleff » Mon Jan 16, 2017 5:07 pm

Unless you really need the extra kilobytes of flash memory, you do not need to change the bootloader. (Same with 48MHz, saves (small) power... if running from battery.)

Phil333
Posts: 23
Joined: Mon Jan 16, 2017 3:26 pm

Re: Setup of STM32F104CBT6 board

Post by Phil333 » Mon Jan 16, 2017 6:30 pm

3K of Memory is a lot ;)

I gave it a try and ended with:

**************************************************************************************************
*** This sketch will update the bootloader in the Maple Mini to the STM32duino bootloader ****
*** With this you can use up to 120KB of Flash and 20KB of RAM for a Sketch ****
*** Uploading is also considerably faster on OSX (and possibly faster on Linux) ****
*** ****
*** Only use with Maple mini boards ****
*** ****
*** WARNING. If the update fails your Maple mini may not have a functional bootloder. ****
*** ****
*** YOU UPDATE AT YOUR OWN RISK ****
*** ****
*** ****
*** ****
*** ****
**************************************************************************************************
*** ****
*** ****
*** To confirm and proceed, enter Y ****
*** ****
*** ****

WARNING, Update Failed!! The sketch will restart in 3 seconds and you can try to flash again




any ideas? :D

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

Re: Setup of STM32F104CBT6 board

Post by RogerClark » Mon Jan 16, 2017 8:53 pm

If you have a USB to Serial converter, you can flash the bootloader using that, instead of the sketch.

But, the sketch always worked for me. But perhaps some vendors started to lock the bootloader flash pages.

User avatar
ahull
Posts: 1582
Joined: Mon Apr 27, 2015 11:04 pm
Location: Sunny Scotland
Contact:

Re: Setup of STM32F104CBT6 board

Post by ahull » Mon Jan 16, 2017 11:44 pm

Can I ask, the title of the post is "Re: Setup of STM32F104CBT6 board" am I correct in saying it should actually be "Re: Setup of STM32F103CBT6 board"?
- Andy Hull -

Phil333
Posts: 23
Joined: Mon Jan 16, 2017 3:26 pm

Re: Setup of STM32F104CBT6 board

Post by Phil333 » Tue Jan 17, 2017 1:40 pm

@ahull: you are right!
It even better should have been "setup of Maple Mini".

I tried the Sketch a couple of times and always get the same error.

I also the method posted on this site, but the stm32flash.exe just puts out a cmd window for 100ms and is not working on my PC.

I also downloaded "STM’s own Serial uploader" that Roger liked on that site.
I had no idea how to connect it so I connected it firstly via USB and tried with 115200 baud and even parity but the flash_loader_demo_v2.8.0 gave me a "No response from target" message.
Then I put the board into serial bootloader mode, by pressing and hold reset and but=32, release reset, and then release but=32.
Same message from the Tool.

I then connected everythink with a USB<=>Serial bridge like in the blog I posted.
On both, the normal mode and the serial bootloader mode I get "no response from target" messages.

Is there anywhere a good guide how to flash the bootloader 2.0 ?

stevestrong
Posts: 1521
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: Setup of STM32F103CBT6 (Maple Mini) board

Post by stevestrong » Tue Jan 17, 2017 2:42 pm

It should work if you follow exactly the steps written here.
Note, that on the maple mini, beside connecting BOOT0 (PB8) to "high", you have to connect BOOT1 pin (PB2) to GND in order to work.
See here the maple mini pinout.
Additionally, you need to open the CMD window (to execute the flash executable) as admin.
Last edited by stevestrong on Tue Jan 17, 2017 3:48 pm, edited 1 time in total.

User avatar
ahull
Posts: 1582
Joined: Mon Apr 27, 2015 11:04 pm
Location: Sunny Scotland
Contact:

Re: Setup of STM32F104CBT6 board

Post by ahull » Tue Jan 17, 2017 3:28 pm

RogerClark wrote:If you have a USB to Serial converter, you can flash the bootloader using that, instead of the sketch.

But, the sketch always worked for me. But perhaps some vendors started to lock the bootloader flash pages.
One of my recent Bluepills did have the bootloader flash locked, I used my ST-Link clone to unlock it with the openeocd "stm32f1x unlock" command.

Details of how to do this here -> https://github.com/rogerclarkmelbourne/ ... from-Linux

There are other simpler ways to do this no doubt, but this worked for me.
- Andy Hull -

Post Reply