Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 8 Replies) Help Understanding STM32 programming/debug options (Read 475 times)
FrankP
Senior Member
****
Offline


Posts: 251
Joined: Oct 19th, 2011
Help Understanding STM32 programming/debug options
Nov 7th, 2024 at 12:49am
Print Post  
I am trying to educate myself enough on STM32-based boards to debug a firmware problem on a 'bricked' FlashForge Creator PRO 2 motherboard, which uses a STM32F407xx MCU.  My ultimate goal is to use something like OpenOCD or VisualGDB to decode the firmware in user FLASH so I can regain use of the board.  I have done a ton of research so far, but I keep getting lost in the weeds.

To start with something simple, I am working with a STM32F1 'blue pill' board. So far I have managed to upload and run a small 'blink' program using a ST-LINKV2 clone and the 'STLINK' upload option, so I know the hardware is OK.  After that I started trying some of the other choices, like 'serial', 'STLINK+0CD(vMicro)' and 'STM32duino bootloader'.  None of these other options worked, with different error outputs (verbose output attached).

Can anyone point me toward documentation and/or tutorials treating these other upload options? 

TIA,

Frank
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2496
Joined: Feb 13th, 2019
Re: Help Understanding STM32 programming/debug options
Reply #1 - Nov 7th, 2024 at 8:46am
Print Post  
Thanks for the report, and that sounds like an interesting though difficult project.

STLink + OpenOCD (vMicro)
CPUTap Error seems to be due to the F1x expecting the IDCode "0x1ba01477" from the MCU, wheras the board is reporting "0x2ba01477" which is in the F2x configuration.  We will look at why this configuration isn't working, however as the STLiNK option works, it is best to continue with that currently.

STM32DuinoBootloader
The error suggests you don't have the Java Runtime Environment (JRE) installed, or it as not been added to the PATH Environment Variable in Windows.  Once installed correctly you should be able to open a command line and type "java --version", and it will display the version information for the JRE Installed.

I believe this uses a modified Maple DFU Bootloader, which can be found in the STM32Duino documentation below:
https://github.com/stm32duino/Arduino_Core_STM32/wiki/Upload-methods#maple-dfu-b...

Serial
This requires the bootloader to be flashed to the Bluepill which supports Serial Upload.  Instructions are linked on the "Bootloader" tab on the below page:
https://www.visualmicro.com/page/STMicroelectronics-STM32-Overview.aspx


  
Back to top
IP Logged
 
FrankP
Senior Member
****
Offline


Posts: 251
Joined: Oct 19th, 2011
Re: Help Understanding STM32 programming/debug options
Reply #2 - Nov 7th, 2024 at 11:21am
Print Post  
Thanks!  that helps a lot!
  
Back to top
 
IP Logged
 
FrankP
Senior Member
****
Offline


Posts: 251
Joined: Oct 19th, 2011
Re: Help Understanding STM32 programming/debug options
Reply #3 - Nov 11th, 2024 at 4:27pm
Print Post  
Simon@Visual Micro wrote on Nov 7th, 2024 at 8:46am:
STM32DuinoBootloader
The error suggests you don't have the Java Runtime Environment (JRE) installed, or it as not been added to the PATH Environment Variable in Windows.  Once installed correctly you should be able to open a command line and type "java --version", and it will display the version information for the JRE Installed.


I installed the JRE and tried a program upload using the 'STM32duino upload method and a USB connection to the board. This resulted in 'EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000007110b5db, pid=25516, tid=0x0000000000008190'

I have attached the verbose output and the log file that was referenced in the verbose output log.

Any thoughts?

TIA,

Frank

  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2496
Joined: Feb 13th, 2019
Re: Help Understanding STM32 programming/debug options
Reply #4 - Nov 11th, 2024 at 4:56pm
Print Post  
Does it help if you run Visual Studio as an Adminstrator?
  
Back to top
IP Logged
 
FrankP
Senior Member
****
Offline


Posts: 251
Joined: Oct 19th, 2011
Re: Help Understanding STM32 programming/debug options
Reply #5 - Nov 11th, 2024 at 6:22pm
Print Post  
Simon@Visual Micro wrote on Nov 11th, 2024 at 4:56pm:
Does it help if you run Visual Studio as an Adminstrator?



