Spark Logic

Maple mini clone first program

marcin.kasinski Fri Oct 02, 2015 8:55 am

Hi.

First sorry if my question is stupid.

I’m newbie.

I want to move from arduino to stm

I have the same board described here by Roger:
http://www.rogerclark.net/stm32f103-and … 1-5-x-ide/

Environment
Windows 10
Arduino IDE 1.7.7.

I can not upload simple program from this link

I tried to prepare my environment cccording to Rogers’s description.

I see some diferences and I have small questions

Using Arduino IDE 1.7.7 I dont have “STM32 to FLASH – no bootloadrer” board.

I used “Generic STM32F103RB”.

In this tutorial there is step 12:
“On the Maple mini, press and hold the “Button” then tap and release “reset”. This puts the board into serial flash upload mode”

My question is :
Where id “Button” on this board ?

I just pressed reset and click upload my program.

Unfortunately I got error:

Failed to init device.
stm32flash 0.4

http://stm32flash.googlecode.com/

Using Parser : Raw BINARY
Interface serial_w32: 230400 8E1

Any hel please ?

Replies

ahull Fri Oct 02, 2015 10:10 am

When you plug in the board, how does it show up in windows device manager?

You may need to plug in a serial to USB cable to program the board if it does not have a bootloader installed by the supplier. Some of the board I have received simply had a blink example pre-programmed, others had the maple bootloader pre-loaded.

If you need to go down the line of using an external programmer to get a boot loader flashed to the board, I would suggest you pick up one of the cheap ST-Link clones on ebay, thiese will allow you to program the thing even if like me, you have a habit of completely scrambling its brains. These only cost a couple of bucks, and they are really useful. Armed with one of the ST-Link V2 clones, you can then flash a bootloader on to your board, then put the ST-Link to one side, and program using the bootloader. If the worst happens and you appear to have bricked the board, grab the ST-Link, erase the flash with it, re-install the bootloader and start again.

One other point, STFlash states “Open source cross platform flash program for the STM32 ARM microcontrollers using the built-in ST serial bootloader over UART or I2C” in other words, you need a usb to serial adapter to use stflash, and you need to connect the correct pins *and* set the correct BOOT jumpers for this to work.

madias Fri Oct 02, 2015 10:16 am

This is to so called “blue pill” board. It doesn’t have a bootloader on board.
So, as Andy said, you need
a) a Serial USB Converter or
b) a ST Link 2 dongle
(both are for less than 3-4 USD on aliexpress)
With this devices you can upload a bootloader to your board and then you can upload sketches directly via USB.
If you own an Arduino UNO you can hijack it as serial converter. (Just must get the DIP-ATMega328 out first then you can use “0” as RX and “1” as TX)

ahull Fri Oct 02, 2015 10:21 am

To clarify, we are talking about two different bootloaders. The ST32F10XX has a built in Serial bootloader. This is always available, but requires a serial interface on your PC (the USB to serial converter I described).

There is also an optional USB bootloader, but this is written to the board using the serial boot loader, or using the JTAG /ST-Link method.

If you search this forum, and Rogers Wiki, you will find all of the details there.

marcin.kasinski Fri Oct 02, 2015 12:09 pm

Thank you all for reply.

Now I can upload using serial.

I will try do upload bootloader and use USB .

marcin.kasinski Fri Oct 02, 2015 2:12 pm

Hi I have another question.

I’ve downloaded maple_mini_boot20.bin from https://github.com/rogerclarkmelbourne/ … 1/binaries

Then I’ve executed :

serial_upload.bat COM3 {upload.altID} {upload.usbID} D:\temp\maple_mini_boot20.bin

After that I’ve received error below:

http://stm32flash.googlecode.com/

Using Parser : Raw BINARY
Interface serial_w32: 230400 8E1
Version : 0x22
Option 1 : 0x00
Option 2 : 0x00
– RAM : 20KiB (512b reserved by bootloader)
– Flash : 128KiB (sector size: 4×1024)
– Option RAM : 16b
– System RAM : 2KiB
Write to memory
Erasing memory
Wrote address 0x08007200 (99.70%) Error: WRITE address and length must be 4 byte aligned
Failed to write memory at address 0x08007200

