cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to flash STM32F756 with st-flash

JKB
Visitor

Moved from MPUs forum.


Hello,

I have made a custom PCB with a STM32F756 and I'm trying to program this MPU through STlink. My main workstation runs Linux and I use stlink tools.

To flash this MPU, I have connected ST-Linkv2 to my PCB (NRST, SWCLK, SWDIO, SWO, GND) and I can obtain a answer from MPU:

hilbert:[~/zephyros/zephyr/samples/basic/blinky/src] > st-info --probe
Found 1 stlink programmers
  version:    V2J29S7
  serial:     49FF69065050825521491967
  flash:      1048576 (pagesize: 2048)
  sram:       327680
  chipid:     0x449
  dev-type:   STM32F74x_F75x

 But I unable to flash a test program... I have tested with standard user or root.

hilbert:[/usr/local/bin] > ./st-flash --debug --connect-under-reset write ~/cvs/firmware-europulse/build/zephyr/zephyr.bin 0x08000000
st-flash 1.8.0-121-g8c34a4e
2026-05-22T15:44:31 DEBUG common.c: *** looking up stlink version ***
2026-05-22T15:44:31 DEBUG common.c: st vid         = 0x0483 (expect 0x0483)
2026-05-22T15:44:31 DEBUG common.c: stlink pid     = 0x3748
2026-05-22T15:44:31 DEBUG common.c: stlink version = 0x2
2026-05-22T15:44:31 DEBUG common.c: jtag version   = 0x1d
2026-05-22T15:44:31 DEBUG common.c: swim version   = 0x7
2026-05-22T15:44:31 DEBUG common.c: stlink current mode: mass
2026-05-22T15:44:31 DEBUG usb.c: JTAG/SWD freq set to 0
2026-05-22T15:44:31 DEBUG common.c: *** stlink_enter_swd_mode ***
2026-05-22T15:44:31 DEBUG usb.c: ENTER_SWD error (0x09)
2026-05-22T15:44:31 DEBUG common.c: *** stlink_jtag_reset 0 ***
2026-05-22T15:44:31 ERROR usb.c: WRITEDEBUGREG read reply failed: LIBUSB_ERROR_PIPE
2026-05-22T15:44:31 DEBUG common.c: *** stlink_jtag_reset 1 ***
2026-05-22T15:44:34 ERROR usb.c: DRIVE_NRST read reply failed: LIBUSB_ERROR_TIMEOUT
2026-05-22T15:44:34 ERROR usb.c: WRITEDEBUGREG read reply failed: LIBUSB_ERROR_PIPE
2026-05-22T15:44:34 ERROR usb.c: WRITEDEBUGREG read reply failed: LIBUSB_ERROR_PIPE
2026-05-22T15:44:34 ERROR usb.c: WRITEDEBUGREG read reply failed: LIBUSB_ERROR_PIPE
2026-05-22T15:44:34 ERROR usb.c: WRITEDEBUGREG read reply failed: LIBUSB_ERROR_PIPE
2026-05-22T15:44:34 ERROR usb.c: WRITEDEBUGREG read reply failed: LIBUSB_ERROR_PIPE
2026-05-22T15:44:34 ERROR usb.c: WRITEDEBUGREG read reply failed: LIBUSB_ERROR_PIPE
2026-05-22T15:44:34 ERROR usb.c: WRITEDEBUGREG read reply failed: LIBUSB_ERROR_PIPE
2026-05-22T15:44:34 ERROR usb.c: WRITEDEBUGREG read reply failed: LIBUSB_ERROR_PIPE
2026-05-22T15:44:34 ERROR usb.c: WRITEDEBUGREG read reply failed: LIBUSB_ERROR_PIPE
2026-05-22T15:44:34 ERROR usb.c: READDEBUGREG read reply failed: LIBUSB_ERROR_PIPE
2026-05-22T15:44:34 WARN common.c: NRST is not connected
2026-05-22T15:44:36 DEBUG common.c: *** stlink_soft_reset (halt) ***
2026-05-22T15:44:36 DEBUG read_write.c: *** stlink_write_debug32 0xa05f0003 to 0xe000edf0
2026-05-22T15:44:36 ERROR usb.c: WRITEDEBUGREG read reply failed: LIBUSB_ERROR_PIPE
2026-05-22T15:44:36 DEBUG read_write.c: *** stlink_write_debug32 0x01000501 to 0xe000edfc
2026-05-22T15:44:36 ERROR usb.c: WRITEDEBUGREG read reply failed: LIBUSB_ERROR_PIPE
2026-05-22T15:44:36 DEBUG read_write.c: *** stlink_write_debug32 0x00000008 to 0xe000ed30
2026-05-22T15:44:36 ERROR usb.c: WRITEDEBUGREG read reply failed: LIBUSB_ERROR_PIPE
2026-05-22T15:44:36 ERROR usb.c: READDEBUGREG read reply failed: LIBUSB_ERROR_PIPE
2026-05-22T15:44:36 DEBUG read_write.c: *** stlink_write_debug32 0x05fa0004 to 0xe000ed0c
2026-05-22T15:44:36 ERROR usb.c: WRITEDEBUGREG read reply failed: LIBUSB_ERROR_PIPE
2026-05-22T15:44:36 ERROR common.c: Soft reset failed: error write to AIRCR
2026-05-22T15:44:39 ERROR usb.c: GET_CURRENT_MODE read reply failed: LIBUSB_ERROR_TIMEOUT
2026-05-22T15:44:39 DEBUG common.c: stlink mode: unknown!
2026-05-22T15:44:39 DEBUG common.c: *** stlink_enter_swd_mode ***
2026-05-22T15:44:39 DEBUG common.c: Loading device parameters....
2026-05-22T15:44:39 DEBUG common.c: *** stlink_core_id ***
2026-05-22T15:44:39 DEBUG common.c: core_id = 0x5ba02477
2026-05-22T15:44:39 DEBUG read_write.c: *** stlink_read_debug32  0x410fc271 at 0xe000ed00
2026-05-22T15:44:39 DEBUG read_write.c: *** stlink_read_debug32  0x10016449 at 0xe0042000
2026-05-22T15:44:39 DEBUG chipid.c: detected chip_id parameters

