ST-LINK error: "The interface firmware FAILED to reset/halt the target MCU"

I have a new Nucleo F401RE board that I have been programming with a Mac and uploading code via the mass storage normally, until yesterday. Now when I connect it using USB to either Mac (12.3) / Windows (11), the device folder has a FAIL.txt file that says “The interface firmware FAILED to reset/halt the target MCU”. On the board, JP1 is disconnected, JP5 is on U5V side, JP6 is on, and both CN2s are on. I have also upgraded the ST-LINK firmware to the latest, but the problem still persists and it doesn’t allow me to upload code (with an error saying “No space left on device” despite that my code only takes up less than a tenth of the storage). Furthermore, my Mac also shows that the board volume has in total only 33 kb, instead of the correct 512 kb.

Any help is greatly appreciated!!

Hello Alan,

This thread might help.

Thanks for the reply! I followed the steps you listed in the thread, including further decreasing the frequency to below 1800 kHz and kept holding the reset button on the board while clicking Connect in the STM32CubeProgrammer, but had no luck. I’m still getting the “No STM32 target found” error.

Then try to use the built-in bootloader accessible over UART1, as explained here.

I recall having a similar issue using the STM32 CubeMX IDE. One issue I had was when creating a new project and selecting the target, I used the board selector tab to choose the board I was using. This then prompts to create the project using default configurations. I found that by using the default configurations I was getting a similar issue to the one you are describing. Maybe try creating a new project and either select the MCU you are using or click no when prompted to use the default configs.