zoomx Fri Oct 02, 2015 3:42 pm

If I am not wrong and you have a board that it is not a maple you can’t use maple bootloader. You must use the generic one but I don’t know wich one.

ahull Fri Oct 02, 2015 3:51 pm

The board in question is the “Blue Pill” STM32F103C8T6 – it has the LED on PC13 – so you should be able to use the pre-built“generic_boot20_pc13.bin”bootloader. See the Wiki for more details.

marcin.kasinski Fri Oct 02, 2015 4:01 pm

With generic_boot20_pc13.bin I’ve got the same error:

Wrote address 0x08007200 (99.64%) Error: WRITE address and length must be 4 byte aligned
Failed to write memory at address 0x08007200

ahull Fri Oct 02, 2015 4:19 pm

What version of stm32flash are you using?

marcin.kasinski Fri Oct 02, 2015 4:23 pm

Additional info:

After fourth download I could install bootloader.
Now dfu works fine.

Do you know why with first 3 attempts I couldn’t do it. Why I had to redownload the file ?

I have latest version of Arduino_STM32-master.

stevech Fri Oct 02, 2015 7:38 pm

Is there a rationale for struggling with a DIY bootloader for the STM32F’s instead of using one of the STM32’s that has one built into ROM?

RogerClark Fri Oct 02, 2015 8:02 pm

Is there a rationale for struggling with a DIY bootloader for the STM32F’s instead of using one of the STM32’s that has one built into ROM?

The F103 doesnt have a USB bootloader it only had a hardware serial bootloader, which means that you need external hardware to flash the F103 using its own internal bootloader,
where as with the USB bootloader code you can flash via DFU and USB and dont need any additional hardware

mrburnette Sat Oct 03, 2015 3:28 pm

stevech wrote:Is there a rationale for struggling with a DIY bootloader for the STM32F’s instead of using one of the STM32’s that has one built into ROM?

darth_llamah Sat Oct 03, 2015 4:30 pm

marcin.kasinski wrote:Do you know why with first 3 attempts I couldn’t do it. Why I had to redownload the file ?

marcin.kasinski Mon Oct 05, 2015 8:53 am

Hello.

I uploaded bootloader to my second blue pill

Now I have problem with serial port.

On first device after every uploading using dfu or after reconnecting “maple serial port” device disappears from device manager and I can not upload another program. To solve it I have to install drivers again.

On second device “maple serial port” disappeared permanently. Installing drivers doesn’t help here.

Is it deviceid problem or something?
Am I doing something wrong ?

darth_llamah Mon Oct 05, 2015 9:34 am

marcin.kasinski wrote:On first device after every uploading using dfu or after reconnecting “maple serial port” device disappears from device manager and I can not upload another program. To solve it I have to install drivers again.
On second device “maple serial port” disappeared permanently. Installing drivers doesn’t help here.

Is it deviceid problem or something?
Am I doing something wrong ?

marcin.kasinski Mon Oct 05, 2015 10:51 am

Thank you for your reply.

I’m using official Arduino_stm32 .
I’ve installed bootloader on both devices.

I can see that on both devices I can upload program using DFU.

Problem is that I would like to see UART messages generated by my code . I need com port to connect to.

Like I said I can connect to one device after reinstalling drivers. I can see com port using windows device management. every upload and reconnecting deletes com port from windows deveice management.
I can upload program but I can not connect to my second device. There is no com port in my windows device management.

Upload outut:

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=258
Starting download: [##################################################] finished!
state(8) = dfuMANIFEST-WAIT-RESET, status(0) = No error condition is present
error resetting after download: usb_reset: could not reset device, win error: Nie można odnaleźć określonego pliku -> can not find file.
Done!

Resetting USB to switch back to runtime mode

Sign in to reply