Portenta H7: recover bricked board just with 2nd USB cable

I have learnt much more:

If Portanta H7 is bricked (orange LED is on, nothing works, even Arduino bootloader does not work) - you can recover just with a second USB cable (maybe a need for an I2C master needed as well).

Situation
You see the orange LED (charging LED on PMIC) is ON: - the PMIC is not configured, the board does not have power!
You cannot use dfu-util: it shows an error: the Arduino bootloader is gone (overwritten, not running, not responding board due to missing power). Indication: when pressing reset button twice short after each other - you do not see a fading, flashing LED. The bootloader is dead - and no way to re-program the board.

Seeing orange LED or not a fading flashing LED after 2x reset - is a bad sign (bricked board).

No worries: luckily STM provides another bootloader in MCU (hard-coded, always there with the STM MCU chip).

Prerequisites
You should have:

  • the breakout board for Portenta H7 (just the tiny MCU does not help: the MCU module on breakout board is needed)

  • an USB-A to host cable: an USB cable which connects the USER USB on breakout board (as USB-A) to host (as a second USB connection!)

  • if PMIC is not configured - you see orange LED - any I2C master which can configure PMIC on broken board (I use, and in illustration shown: another Portenta H7 which has UART commands to fire I2C write transactions).

Recovery Procedure

So, connect the second USB-A cable to host (you need USB-C for power, but a second cable as USER USB to host PC).

Change the BOOT DIP switch on breakout board, press reset, let it boot into STM Bootloader, reprogram the PMIC on broken board (to get the power back) - if needed, flash FW again, or the Arduino Bootloader ..., change back the BOOT DIP switch and let boot the board. It should have discovered.

If orange LED is on - you had to release PMIC on broken board for powering this board - you had to write I2C registers from "any" I2C master, to configure PMIC on broken board.

The tool "dfu-util.exe" should find afterwards - press reset - but do not power-cycle the broken board! - the STM bootloader on broken board should be activated. Now you can flash any software (your FW, Arduino Bootloader etc.). The "dfu-util" should see now a DFU device. But: the USB IDs are different to the ones used for/by Arduino Bootloader!

Questions
Why does Portenta H7 have this Arduino bootloader?
It allocates space in MCU flash (64KB less code space for own FW). And it is flaky.
I can flash the board in the SAME WAY with STM Bootloader and same tool dfu-util.exe.
OK: we need the breakout board for doing so just to have this second USER USB and the BOOT DIP switch. MCU module w/o breakout board - no way to recover (or to use this STM bootloader).

Why is the PMIC "so sensitive"? It looks to me: board is bricked just due to fact that PMIC is not configured anymore (e.g. no FW running, e.g. also bootloader overwritten). In this case the board does not have power an no way to connect (with any means: even an external debugger, ST-LINK, will not see: board has just 0.02V as VDD - nothing responding. Therefore: the PMIC must be "released" from the outside)

I saw also issue, when programming the same I2C PMIC sequence I use in FW for PMIC config - it does not work when I do from the "outside": after writing to register 0x50 - I cannot read PMIC ChipID anymore (PMIC is dead).
So, I have changed the sequence of register writes into this sequence (below). And I use in my bare-metal project now also this changed PMIC register config sequence (w/o issues).

Is Arduino code still doing something not really right? (and therefore the Portenta H7 is flaky, bricked so often?)

	//initialize the PMIC registers:
	// LDO2 to 1.8V
	  data[0]=0x4F;
	  data[1]=0x0;
	  I2CUser_Write(PMIC_I2C_SLAVE_ADDR, data, sizeof(data));

	  /* ATTENTION: if I write this register - the I2C is dead, read ChipID does not work anymore
	   * write this register as the last one!
	   */
#if 0
	  data[0]=0x50;
	  data[1]=0xF;
	  I2CUser_Write(PMIC_I2C_SLAVE_ADDR, data, sizeof(data));
