some sectors are write protected

Post here first, or if you can't find a relevant section!
dev
Posts: 62
Joined: Sun Feb 19, 2017 8:41 am

some sectors are write protected

Post by dev » Fri Nov 10, 2017 11:01 am

Hi,
I was flashing maple mini with st-link clone and st-link utility. I was facing problem while flashing. I got following some error

Code: Select all

16:26:02 : Some flash sectors are write protected.
                  The write protection will be disabled then restored after flash programming
                  in case there is no option bytes segment within the file.
16:26:05 : Programming error @ 0x0800001C!

USB is not working after that.
i tried erasing complete chip then also same error.

------Updated----------
I tried with arduino as well. Led is blinking but board is not detecting as DFU device. But it is detected as COM port.

Here are the few output window logs.

Code: Select all

Build options changed, rebuilding all
Sketch uses 12796 bytes (11%) of program storage space. Maximum is 110592 bytes.
Global variables use 2816 bytes of dynamic memory.
maple_loader v0.1
Resetting to bootloader via DTR pulse
Searching for DFU device [1EAF:0003]...
dfu-util - (C) 2007-2008 by OpenMoko Inc.
Couldn't find the DFU device: [1EAF:0003]
This program is Free Software and has ABSOLUTELY NO WARRANTY

i tried with dfu-util as well. here are the logs.

Code: Select all

\AppData\Local\Temp\arduino_build_6966\led_blink.ino.bin -R
dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

Invalid DFU suffix signature
A valid DFU suffix will be required in a future dfu-util release!!!
No DFU capable USB device available

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

Re: some sectors are write protected

Post by ahull » Fri Nov 10, 2017 11:27 am

That rings a bell with me.

I encountered a similar issue a while back - This -> https://github.com/rogerclarkmelbourne/ ... from-Linux <- might give some clues.

In particular I think the line ...
NOTE: If the chip flash is protected, you may also need to issue a "stm32f1x unlock" command.
... might be of importance. It was a while ago, so I doubt if I can recall what all else I tried, when attempting to address my issue, and your problem may be subtly different.
- Andy Hull -

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

Re: some sectors are write protected

Post by victor_pv » Fri Nov 10, 2017 6:30 pm

There was some discussion in the forum about maple mini clones coming with the bootloader sectors write protected, that was several months ago.

Just remove the write protection with st-link if you dont need it, and reflash the bootloader.

dev
Posts: 62
Joined: Sun Feb 19, 2017 8:41 am

Re: some sectors are write protected

Post by dev » Sat Nov 11, 2017 6:09 pm

Thanks. I re-flashed the bootloader named as "generic_boot20_pc13.bin", then also arduino ide is not able to flash code in it.
I opened serial terminal and got following messages continously.

Code: Select all

Congratulations, you have installed the STM32duino bootloader
See https://github.com/rogerclarkmelbourne/STM32duino-bootloader


For more information about Arduino on STM32
and http://www.stm32duino.com
USB is detecting as COM port.
I tried flashing STM32duino bootloader as well as Serial. But got different errors for each of them.

Code: Select all

Error probing interface "serial_w32"
stm32flash 0.4
Cannot handle device "COM7"

Failed to open port: COM7
http://stm32flash.googlecode.com/

Using Parser : Raw BINARY
i think something is going wrong. this was my 3rd blue pill which giving same error. Here is the stlink utility error.
error.JPG
error.JPG (17.53 KiB) Viewed 114 times
Any clue?

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

Re: some sectors are write protected

Post by stevestrong » Sat Nov 11, 2017 8:01 pm

When uploading over USB (DFU) (stm32duino bootloader) you might need to reset the board when the "searching for bla...bla" appears.

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

Re: some sectors are write protected

Post by RogerClark » Sat Nov 11, 2017 8:12 pm

The bootloader file you mentioned is not the correct one for the maple mini.

dev
Posts: 62
Joined: Sun Feb 19, 2017 8:41 am

Re: some sectors are write protected

Post by dev » Sun Nov 12, 2017 3:13 pm

I took bootloader file from your repo. I am not sure which file to use. So i took randomely.

After some reading on STM32duino's wiki page i am really confused.
I tried maple_rev5_boot20.bin, generic_boot20_pb12.bin as well.
i am using stm32f103c8t6.

but result is same. not able to flash over usb bootloader.

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

Re: some sectors are write protected

Post by Rick Kimball » Sun Nov 12, 2017 4:36 pm

Using the Aduino IDE with the maple mini and expecting to use the stlink device as a programmer and using the native USB is just an exercise in frustration.

For the maple mini, there is no upload method option using Stlink, Black Magic Probe, or Serial. This is for good reason, if you upload using any of those methods, it is going to overwrite the bootloader and you won't be able use the normal upload method people expect the Maple Mini to use.

So people resort to using the generic stm32f103 entry. However, you can't really use the generic board selection because the USB reset circuitry for the Maple Mini and the Generic boards are incompatible. Also all the pin numbers will be wrong and the Maple Mini doesn't have the PAnn, PBnn, or PCnn pins marked. So you have to get out the datasheet and schematics to use it.

You can make a maple mini work with the stlink device. However, you have to modify the boards.txt entry for the maple mini or make a new one.
-rick

User avatar
Pito
Posts: 1593
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

Re: some sectors are write protected

Post by Pito » Sun Nov 12, 2017 5:06 pm

I use the MapleMini with Arduino IDE and Sloeber, the bootloader is the maple_mini_boot20.bin .
Simply flash that binary with ST_Link into the MM (erase the entire chip/flash/verify).
Select Maple Mini when building the sketch. Select the "stm32duino bootloader" as the upload method. Select the port with your COMx.
It will upload/connect (usb serial) automatically.
Pukao Hats Cleaning Services Ltd.

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

Re: some sectors are write protected

Post by Rick Kimball » Sun Nov 12, 2017 6:04 pm

I guess I'm not sure what @dev is trying to accomplish. Does he want to use the stlink as his preferred method of programming or is he just trying to load the bootloader onto the maple mini. From what he wrote it appears he wants to use the stlink as his programming method and he also want to use the USB native serial. Maybe you could tell us @dev.
-rick

Post Reply