Recent

Author Topic: Is this STM32 bricked ???  (Read 4812 times)

petex

  • Jr. Member
  • **
  • Posts: 69
Is this STM32 bricked ???
« on: February 04, 2021, 09:13:43 pm »
hello,

I programmed the STM32 with the USB bootloader from Roger Clarkes website :
https://github.com/rogerclarkmelbourne/STM32duino-bootloader

When I plug the USB in it is recognised by the PC and a virtual port is created. When I press the reset button it flashes the LED momentarily.

However I have these problems:-
1) The GDB server does not run on my PI from the OpenOcd command

Quote
pi@PIZERODEV:~/bootloader $ sudo openocd
Open On-Chip Debugger 0.11.0-rc2+dev-00002-g427552c07-dirty (2021-01-28-16:19)
Licensed under GNU GPL v2
For bug reports, read
   http://openocd.org/doc/doxygen/bugs.html
Info : BCM2835 GPIO JTAG/SWD bitbang driver
Info : clock speed 1006 kHz
Error: Error connecting DP: cannot read IDR


Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections


2) If I try to run any simple programs from the Arduino IDE, nothing happens....
Quote
Sketch uses 15988 bytes (12%) of program storage space. Maximum is 131072 bytes.
Global variables use 3128 bytes (15%) of dynamic memory, leaving 17352 bytes for local variables. Maximum is 20480 bytes.
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


3) if I move the BOOT0 link to program mode and press reset, I cannot get the STM Flash Loader Demo program to recognise the device.


Does this mean the card is bricked ?? How can I do a factory reset and completely wipe out the USB bootloader and resume the original serial link loader ??


ps
If I view the virtual com port, i get this....
Quote

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


For more information about Arduino on STM32
See https://www.stm32duino.com



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


For more information about Arduino on STM32
See https://www.stm32duino.co
« Last Edit: February 04, 2021, 09:25:26 pm by petex »

Laksen

  • Hero Member
  • *****
  • Posts: 743
    • J-Software
Re: Is this STM32 bricked ???
« Reply #1 on: February 05, 2021, 01:02:58 am »
Assuming you are on a newer Linux, do you have the systemd ModemManager service disabled? That will often send garbage to any serial device when it shows up in the hope that it's an oldschool modem

To my knowledge it takes a bit of work to overwrite the system bootloader accessed by BOOT0, but you didn't write what STM32 device you are using?

I got too annoyed by the official ST tool being too unstable that I wrote my own bootloader flashing tool here: https://github.com/Laksen/stm32-bootloader

avra

  • Hero Member
  • *****
  • Posts: 2514
    • Additional info
Re: Is this STM32 bricked ???
« Reply #2 on: February 05, 2021, 08:35:22 am »
Does this mean the card is bricked ?? How can I do a factory reset and completely wipe out the USB bootloader and resume the original serial link loader ??
Repeat the tutorial steps you followed when you have uploaded bootloader in the first place, but this time use blinky demo instead of bootloader. You would probably need to change one of the jumpers during the process.
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

MarkMLl

  • Hero Member
  • *****
  • Posts: 6686
Re: Is this STM32 bricked ???
« Reply #3 on: February 05, 2021, 09:45:09 am »
How did you program it: with a specialist adapter? Did you use THE RIGHT loader? If that's a "Blue Pill" have you fitted an extra resistor to sort out the USB interface problem?

Those are the issues I've had in the past, but even with the extra pullup fitted I've found cheap "Blue Pills" somewhat erratic.

Why do you give a Linux-based example sith sudo and then start talking about a virtual com port?

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

MiR

  • Sr. Member
  • ****
  • Posts: 250
Re: Is this STM32 bricked ???
« Reply #4 on: February 05, 2021, 10:27:52 am »
I do not use Bluepills on a regular basis but when SWD does not work the safe haven for me was always serial upload, the routines are in ROM so you cannot break them in any way.

To do so:

Set Boot0 Switch to '1' Position, Boot1 Switch (if available) stays on '0'

Then connect serial uart to PA9 and PA10

Fire up latest STM32CubeProgrammer

Select UART mode
Select the COM Port of your usb-to-serial connector
Set speed to 115200 or 9600 8n1

hit reset

and hit connect

if it does not connect immediately then

hit reset on the board while connecting (do this while the app still searches for connectivity, so be rather fast)

then you can erase flash and all is back to normal.

I'd recommend flasing an uf2 bootlader, much more intuitive if you do not to use a swd debugger (in that case I'd rater use no bootloader at all)