#endif

	  // LDO1 to 1.0V
	  data[0]=0x4c;
	  data[1]=0x5;
	  I2CUser_Write(PMIC_I2C_SLAVE_ADDR, data, sizeof(data));

	  data[0]=0x4d;
	  data[1]=0xF;		//was 0x3
	  I2CUser_Write(PMIC_I2C_SLAVE_ADDR, data, sizeof(data));

	  // LDO3 to 1.2V
	  data[0]=0x52;
	  data[1]=0x9;
	  I2CUser_Write(PMIC_I2C_SLAVE_ADDR, data, sizeof(data));

	  data[0]=0x53;
	  data[1]=0xF;
	  I2CUser_Write(PMIC_I2C_SLAVE_ADDR, data, sizeof(data));

	  osDelay(10);

	  //charger LED off - duty cycle
	  data[0]=0x9C;
	  data[1]=(1 << 7);		//0x80
	  I2CUser_Write(PMIC_I2C_SLAVE_ADDR, data, sizeof(data));

	  // Disable charger led
	  data[0]=0x9E;
	  data[1]=(1 << 5);		//0x20
	  I2CUser_Write(PMIC_I2C_SLAVE_ADDR, data, sizeof(data));

	  osDelay(10);

	  // SW3: set 2A as current limit
	  // Helps keeping the rail up at wifi startup
	  data[0]=0x42;
	  data[1]=2;
	  I2CUser_Write(PMIC_I2C_SLAVE_ADDR, data, sizeof(data));

	  osDelay(10);

	  // Change VBUS INPUT CURRENT LIMIT to 1.5A
	  data[0]=0x94;
	  data[1]=(20 << 3);		//0xA0
	  I2CUser_Write(PMIC_I2C_SLAVE_ADDR, data, sizeof(data));

	  // SW2 to 3.3V (SW2_VOLT)
	  data[0]=0x3B;
	  data[1]=0xF;
	  I2CUser_Write(PMIC_I2C_SLAVE_ADDR, data, sizeof(data));

	  // SW1 to 3.0V (SW1_VOLT)
	  data[0]=0x35;
	  data[1]=0xF;
	  I2CUser_Write(PMIC_I2C_SLAVE_ADDR, data, sizeof(data));

#if 1
	  osDelay(10);
	  data[0]=0x50;
	  data[1]=0xF;
	  I2CUser_Write(PMIC_I2C_SLAVE_ADDR, data, sizeof(data));
#endif

I hope it helps you as well. Using the Portenta H7 can be a "nightmare". And when it comes to issues, like: orange LED is on, no access anymore to board - it might drive you crazy as it does for me. Meanwhile: I understand the board much better, have my own FW, I do not need anymore the Arduino bootloader (and I can use also the 64KB flash space occupied by Arduino).

BTW: why Arduino team is never responding here in forum? They let us find solutions our self, to share between us as users. Arduino promotes Portenta H7 as "professional" system, but all what I realize: it is not any professional system (too flaky and not any support, no responses here and even not from Arduino team, e.g. when requesting a BSP Source Code).

Have fun with this great piece of HW (which Portenta H7 really is), but maybe as me: "get rid of any Arduino stuff" (and I have it meanwhile! "Uffff").

Hello @tjaekel

I'm following your instruction but have not much success to recover the Portenta H7. Sorry for the lengthy post but I am not sure where else to turn to :frowning: We have like 3 boards like this now in our lab, and we don't know why it even happens. We only use Arduino IDE to program and never connect them to ST-Link. We do run our board with external 5V apply to VIN.

Firstly, below is the I2C value when the Orange light is ON:

0 | 7C 0 11 0 0 0 88 0 0 7 0 4 7 0 0 3 
10 | 0 0 0 0 0 0 0 0 0 7 0 0 0 0 0 0 
20 | 0 5 0 0 0 3F 0 0 B 1F 4 0 0 0 0 0 
30 | 0 0 6 6 6 0 0 0 6 6 6 0 0 0 D D 
40 | D 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
50 | 0 0 0 0 0 0 0 0 1 80 0 0 0 0 0 0 
60 | 0 0 0 0 0 0 0 C 0 0 0 0 0 0 0 0 
70 | 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
80 | 68 0 FF 0 AC 0 20 3 4 2 0 0 0 40 2 AB 
90 | 0 0 0 0 A0 0 0 0 0 0 0 0 0 0 0 0 
A0 | 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
B0 | 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
C0 | 0 0 0 0 0 56 0 3F 28 4 0 2B 0 3B 0 0 
D0 | 0 0 0 10 0 0 0 0 0 0 0 0 0 0 0 0 
E0 | 0 0 A 20 0 0 0 0 0 0 0 0 0 0 0 0 
F0 | 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 