2026-05-22T15:44:39 DEBUG chipid.c: # Device Type: STM32F74x_F75x
2026-05-22T15:44:39 DEBUG chipid.c: # Reference Manual: RM0385
2026-05-22T15:44:39 DEBUG chipid.c: #
2026-05-22T15:44:39 DEBUG chipid.c: chip_id 0x449
2026-05-22T15:44:39 DEBUG chipid.c: flash_type 5
2026-05-22T15:44:39 DEBUG chipid.c: flash_size_reg 0x1ff0f442
2026-05-22T15:44:39 DEBUG chipid.c: flash_pagesize 0x800
2026-05-22T15:44:39 DEBUG chipid.c: sram_size 0x50000
2026-05-22T15:44:39 DEBUG chipid.c: bootrom_base 0x100000
2026-05-22T15:44:39 DEBUG chipid.c: bootrom_size 0xedc0
2026-05-22T15:44:39 DEBUG chipid.c: option_base 0x1fff0000
2026-05-22T15:44:39 DEBUG chipid.c: option_size 0x20
2026-05-22T15:44:39 DEBUG chipid.c: flags 2

2026-05-22T15:44:39 DEBUG chipid.c: otp_base 0

2026-05-22T15:44:39 DEBUG chipid.c: otp_size 0

2026-05-22T15:44:39 DEBUG read_write.c: *** stlink_read_debug32  0x0400c000 at 0x1ff0f440
2026-05-22T15:44:39 INFO common.c: STM32F74x_F75x: 320 KiB SRAM, 1024 KiB flash in at least 2 KiB pages.
2026-05-22T15:44:39 DEBUG common.c: *** stlink_force_debug_mode ***
2026-05-22T15:44:39 DEBUG read_write.c: *** stlink_read_debug32  0x00001800 at 0xe0042008
2026-05-22T15:44:39 DEBUG read_write.c: *** stlink_write_debug32 0x00001800 to 0xe0042008
2026-05-22T15:44:39 DEBUG common.c: *** stlink_status ***
2026-05-22T15:44:39 DEBUG usb.c: core status: 02030003
2026-05-22T15:44:39 DEBUG common.c:   core status: halted
file /home/bertrand/cvs/firmware-europulse/build/zephyr/zephyr.bin md5 checksum: 96798a8dcdb294a3e6a16698c07e9c67, stlink checksum: 0x00196c0b
2026-05-22T15:44:39 INFO common_flash.c: Attempting to write 18120 (0x46c8) bytes to stm32 address: 134217728 (0x8000000)
2026-05-22T15:44:39 DEBUG common.c: *** stlink_core_id ***
2026-05-22T15:44:39 DEBUG common.c: core_id = 0x5ba02477
2026-05-22T15:44:39 DEBUG read_write.c: *** stlink_read_debug32  0000000000 at 0x40023c0c
2026-05-22T15:44:39 DEBUG read_write.c: *** stlink_write_debug32 0x000000f2 to 0x40023c0c
2026-05-22T15:44:39 DEBUG read_write.c: *** stlink_read_debug32  0x80000000 at 0x40023c10
2026-05-22T15:44:39 DEBUG read_write.c: *** stlink_write_debug32 0x45670123 to 0x40023c04
2026-05-22T15:44:39 DEBUG read_write.c: *** stlink_write_debug32 0xcdef89ab to 0x40023c04
2026-05-22T15:44:39 DEBUG read_write.c: *** stlink_read_debug32  0000000000 at 0x40023c10
2026-05-22T15:44:39 DEBUG common_flash.c: Successfully unlocked flash
EraseFlash - Sector:0x0 Size:0x8000 2026-05-22T15:44:39 DEBUG read_write.c: *** stlink_read_debug32  0000000000 at 0x40023c10
2026-05-22T15:44:39 DEBUG read_write.c: *** stlink_write_debug32 0x00000002 to 0x40023c10
2026-05-22T15:44:39 DEBUG read_write.c: *** stlink_read_debug32  0x00000002 at 0x40023c10
2026-05-22T15:44:39 DEBUG read_write.c: *** stlink_write_debug32 0x00010002 to 0x40023c10
2026-05-22T15:44:39 DEBUG read_write.c: *** stlink_read_debug32  0x00010000 at 0x40023c0c
2026-05-22T15:44:39 DEBUG read_write.c: *** stlink_read_debug32  0x00010000 at 0x40023c0c
2026-05-22T15:44:39 DEBUG read_write.c: *** stlink_read_debug32  0x00010000 at 0x40023c0c
2026-05-22T15:44:39 DEBUG read_write.c: *** stlink_read_debug32  0x00010000 at 0x40023c0c
2026-05-22T15:44:39 DEBUG read_write.c: *** stlink_read_debug32  0x00010000 at 0x40023c0c
2026-05-22T15:44:39 DEBUG read_write.c: *** stlink_read_debug32  0x00010000 at 0x40023c0c
...
2026-05-22T15:44:39 DEBUG read_write.c: *** stlink_read_debug32  0x00010000 at 0x40023c0c
2026-05-22T15:44:39 DEBUG usb.c: READDEBUGREG error (0x18)
2026-05-22T15:44:39 DEBUG read_write.c: *** stlink_read_debug32  0x00010000 at 0x40023c0c
2026-05-22T15:44:39 DEBUG read_write.c: *** stlink_read_debug32  0x00010000 at 0x40023c0c
...
2026-05-22T15:44:39 DEBUG read_write.c: *** stlink_read_debug32  0x00010000 at 0x40023c0c
2026-05-22T15:44:39 DEBUG read_write.c: *** stlink_read_debug32  0x00010000 at 0x40023c0c
2026-05-22T15:44:39 DEBUG usb.c: READDEBUGREG error (0x18)
2026-05-22T15:44:39 DEBUG read_write.c: *** stlink_read_debug32  0x00010000 at 0x40023c0c
2026-05-22T15:44:39 DEBUG read_write.c: *** stlink_read_debug32  0x00010000 at 0x40023c0c
2026-05-22T15:44:39 DEBUG read_write.c: *** stlink_read_debug32  0x00010000 at 0x40023c0c
2026-05-22T15:44:39 DEBUG read_write.c: *** stlink_read_debug32  0x00010000 at 0x40023c0c
2026-05-22T15:44:39 DEBUG read_write.c: *** stlink_read_debug32  0x00010000 at 0x40023c0c
2026-05-22T15:44:39 DEBUG read_write.c: *** stlink_read_debug32  0x00010000 at 0x40023c0c
2026-05-22T15:44:39 DEBUG read_write.c: *** stlink_read_debug32  0x00010000 at 0x40023c0c
2026-05-22T15:44:39 DEBUG usb.c: READDEBUGREG error (0x18)
2026-05-22T15:44:39 DEBUG read_write.c: *** stlink_read_debug32  0x00010000 at 0x40023c0c
2026-05-22T15:44:39 DEBUG read_write.c: *** stlink_read_debug32  0x00010000 at 0x40023c0c
2026-05-22T15:44:39 DEBUG read_write.c: *** stlink_read_debug32  0x00070000 at 0x40023c0c
2026-05-22T15:44:39 DEBUG read_write.c: *** stlink_read_debug32  0x00010000 at 0x40023c0c
...
2026-05-22T15:44:40 DEBUG read_write.c: *** stlink_read_debug32  0x00000002 at 0x40023c10
2026-05-22T15:44:40 DEBUG read_write.c: *** stlink_write_debug32 0x80000002 to 0x40023c10
2026-05-22T15:44:40 DEBUG read_write.c: *** stlink_read_debug32  0000000000 at 0x40023c0c
-> Flash page at 0x8000000 erased (size: 0x8000)
2026-05-22T15:44:40 DEBUG read_write.c: *** stlink_read_debug32  0x00100000 at 0x40023830
2026-05-22T15:44:40 DEBUG read_write.c: *** stlink_write_debug32 0x00100000 to 0x40023830
2026-05-22T15:44:40 DEBUG usb.c: READDEBUGREG error (0x18)
2026-05-22T15:44:40 DEBUG read_write.c: *** stlink_write_debug32 0x000000f2 to 0x40023c0c
2026-05-22T15:44:40 INFO flash_loader.c: Starting Flash write for F2/F4/F7/L4
2026-05-22T15:44:40 DEBUG read_write.c: *** stlink_write_debug32 0xa05f0003 to 0xe000edf0
2026-05-22T15:44:40 DEBUG read_write.c: *** stlink_write_debug32 0xa05f000b to 0xe000edf0
2026-05-22T15:44:40 DEBUG common.c: *** reading target voltage
2026-05-22T15:44:40 DEBUG usb.c: target voltage factor=000005f0 reading=000002a9
2026-05-22T15:44:40 DEBUG common.c: target voltage = 1075mV
2026-05-22T15:44:40 DEBUG read_write.c: *** stlink_write_mem32 52 bytes to 0x20000000
2026-05-22T15:44:40 DEBUG usb.c: GETLASTRWSTATUS2 access port fault
2026-05-22T15:44:40 WARN flash_loader.c: Failed to write flash loader to sram!
2026-05-22T15:44:40 ERROR flash_loader.c: stlink_flash_loader_init() == -1
2026-05-22T15:44:40 DEBUG usb.c: READDEBUGREG access port fault
2026-05-22T15:44:40 DEBUG read_write.c: *** stlink_write_reg
2026-05-22T15:44:40 DEBUG usb.c: WRITEREG access port fault
2026-05-22T15:44:40 DEBUG common.c: *** stlink_run ***
2026-05-22T15:44:40 DEBUG read_write.c: *** stlink_read_reg
2026-05-22T15:44:40 DEBUG read_write.c:  (16) ***
2026-05-22T15:44:40 DEBUG usb.c: READREG access port fault
2026-05-22T15:44:40 DEBUG usb.c: WRITEDEBUGREG access port fault
stlink_fwrite_flash() == -1
2026-05-22T15:44:40 DEBUG common.c: *** stlink_exit_debug_mode ***
2026-05-22T15:44:40 DEBUG read_write.c: *** stlink_write_debug32 0xa05f0000 to 0xe000edf0
2026-05-22T15:44:40 DEBUG usb.c: WRITEDEBUGREG access port fault
2026-05-22T15:44:40 DEBUG common.c: *** stlink_close ***