Remember to switch back BOOT0 to 0 after chip erase
« Last Edit: February 05, 2021, 10:36:24 am by MiR »

petex

  • Jr. Member
  • **
  • Posts: 69
Re: Is this STM32 bricked ???
« Reply #5 on: February 05, 2021, 10:58:46 am »
ok panic over !!

I normally leave the boot0 jumper in the operational position and gdb server just works. I put the jumper to program mode, reset and then started openocd and there were no errors. I then replaced the usb loader with Blinky, went back to operational mode and everything is ok.

When the USB loader program was loaded and running, it was not possible to halt it and I got a load of errors.....
Quote
Info : stm32f103c8t6.cpu: external reset detected
Polling target stm32f103c8t6.cpu failed, trying to reexamine
Error: Error connecting DP: cannot read IDR
Error: Error connecting DP: cannot read IDR
Error: Could not find MEM-AP to control the core
Examination failed, GDB will be halted. Polling again in 100ms
Error: Error connecting DP: cannot read IDR
Polling target stm32f103c8t6.cpu failed, trying to reexamine
Error: Error connecting DP: cannot read IDR
Error: Error connecting DP: cannot read IDR
Error: Could not find MEM-AP to control the core
Examination failed, GDB will be halted. Polling again in 300ms
Error: Error connecting DP: cannot read IDR
Polling target stm32f103c8t6.cpu failed, trying to reexamine
Error: Error connecting DP: cannot read IDR
Error: Error connecting DP: cannot read IDR
Error: Could not find MEM-AP to control the core
Examination failed, GDB will be halted. Polling again in 700ms
Error: Error connecting DP: cannot read IDR
Polling target stm32f103c8t6.cpu failed, trying to reexamine
Error: Error connecting DP: cannot read IDR

The upshot of all of this is I am not sure how to get this particular USB bootloader to work. It is recognised by my PC (win 10) and establishes a virtual com port which spews out messages every so often but nothing else shows up.


Quote

Why do you give a Linux-based example sith sudo and then start talking about a virtual com port?

I have a Raspberry pi running OpenOcd server connected to the STM32 and the PC (win)connects to the Pi.
« Last Edit: February 05, 2021, 11:00:34 am by petex »

petex

  • Jr. Member
  • **
  • Posts: 69
Re: Is this STM32 bricked ???
« Reply #6 on: February 05, 2021, 01:19:12 pm »
I have abandoned Roger's USB bootloader (sorry Roger) and have tried this one:-

https://github.com/mmoskal/uf2-stm32f103/releases/tag/v2.0.1

This runs nicely and I get a new mass storage device added to my computer as drive E: .

A question here, the FPC compiler outputs ,bin, ,hex and ,elf. Is it able to output .uf2 format or do i need a converter ?

MiR

  • Sr. Member
  • ****
  • Posts: 250
Re: Is this STM32 bricked ???
« Reply #7 on: February 05, 2021, 01:59:13 pm »
In Trunk and my Binary Pack this fpc parameter works:

      -Xu        Generate executable in UF2 format  (embedded targets only)

You need to make sure that you set the correct offset for the start of the binary.

See this example in MBF:

SamplesBoardSpecific/Blinky-Bluepill

there I have provided properly preconfigured lpi files.

When using Pico you have to use my binary compiler pack, the latest fixes for pico are not yet in trunk of fpc, I will first have to figure out how to best do interrupts in pico before I ask Florian & Friends to include the fixes as a patch.

petex

  • Jr. Member
  • **
  • Posts: 69
Re: Is this STM32 bricked ???
« Reply #8 on: February 05, 2021, 08:12:02 pm »
compiler option -Xu does not work with latest compiler package.

Quote
Error: Illegal parameter: -Xu

I see you have a blinky uf2 project with a .uf2 file. But if i delete it and re-compile, no .uf2 is built.
I couldn't find any extra params in the project options for this.

MiR

  • Sr. Member
  • ****
  • Posts: 250
Re: Is this STM32 bricked ???
« Reply #9 on: February 07, 2021, 12:56:01 pm »
Maybe the fpc you are using is 'outdated' (which could mean two weeks old or so....), please replace it with this version built today:

http://temp.michael-ring.org/fpc-arm-embedded-3.3.1-win64-20210207.zip

It also brings back the compatibility with older units, use

-WpSTM32F103X8

instead of -Wpbluepill

You will not be able to use MBF with  -WpSTM32F103X8 as the units are not compatible (as you already found out)
 

 

TinyPortal © 2005-2018