Below is the steps I follow from your guide:

  1. Change BOOT DIP switch. Connect USB-A from breakout board to host PC. Powered Portenta with USB-C connects to host PC.
  2. Press Reset - let boot MC into STM Bootloader <--- Portenta failed to go to bootloader mode, try again after item 3
  3. Configure remote PMIC via I2C.
  • I wrote the register per your codes snippet list. And here is my I2C table after writing. The Orange LED is OFF after programing the register but Red LED still flashes.

    Wrote 2 bytes to register 4F: wrote 0, read 0
    Wrote 2 bytes to register 4C: wrote 5, read 5
    Wrote 2 bytes to register 4D: wrote F, read F
    Wrote 2 bytes to register 52: wrote 9, read 9
    Wrote 2 bytes to register 53: wrote F, read F
    Wrote 2 bytes to register 9C: wrote 80, read 80
    Wrote 2 bytes to register 9E: wrote 20, read 20
    Wrote 2 bytes to register 42: wrote 2, read 2
    Wrote 2 bytes to register 94: wrote A0, read A0
    Wrote 2 bytes to register 3B: wrote F, read F
    Wrote 2 bytes to register 35: wrote F, read F
    Wrote 2 bytes to register 50: wrote F, read F

    0 | 7C 0 11 0 0 0 98 0 0 7 0 4 7 0 0 3 
    10 | 0 0 0 0 0 0 0 0 5 7 0 0 0 0 0 0 
    20 | 0 5 0 0 0 3F 0 0 F 1F 4 0 0 0 0 0 
    30 | 0 0 6 6 6 F 0 0 6 6 6 F 0 0 D D 
    40 | D 3 2 0 0 0 0 0 0 0 0 0 5 F 0 0 
    50 | F 0 9 F 0 0 0 0 1 80 0 0 0 0 0 0 
    60 | 0 0 0 0 0 0 0 C 0 0 0 0 0 0 0 0 
    70 | 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
    80 | 68 0 FF 0 AC 0 20 3 4 2 0 0 0 40 2 AB 
    90 | 0 0 0 0 A0 0 0 0 0 0 0 0 80 0 20 0 
    A0 | 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
    B0 | 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
    C0 | 0 0 0 0 0 56 0 3F 28 4 0 2B 0 3B 0 0 
    D0 | 0 0 0 10 0 0 0 0 0 0 0 0 0 0 0 0 
    E0 | 0 0 A 20 0 0 0 0 0 0 0 0 0 0 0 0 
    F0 | 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
    
  1. Try 2 again. Works!
  2. Check device with dft-util --list
Found DFU: [0483:df11] ver=0200, devnum=73, cfg=1, intf=0, path="1-5", alt=1, name="@Option Bytes   /0x5200201C/01*128 e", serial="200364500000"
Found DFU: [0483:df11] ver=0200, devnum=73, cfg=1, intf=0, path="1-5", alt=0, name="@Internal Flash   /0x08000000/16*128Kg", serial="200364500000"
  1. Reprogram the Arduino bootloader with
    dfu-util -a 0 -d 0483:df11 --dfuse-address=0x08000000:leave -D portentah7_bootloader_mbed_hs.bin
  • I got the binary file from ArduinoCore-mbed/bootloaders/PORTENTA_H7 at master · arduino/ArduinoCore-mbed · GitHub

  • And things seem to run OK. I read somewhere that dfu-util: Error during download get_status at the end may not necessary mean the upload failed.

    dfu-util 0.9
    
    Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
    Copyright 2010-2016 Tormod Volden and Stefan Schmidt
    This program is Free Software and has ABSOLUTELY NO WARRANTY
    Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
    
    dfu-util: Invalid DFU suffix signature
    dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
    Opening DFU capable USB device...
    ID 0483:df11
    Run-time device DFU version 011a
    Claiming USB DFU Interface...
    Setting Alternate Setting #0 ...
    Determining device status: state = dfuIDLE, status = 0
    dfuIDLE, continuing
    DFU mode device DFU version 011a
    Device returned transfer size 1024
    DfuSe interface name: "Internal Flash   "
    Downloading to address = 0x08000000, size = 128052
    Download	[=========================] 100%       128052 bytes
    Download done.
    File downloaded successfully
    dfu-util: Error during download get_status
    
  • When upload is done, the Red LED flashes again. Orange LED did not return.

  1. change BOOT DIP switch back, reset
  • I also removed all the I2C cable to breakout board.
  • Clicked the reset button on the Portenta. I did not see the Orange light return, but have blinking red.
  • I checked the port on Arduino IDE but did not see anything.
  • I remove the USB-A cable from the host PC, click Reset on Portenta again. Still no Orange light returns but still no device found on Arduino IDE.
  • Finally, I unplugged the USB-C and power cycle. This time, the solid Orange light returns with blinking RED

