2026-05-22 7:07 AM - last edited on 2026-05-22 7:13 AM by Andrew Neil
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_F75xBut 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
2026-05-22 9:51 AM
OK. I beg your pardon, but I don't have this information in my manual (I've just checked). Thus I will try to short pins 1 and 19.
Regards,
JKB
2026-05-22 10:03 AM
OK.
Now, I obtain following log file:
18:54:57 : ST-LINK SN : 49FF69065050825521491967
18:54:57 : ST-LINK FW : V2J29S7
18:54:57 : Board : --
18:54:57 : Voltage : 3,22V
18:54:57 : SWD freq : 4000 KHz
18:54:57 : Connect mode: Normal
18:54:57 : Reset mode : Software reset
18:54:57 : Device ID : 0x449
18:54:57 : Revision ID : Rev Z
18:54:57 : Error: flash loader cannot be loaded. FlashLoaderPath = /opt/st/stm32cubeprg/bin/FlashLoader/0x
18:54:57 : Debug in Low Power mode enabled.
18:54:57 : UPLOADING OPTION BYTES DATA ...
18:54:57 : Bank : 0x00
18:54:57 : Address : 0x40023c14
18:54:57 : Size : 8 Bytes
18:54:57 : UPLOADING ...
18:54:57 : Size : 1024 Bytes
18:54:57 : Address : 0x8000000
18:54:57 : Read progress:
18:54:57 : Data read successfully
18:54:57 : Time elapsed during the read operation is: 00:00:00.007I don't know if it's a real issue, but log file shows a file that doesn' exist:
/opt/st/stm32cubeprg/bin/FlashLoader/0x
I'm unable to flash from stmcube (I don't know why), but from st-util -u -v and gdb, flash process runs as expected:
(gdb) load /home/bertrand/cvs/firmware-europulse/build/zephyr/zephyr.elf
Loading section rom_start, size 0x160 lma 0x8000000
Loading section text, size 0x36bc lma 0x8000160
Loading section .ARM.exidx, size 0x8 lma 0x800381c
Loading section initlevel, size 0xb8 lma 0x8003824
Loading section device_area, size 0x1f8 lma 0x80038dc
Loading section sw_isr_table, size 0x240 lma 0x8003ad4
Loading section gpio_driver_api_area, size 0x24 lma 0x8003d14
Loading section reset_driver_api_area, size 0x10 lma 0x8003d38
Loading section clock_control_driver_api_area, size 0x1c lma 0x8003d48
Loading section uart_driver_api_area, size 0x14 lma 0x8003d64
Loading section rodata, size 0x8c4 lma 0x8003d78
Loading section datas, size 0x64 lma 0x800463c
Loading section device_states, size 0x24 lma 0x80046a0
Loading section .last_section, size 0x4 lma 0x80046c4
Start address 0x08000ae0, load size 18120
Transfer rate: 11 KB/sec, 1294 bytes/write.
(gdb)
Regards,
JKB