Nope - same problem  Embarrassed

Frank
  
Back to top
 
IP Logged
 
FrankP
Senior Member
****
Offline


Posts: 251
Joined: Oct 19th, 2011
Re: Help Understanding STM32 programming/debug options
Reply #6 - Nov 11th, 2024 at 6:48pm
Print Post  
I also tried the 'HID Bootloader 2.0' method via USB on two different 'blue pill' devices, and got the same (failed) result from both:

Program size: 13084 bytes (used 20% of a 65536 byte maximum) (0.33 secs)
Minimum Memory Usage: 2064 bytes (10% of a 20480 byte maximum)
 
Uploading 'BluePill' to 'Generic STM32F103C series(stm32duino_genericSTM32F103C)' using 'COM16'
Uploader started for board Generic STM32F103C series(stm32duino_genericSTM32F103C)
Upload method will be: bootloader
Uploading via Bootloader 
Resetting to bootloader via Serial
Serial reset
Reset via USB Serial completed
.9.26\win\hid-flash.exe C\Release/BluePill.ino.bin" COM16
+------------------------------------------------------------------------+
|         HID-Flash v2.1 - STM32 HID Bootloader Flash Tool               |
|     (c)      2018 - Bruno Freitas      - http://www.brunofreitas.com/ ; |
|     (c) 2018-2019 - Vassilis Serasidis - https://www.serasidis.gr/ ;    |
|   Customized for STM32duino ecosystem  - https://www.stm32duino.com/ ;  |
+------------------------------------------------------------------------+
> Trying to open the comport...
> Toggling DTR...
> Searching for 1209:BEBA HID device...
##########
     The upload process has finished.
Error - No HID Bootloader device is found

Does this indicate that I don't have any (or at least, appropriate) bootloader installed on the blue pill MCU?  If so, anyone have a pointer to the procedure for this?

TIA,

Frank

Frank
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2496
Joined: Feb 13th, 2019
Re: Help Understanding STM32 programming/debug options
Reply #7 - Nov 11th, 2024 at 6:58pm
Print Post  
It does suggest that and the details can be found linked from the below HID Bootloader Section of documentation:
https://github.com/stm32duino/Arduino_Core_STM32/wiki/Upload-methods#hid-bootloa...
  
Back to top
IP Logged
 
FrankP
Senior Member
****
Offline


Posts: 251
Joined: Oct 19th, 2011
Re: Help Understanding STM32 programming/debug options
Reply #8 - Nov 13th, 2024 at 4:24am
Print Post  
I finally got the 'Serial' upload method working on both my blue pill devices with a FTDI USB-Serial adaptor.  I found a very good/understandable tutorial  here.

Here's the (non-verbose) output:

Compiling 'BluePill' for 'Generic STM32F103C series(stm32duino_genericSTM32F103C)'
 
Program size: 11840 bytes (used 18% of a 65536 byte maximum) (0.18 secs)
Minimum Memory Usage: 1432 bytes (7% of a 20480 byte maximum)
 