I have to digest all the details.
Just few remarks:

  • if you program via I2C the I2C registers and you read back all registers - some are read-only,
    some reflect INT Status: it means: a full hex dump comparison will never match
  • I assume, also the bootloader is gone:
    • after you have programmed the PMIC via I2C: have debugger connect, try to connect
    • if debugger can see and connect - GREAT (the PMIC config was OK)
    • flash the bootloader again
      Than reboot, re-cycle power. Potentially, if bootloader is gone - it does not help just to reconfigure PMIC.

Just for curiosity:

  • do you see the orange LED gone when doing all this I2C stuff?

I think you try via the STM bootloader, via this BOOT switch (and USB-A cable to PC).
I tried once - was working - but not sure: I guess I did when my PMIC was OK.

I could imagine:

  • you connect USB-A (with boot switch set) - but PMIC broken ==> so, the STM bootloader is not visible
  • you program the PMIC (power is back)
  • BUT: for entering the STM bootloader you had to reset (to start again the USB-A):
    ==> but reset of MCU board loses all the I2C PMIC you have done before - back to start

Using USB-A in combination with a bricked PMIC (even covering via I2C) - might not be possible.
You had to use the breakout board or VisionShield just to have connector for debug (SWD, JTAG) and use external debugger to re-flash the Arduino bootloader.

The STM bootloader (via USB-A) might work only when PMIC is alive.
Or - please try:

  • recover the PMIC but without USB-A connected
  • connect USB-A after PMIC is alive
    But not sure: MCU might run somewhere else in code and wants to be reset. But reset kills the PMIC.

Sorry.

Reading the tail of your post:
"hmmm" no idea:
Just loud thinking:

  • orange LED back = PMIC again not properly configured
  • red blinking: actually, this can only happen if MCU reports a crash (a serious error on code
    execution: so the MCU was alive a bit but has entered a HardFault_Handler, for instance)

Not seen by me, hard to replicate. Looks more like a broken HW, the bootloader crashes already.
For instance: you say: MCU not visible in IDE (see below) - maybe MCU crashed when it tries to enable USB-C for UART.

USB UART:

  • can you check with USB-C connected if a UART device (for Arduino bootloader) does pop up?
    (in Windows Device Manager)

If not, and the red blinking LED - a very serious (HW) issue. And no clue.

The PMIC programming should "just" do this:

  • the orange LED is gone
  • the voltage on board (measure with volt meter) are reasonable (3.0V, 3.1V - everywhere)
  • the USB-C is visible as a UART device on PC Device Manager

I am sorry.

Thank you for your feedback. I understand it is hard to replicate, so I am just expecting any pointer from your that I have overlooked.

Actually. Read your sample codes again and add a few more register address and values did turn off the Orange LED.
I did a few checks per your suggestion.

  1. Connect USB-C only to power, disconnect USB-A.
  • First boot: solid Orange and flashing RED.
  1. Connect I2C from Arduino MKRZERO and program the I2C.
  • Orange light is off. Still blinking Red
  • Probe GND and 3V3 pin. I got 3.0V
  • Did not see new usb device pop up on the machine or Arduino IDE
  1. Hit Reset
  • Blinking Red stopped. Orange light does not return.
  • Probe GND and 3V3 pins. Still got 3.0V
  • Still no new USB device is detected.
  1. Unplugged USB-C and plug back.
  • Orange light and flashing RED

All of the above are basically 100% replicable by me every time now.

I see:
Oh, BTW: do you flip back the boot switch before you power on again?
(if not - it would explain: still STM bootloader active which does not configure PMIC).

On the new power-cycle - you must change the BOOT config back to original.

If even this does not work, back to normal BOOT and no UART, no Arduino bootloader - even you have flashed (check that really the bootloader.BIN at address 0x08000000 was flashed) - I would argue: something else in HW is broken (e.g. flash ROM, SRAM).

I did not in the last post. But I did it just now.

  1. After I programmed the I2C and got Orange light off.
  2. Connect USB-A with BOOT switch to the right. Hit Reset. Then I can program the Portenta with dfu-util -a 0 -d 0483:df11 --dfuse-address=0x08000000:leave -D portentah7_bootloader_mbed_hs_v2.bin

This is the latest binary I got from the Arduino repo BTW, do you know if this repo should be the correct place for me to obtain the bootloader binary?

  1. After dfu-utils flashing is done.
  • Arduino flashes RED again but no Orange light return.
  • Probe GND and 3.3V. Still got 3.0V
  • Still did not find USB device on Arduino IDE
  1. Move dip switch back to original - all switches to the Left or toward the Arduino Pro label. Power cycle
  • Orange light and flashing red is back

So seems like the bootloader flashing does not do much affect for me here?

I bricked mine yesterday again due to downloading a CubeIDE project and turning the Portenta off without first burning the boot loader from the Arduino 1.8 IDE. To repair it, I connected 3V3 from an Arduino Uno 3V3, set the boot dip switch on the breakout board, burned the boot loader from the Arduino 1.8 IDE, reset the boot switch and cycled the power.

That should work, I do it routinely when I make that mistake. The boot loader will program the PMIC appropriately, so you don't need to worry about programming the PMIC yourself using I2C from another Arduino. I did that too when I started, now realize it was a waste of time. Connecting 3V3 from another Arduino may have the same effect as Tjaekels 2nd USB cable - it provides power.

I did not read all the messages in this thread, HTH FWIW.

About the preferences of using Arduino features or toss them all for native STM32 coding: I like Mbed-OS and some things that the Arduino boot loader sets up (SDRAM, QSPI flash, serial port, boot loader and PMIC). I have a CubeIDE project for hardware configuration, copy the generated code into an Arduino integration project that is a debug-able makefile project in CubeIDE. So, the Arduino integration build with Mbed-OS works for me.

How did you burn the bootloader from the Arduino IDE? Would you mind sharing the steps? Does it involve STLink? I am waiting for the ribbon cable to connect the breakout board to my STLink.

My problem is Arduino IDE cannot find my device in "Port" no matter what I did after recovering the power by programming PMIC and get out of ST Boot mode. I attempted to re-download Arduino Bootloader several times using dfu-util commands. It did not do much for me. After power cycle, ORANGE light just returns.

Honestly,I'm willing to try anything at this point.

Yes I use ST-Link v2. I hope it works for you when you get the cable.

To be precise, since I had to do it 2 more times by being forgetful,

  1. Make sure you have 3.3V from somewhere on the 3V3 pin
  2. Turn the BOOT switch on the breakout board to the ON position (BOOT label side)
  3. Press the ON button on the breakout board
  4. Burn the boot loader using ST-Link v2 from the Arduino 1.8 IDE
  5. Turn the BOOT switch to the OFF position
  6. Power cycle the Portenta

If you have to DIY-wire up the ST-Link v2 with the 20-pin breakout board JTAG ribbon cable, here are the connections that work for me. It may save you some time as I painstakingly found out.

Breakout board ASX00031 JTAG pin connections:

1: +3V3 (= ST-Link-v2 pin 1)
2: TMS/SWDIO (= ST-Link-v2 pin 7)
3: GND (= ST-Link-v2 pin 6)
4: TCK/SWCLK (= ST-Link-v2 pin 9)
6: TDO/SWO (= ST-Link-v2 pin 13)
10: RESET (= ST-Link-v2 pin 15)

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.