First question : why st-flash does complain about unconnected NRST signal ? I have connected NRST to pin 15 of SWD connector.

Second question : if I understand, I can read and write commands, but I cannot flash progam. What is my mistake ?

Best regards,

JB

11 REPLIES 11
Andrew Neil
Super User

welcome to the forum

Please see How to write your question to maximize your chances to find a solution for best results.

 


@JKB wrote:

I have made a custom PCB with a STM32F756 


Then you need to post your schematic.

Has this PCB ever worked before?

 


@JKB wrote:

I'm trying to program this MPU through STlink.


The STM32F7 is an MCU - not an MPU.

You need to be using the MCU tools; eg, STM32CubeProgrammer.

 

What ST-Link are you using?

How to recognize a genuine ST-LINK/V2 versus a cloned one

 

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.
mƎALLEm
ST Employee

Hello,

I don't know about Zephyr environment but you need to check if you are able to connect with your custom board using

STM32CubeProgrammer tool.  

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

PCB runs as expexcted. I have checked all signals and all power supplies.

On schematic, stlink is connected to PROG{PROG} (NRST is connected to WKUP). Only TVS diodes are added on PROG bus.

stm32-CPU.jpg

My StLInkv2 is an official one, not a copy.

Regards,

JB

I have exactly the same error.

stm32cube.png

I receive some errors during connection but after hard reset of PCB, connection is done but why is voltage only 1.57V ? CPU is powered from 3V3 line. And I have exactly the same error "flash loader cannot be loaded".

Regards,

JB

There's something wrong with your power supply:

AndrewNeil_0-1779463660516.png

 

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

No, I don't think. I don't understand this message, but I have checked my 3V3 line (with scope, not with a multimeter) and checked pins 17, 30, 39, 52, 62, 72, 84, 95, 108, 121, 131, 143 and 144. All show 3.3V.

Well the ST-Link is measuring less than 1.5V - so there's something definitely wrong in the setup!

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

How ST-link does measure this voltage ? Is a value returned by CPU or directly measured by ST-link ? Mine is only connected to PCB with 5 lines : nRST, SWCLK, SWDIO, SWO and GND.

With scope, I see :

- nRST : 3V3;

- other signals 0 or 3V3 (with some communications) : SWCLK (3V3 when idle), SWDIO (3V3 when idle), SWO (0 when idle).

All signals are clean.

 

See the ST-Link User Manual - it senses the voltage on the Vtarget line.

You should have that connected to your target.

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.