Open ngandalf opened 2 years ago
Since you have an STLink at hand, try the STM32 ST-Link Utility which is more comprehensive. Use the Option bytes dialog to unprotect your flash memory.
If this doesn't work, try booting into the default STM32 bootloader and use DFU-util to flash your firmware. See this for more info.
i use klipper and suddenly no communication between gtr cards and raspberry pi. my card is no longer detected in usb on my pi. i tried to flash my card with an sd card , but nothing. i tried with an st link v2 clone but told me the flash is protected. i can't remove this protection.
st-flash --connect-under-reset write GTR-V1.0-bootloader-and-firmware.bin 0x08000000 st-flash 1.7.0 2022-01-22T17:04:25 WARN common.c: NRST is not connected 2022-01-22T17:04:25 INFO common.c: F4xx: 192 KiB SRAM, 4103 KiB flash in at least 16 KiB pages. file GTR-V1.0-bootloader-and-firmware.bin md5 checksum: d51cdaa82331a6e8391ea4f1adf6786, stlink checksum: 0x0e582784 2022-01-22T17:04:25 INFO common.c: Attempting to write 1048576 (0x100000) bytes to stm32 address: 134217728 (0x8000000) EraseFlash - Sector:0x0 Size:0x4000 2022-01-22T17:04:25 ERROR common.c: Flash memory is write protected 2022-01-22T17:04:25 ERROR common.c: Failed to erase_flash_page(0x8000000) == -1 stlink_fwrite_flash() == -1
st-flash --debug --connect-under-reset write GTR-V1.0-bootloader-and-firmware.bin 0x08000000 st-flash 1.7.0 2022-01-22T17:04:44 DEBUG common.c: looking up stlink version 2022-01-22T17:04:44 DEBUG common.c: st vid = 0x0483 (expect 0x0483) 2022-01-22T17:04:44 DEBUG common.c: stlink pid = 0x3748 2022-01-22T17:04:44 DEBUG common.c: stlink version = 0x2 2022-01-22T17:04:44 DEBUG common.c: jtag version = 0x1d 2022-01-22T17:04:44 DEBUG common.c: swim version = 0x7 2022-01-22T17:04:44 DEBUG common.c: stlink current mode: mass 2022-01-22T17:04:44 DEBUG usb.c: JTAG/SWD freq set to 0 2022-01-22T17:04:44 DEBUG common.c: set_swdclk 2022-01-22T17:04:44 DEBUG common.c: stlink_jtag_reset 2022-01-22T17:04:44 DEBUG common.c: stlink current mode: mass 2022-01-22T17:04:44 DEBUG common.c: stlink_enter_swd_mode 2022-01-22T17:04:44 DEBUG common.c: stlink_force_debug_mode 2022-01-22T17:04:44 DEBUG common.c: stlink_read_debug32 0x01030003 at 0xe000edf0 2022-01-22T17:04:44 DEBUG common.c: stlink_jtag_reset 2022-01-22T17:04:44 DEBUG common.c: stlink_read_debug32 0x00030003 at 0xe000edf0 2022-01-22T17:04:44 WARN common.c: NRST is not connected 2022-01-22T17:04:44 DEBUG common.c: stlink_soft_reset (halt) 2022-01-22T17:04:44 DEBUG common.c: stlink_write_debug32 0xa05f0003 to 0xe000edf0 2022-01-22T17:04:44 DEBUG common.c: stlink_write_debug32 0x01000501 to 0xe000edfc 2022-01-22T17:04:44 DEBUG common.c: stlink_write_debug32 0x00000008 to 0xe000ed30 2022-01-22T17:04:44 DEBUG common.c: stlink_read_debug32 0x00030003 at 0xe000edf0 2022-01-22T17:04:44 DEBUG common.c: stlink_write_debug32 0x05fa0004 to 0xe000ed0c 2022-01-22T17:04:44 DEBUG common.c: stlink_read_debug32 0x02030003 at 0xe000edf0 2022-01-22T17:04:44 DEBUG common.c: stlink_read_debug32 0x00030003 at 0xe000edf0 2022-01-22T17:04:44 DEBUG common.c: stlink_read_debug32 0x00000008 at 0xe000ed30 2022-01-22T17:04:44 DEBUG common.c: stlink_write_debug32 0x0000001f to 0xe000ed30 2022-01-22T17:04:44 DEBUG common.c: stlink current mode: debug (jtag or swd) 2022-01-22T17:04:44 DEBUG common.c: Loading device parameters.... 2022-01-22T17:04:44 DEBUG common.c: stlink_core_id 2022-01-22T17:04:44 DEBUG common.c: core_id = 0x2ba01477 2022-01-22T17:04:44 DEBUG common.c: stlink_read_debug32 0x410fc241 at 0xe000ed00 2022-01-22T17:04:44 DEBUG common.c: stlink_read_debug32 0x10076413 at 0xe0042000 2022-01-22T17:04:44 DEBUG common.c: stlink_read_debug32 0x10076413 at 0x1fff7a20 2022-01-22T17:04:44 INFO common.c: F4xx: 192 KiB SRAM, 4103 KiB flash in at least 16 KiB pages. 2022-01-22T17:04:44 DEBUG common.c: stlink current mode: debug (jtag or swd) 2022-01-22T17:04:44 DEBUG common.c: stlink current mode: debug (jtag or swd) 2022-01-22T17:04:44 DEBUG common.c: stlink_force_debug_mode 2022-01-22T17:04:44 DEBUG common.c: stlink_read_debug32 0x00001800 at 0xe0042008 2022-01-22T17:04:44 DEBUG common.c: stlink_write_debug32 0x00001800 to 0xe0042008 2022-01-22T17:04:44 DEBUG common.c: stlink_status 2022-01-22T17:04:44 DEBUG usb.c: core status: 00030003 2022-01-22T17:04:44 DEBUG common.c: core status: halted file GTR-V1.0-bootloader-and-firmware.bin md5 checksum: d51cdaa82331a6e8391ea4f1adf6786, stlink checksum: 0x0e582784 2022-01-22T17:04:44 INFO common.c: Attempting to write 1048576 (0x100000) bytes to stm32 address: 134217728 (0x8000000) 2022-01-22T17:04:44 DEBUG common.c: stlink_core_id 2022-01-22T17:04:44 DEBUG common.c: core_id = 0x2ba01477 2022-01-22T17:04:44 DEBUG common.c: stlink_read_debug32 0000000000 at 0x40023c0c 2022-01-22T17:04:44 DEBUG common.c: stlink_write_debug32 0x000000f0 to 0x40023c0c 2022-01-22T17:04:44 DEBUG common.c: stlink_read_debug32 0x80000000 at 0x40023c10 2022-01-22T17:04:44 DEBUG common.c: stlink_write_debug32 0x45670123 to 0x40023c04 2022-01-22T17:04:44 DEBUG common.c: stlink_write_debug32 0xcdef89ab to 0x40023c04 2022-01-22T17:04:44 DEBUG common.c: stlink_read_debug32 0000000000 at 0x40023c10 2022-01-22T17:04:44 DEBUG common.c: Successfully unlocked flash EraseFlash - Sector:0x0 Size:0x4000 2022-01-22T17:04:44 DEBUG common.c: stlink_read_debug32 0000000000 at 0x40023c10 2022-01-22T17:04:44 DEBUG common.c: stlink_write_debug32 0x00000002 to 0x40023c10 2022-01-22T17:04:44 DEBUG common.c: stlink_read_debug32 0x00000002 at 0x40023c10 2022-01-22T17:04:44 DEBUG common.c: stlink_write_debug32 0x00010002 to 0x40023c10 2022-01-22T17:04:44 DEBUG common.c: stlink_read_debug32 0x00000010 at 0x40023c0c 2022-01-22T17:04:44 DEBUG common.c: stlink_read_debug32 0x00000002 at 0x40023c10 2022-01-22T17:04:44 DEBUG common.c: stlink_write_debug32 0x80000002 to 0x40023c10 2022-01-22T17:04:44 DEBUG common.c: stlink_read_debug32 0x00000010 at 0x40023c0c 2022-01-22T17:04:44 ERROR common.c: Flash memory is write protected 2022-01-22T17:04:44 ERROR common.c: Failed to erase_flash_page(0x8000000) == -1 2022-01-22T17:04:44 DEBUG common.c: stlink_read_debug32 0x00000010 at 0x08000000 2022-01-22T17:04:44 DEBUG common.c: stlink_write_reg 2022-01-22T17:04:44 DEBUG common.c: data_len = 2 0x2 80 00 2022-01-22T17:04:44 DEBUG common.c: stlink_read_debug32 0x00000010 at 0x08000004 2022-01-22T17:04:44 DEBUG common.c: stlink_write_reg 2022-01-22T17:04:44 DEBUG common.c: data_len = 2 0x2 80 00 2022-01-22T17:04:44 DEBUG common.c: stlink_run 2022-01-22T17:04:44 DEBUG common.c: stlink_read_reg 2022-01-22T17:04:44 DEBUG common.c: (16) 2022-01-22T17:04:44 DEBUG common.c: data_len = 8 0x8 80 00 00 00 00 00 00 01 2022-01-22T17:04:44 DEBUG usb.c: r_idx (16) = 0x01000000 stlink_fwrite_flash() == -1 2022-01-22T17:04:44 DEBUG common.c: stlink_exit_debug_mode 2022-01-22T17:04:44 DEBUG common.c: stlink_write_debug32 0xa05f0000 to 0xe000edf0 2022-01-22T17:04:44 DEBUG common.c: stlink_close
i tested more software but without success. can you help me ?