Uploading 'BluePill' to 'Generic STM32F103C series(stm32duino_genericSTM32F103C)' using 'COM15'
Resetting to bootloader via Serial
stm32flash 0.4
http://stm32flash.googlecode.com/
Using Parser : Raw BINARY
Interface serial_w32: 115200 8E1
Version      : 0x22
Option 1     : 0x00
Option 2     : 0x00
Device ID    : 0x0410 (Medium-density)
- RAM        : 20KiB  (512b reserved by bootloader)
- Flash      : 128KiB (sector size: 4x1024)
- Option RAM : 16b
- System RAM : 2KiB
Write to memory
Erasing memory
Wrote address 0x08000100 (2.16%) 
Wrote address 0x08000200 (4.32%) 
Wrote address 0x08000300 (6.49%) 
Wrote address 0x08000400 (8.65%) 
Wrote address 0x08000500 (10.81%) 
Wrote address 0x08000600 (12.97%) 
Wrote address 0x08000700 (15.14%) 
Wrote address 0x08000800 (17.30%) 
Wrote address 0x08000900 (19.46%) 
Wrote address 0x08000a00 (21.62%) 
Wrote address 0x08000b00 (23.78%) 
Wrote address 0x08000c00 (25.95%) 
Wrote address 0x08000d00 (28.11%) 
Wrote address 0x08000e00 (30.27%) 
Wrote address 0x08000f00 (32.43%) 
Wrote address 0x08001000 (34.59%) 
Wrote address 0x08001100 (36.76%) 
Wrote address 0x08001200 (38.92%) 
Wrote address 0x08001300 (41.08%) 
Wrote address 0x08001400 (43.24%) 
Wrote address 0x08001500 (45.41%) 
Wrote address 0x08001600 (47.57%) 
Wrote address 0x08001700 (49.73%) 
Wrote address 0x08001800 (51.89%) 
Wrote address 0x08001900 (54.05%) 
Wrote address 0x08001a00 (56.22%) 
Wrote address 0x08001b00 (58.38%) 
Wrote address 0x08001c00 (60.54%) 
Wrote address 0x08001d00 (62.70%) 
Wrote address 0x08001e00 (64.86%) 
Wrote address 0x08001f00 (67.03%) 
Wrote address 0x08002000 (69.19%) 
Wrote address 0x08002100 (71.35%) 
Wrote address 0x08002200 (73.51%) 
Wrote address 0x08002300 (75.68%) 
Wrote address 0x08002400 (77.84%) 
Wrote address 0x08002500 (80.00%) 
Wrote address 0x08002600 (82.16%) 
Wrote address 0x08002700 (84.32%) 
Wrote address 0x08002800 (86.49%) 
Wrote address 0x08002900 (88.65%) 
Wrote address 0x08002a00 (90.81%) 
Wrote address 0x08002b00 (92.97%) 
Wrote address 0x08002c00 (95.14%) 
Wrote address 0x08002d00 (97.30%) 
Wrote address 0x08002e00 (99.46%) 
Wrote address 0x08002e40 (100.00%) Done.
Starting execution at address 0x08000000... done.
     The upload process has finished.
  
Back to top
 
IP Logged
 
FrankP
Senior Member
****
Offline


Posts: 251
Joined: Oct 19th, 2011
Re: Help Understanding STM32 programming/debug options
Reply #9 - Nov 13th, 2024 at 5:52pm
Print Post  
Now that I have figured out how to reliably program my 'blue pill' STM32F103C MCU with either a ST-LINK or serial adaptor, I want to try doing the same thing to the STM32F407ZGT6 MCU on my 'bricked' 3D printer motherboard.  I already know I can connect to this board using ST Micro's ST-LINK utility and a clone ST-LINK adaptor connected to the board's SWD interface, and I have wired a manual switch that allows me to connect BOOT0 to either GND or VDD. 

Thanks to the FlashForge technical support team I have the actual schematic for my 3D printer, so I should be able to upload a basic 'blink' program and then check the PC13 output for activity. As it turns out, the PC-13 output line seems to be a NC on the schematic (and from visual inspection there doesn't seem to be anything connected) 

So, my question is, does vMicro/VS2022 support programming this MCU type?  Can I use the current 'Generic STM32F103 series' board selection and the 64K or 128K flash variant, or is there another board type available for the Arduino ecosystem?

TIA,

Frank
  
Back to top
 
IP Logged
 
FrankP
Senior Member
****
Offline


Posts: 251
Joined: Oct 19th, 2011
Re: Help Understanding STM32 programming/debug options
Reply #10 - Nov 14th, 2024 at 12:40am
Print Post  
FrankP wrote on Nov 13th, 2024 at 5:52pm:
So, my question is, does vMicro/VS2022 support programming this MCU type?  Can I use the current 'Generic STM32F103 series' board selection and the 64K or 128K flash variant, or is there another board type available for the Arduino ecosystem?


To answer my one question - Yes, with the installation of the STM32 Discovery F407 board.  I was able to program my 3D printer motherboard with the same 'blink' program I was using with my 'blue pill' boards, except I moved the output pin to PB11, as that pin is connected to a buzzer and was much easier to monitor.

I'm still not quite sure of the BOOT0 - RESET sequencing, but that's a very small matter.  What I know for sure now is "My motherboard isn't 'Bricked' - Hooorayyy!"

  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint