Cant upload to Portenta Machine Control. No usb-serial modem is pressent

Hi

I have been connecting to my Portenta Machine Control for a week. But suddenly I cant connect to it via the USB. No upload methods is working.

There is only a Bluetooth port available. What has happened? What can I do?

This is the error message

Performing 1200-bps touch reset on serial port /dev/cu.Bluetooth-Incoming-Port
Waiting for upload port...
No upload port found, using /dev/cu.Bluetooth-Incoming-Port as fallback
"/Users/tobiasvonhaslingen/Library/Arduino15/packages/arduino/tools/dfu-util/0.10.0-arduino1/dfu-util" --device 0x2341:0x035b -D "/private/var/folders/10/x2m0s9z542sfk2nn6smh_vqw0000gn/T/arduino/sketches/07AEE63BFFDE4DE61EEB16B09C5FF07B/2024_08_28_PumpAutomation_1.ino.bin" -a0 --dfuse-address=0x08040000:leave
dfu-util: Warning: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release
dfu-util 0.10-dev

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2021 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to dfu-util / Tickets

dfu-util: No DFU capable USB device available
Failed uploading: uploading error: exit status 74

Hi @haslingen. Please try this experiment and then report back with the results:

  1. Connect the Portenta Machine Control to your computer with the USB cable.
  2. Press and release the reset button on the board.
  3. Wait about a half second (but not longer than a second).
  4. Press and release the reset button again.
  5. If it is already open, close the Tools > Port menu in Arduino IDE.
  6. Open the Tools > Port menu in Arduino IDE.

Now please reply here on the forum thread with the answers to the following question:

  • Do you see a port labeled Arduino Portenta H7 in the Tools > Port menu?

Yes

I see the /dev/cu.Bluetooth-Incoming-Port

But it has been there all the time.

And as soon as I add a Arduino Uno it shows up on my tools/port. But I cant get the usb connection for the PMC.

I found that you said to remove and install the Portenta board library. So I Did.

Tool arduino:arm-none-eabi-gcc@7-2017q4 already installed
Tool arduino:dfu-util@0.10.0-arduino1 already installed
Tool arduino:imgtool@1.8.0-arduino.2 already installed
Tool arduino:openocd@0.11.0-arduino2 already installed
Downloading packages
arduino:adb@32.0.0
arduino:mbed_portenta@4.1.5
Installing arduino:adb@32.0.0
Configuring tool.
arduino:adb@32.0.0 installed
Installing platform arduino:mbed_portenta@4.1.5
Configuring platform.

You might need to configure permissions for uploading.
To do so, run the following command from the terminal:
sudo "/Users/tobiasvonhaslingen/Library/Arduino15/packages/arduino/hardware/mbed_portenta/4.1.5/post_install.sh"

Platform arduino:mbed_portenta@4.1.5 installed

Then I run the command

tobiasvonhaslingen@MacBook-Pro-2 ~ % sudo "/Users/tobiasvonhaslingen/Library/Arduino15/packages/arduino/hardware/mbed_portenta/4.1.5/post_install.sh"

Password:

Sorry, try again.

Password:

/Users/tobiasvonhaslingen/Library/Arduino15/packages/arduino/hardware/mbed_portenta/4.1.5/post_install.sh: line 31: /etc/udev/rules.d/60-arduino-mbed.rules: No such file or directory

Reload rules...

/Users/tobiasvonhaslingen/Library/Arduino15/packages/arduino/hardware/mbed_portenta/4.1.5/post_install.sh: line 35: udevadm: command not found

/Users/tobiasvonhaslingen/Library/Arduino15/packages/arduino/hardware/mbed_portenta/4.1.5/post_install.sh: line 36: udevadm: command not found

tobiasvonhaslingen@MacBook-Pro-2 ~ %

Please ignore the failure of this command. The instructions you followed are specific to Linux. It is expected that the command will fail when you attempt to follow the instructions on a macOS machine. This procedure is not necessary on a macOS computer and the failure of the command doesn't cause any harm and is not the cause of the problem you are experiencing.

The bug that causes these instructions to be inappropriately displayed to macOS users has been fixed already:

However, that fix was made after the time of the 4.1.5 release of the "Arduino Mbed OS Portenta Boards" platform so this is why you still see the confusing message when you install the platform. I apologize for any confusion the inappropriate message might have caused.

OK NP.

What do I do to get my PMC up and working. I was supposed to mount it on a machine and run tests on it today. I have a very hard deadline and am a bitt stressed.

Can the borad stoped to work?

Should I buy a second PMC? Will it work with that?

What to do?

Acctually this happened one time before. But it "fixt" it self ... Maybe there was an upgrade of the IED in between. I went to sleep and when I woke up and tried it worked.

So when this happened I was not alarmed in the beginning but having tried for more than 12 hours I am getting a bit worried.

Unfortunately although I have a good deal of experience with the Portenta H7 Arduino board that is the brains of the Portenta Machine Control, I don't have any experience with the Portenta Machine Control control itself and don't have access to this hardware.

The tricky thing about the boards with native USB capability like the Portenta H7 is the USB code that creates the CDC serial port is running on the same microcontroller as your sketch. This means your sketch code can break the USB code, or stop it from running. When that happens, the board no longer produces a serial port. This can be caused by a bug in the sketch code (e.g., dividing by zero), or as an expected result (e.g., putting the microcontroller to sleep).

This can be unexpected to those who previously mainly worked with the boards like Uno and Mega with a dedicated USB chip that can never be affected by the sketch code.

The missing port makes it so you can't upload normally any more. However, the situation is really not so bad because there is an independent program called the bootloader in a separate section of memory from your sketch, and that program has its own USB CDC code. So even if the sketch is completely broken, you only need to activate the bootloader to get a port back and be able to upload.

On the Portenta H7 board, that is done by the following procedure:

  1. Connect the Portenta H7 board to your computer with the USB cable.
  2. Press and release the reset button on the board.
  3. Wait for the green LED near the USB socket on the board to turn on.
    It does this almost immediately, but you do need to wait for it.
  4. While the green LED is still on (it only stays on for one second so you need to be somewhat quick), press and release the reset button again.
    The green LED should now start pulsing. If not, repeat the process in case you didn't get the timing quite right.

After that, the board should produce a serial port. Once you have activated the bootloader, the board remains in the bootloader mode until an upload is completed or the board is reset or power cycled.

If you once again upload the same sketch that caused the loss of the serial port, it is likely this will happen again. If the loss of the port is unexpected, this means that you still need to evaluate the code to try to find out what is causing it, but at least once you know the recovery technique this is not a dead end situation.


Unfortunately I'm not sure of the behavior of the Portenta Machine Control related to this double reset technique and I didn't find any information about it in the documentation. The Portenta H7 inside is no different from using a standalone bare Portenta H7 board, but the electrical interface (reset button and LED) between the Portenta Machine Control hardware and the Portenta H7 board inside might result in differences in behavior that I am not aware of.

Another thing to consider is that the sketch program interfering with the USB CDC functionality is only one possible cause of the "no port" symptom. There are other common causes of this symptom:

  • Using a charge-only, damaged, or defective USB cable.
  • Permanent physical damage to the hardware.

If the problem is the USB cable, it can be solved by using a different cable. Make sure it is fully inserted into the jack on the Portenta Machine Control and your computer.

If the problem is physical hardware damage then it is usually not easily repairable and the solution is to replace the hardware.

I'm sorry I'm not able to provide more effective assistance for this specific hardware. You can contact Arduino technical support, who are better equipped to support Portenta Machine Control users:

https://www.arduino.cc/en/contact-us

I think this is a IDE issue.

As I did multiple fast push if the reset I got the USB serial to work.

So I started to do an upload of my sketch

"/Users/tobiasvonhaslingen/Library/Arduino15/packages/arduino/tools/dfu-util/0.10.0-arduino1/dfu-util" --device 0x2341:0x035b -D "/private/var/folders/10/x2m0s9z542sfk2nn6smh_vqw0000gn/T/arduino/sketches/07AEE63BFFDE4DE61EEB16B09C5FF07B/2024_08_28_PumpAutomation_1.ino.bin" -a0 --dfuse-address=0x08040000:leave
dfu-util: Warning: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release
dfu-util 0.10-dev

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2021 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/

Opening DFU capable USB device...
Device ID 2341:035b
Device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Interface #0 ...
Determining device status...
DFU state(2) = dfuIDLE, status(0) = No error condition is present
DFU mode device DFU version 011a
Device returned transfer size 4096
DfuSe interface name: "Internal Flash 2MB "
Downloading element to address = 0x08040000, size = 341656

Erase [ ] 0% 0 bytes
Erase [ ] 0% 0 bytes
Erase [= ] 4% 16384 bytes
Erase [== ] 8% 28672 bytes
Erase [=== ] 13% 45056 bytes
Erase [==== ] 16% 57344 bytes
Erase [===== ] 20% 69632 bytes
Erase [====== ] 25% 86016 bytes
Erase [======= ] 28% 98304 bytes
Erase [======== ] 32% 110592 bytes
Erase [========= ] 37% 126976 bytes
Erase [========= ] 38% 131072 bytes
Erase [========== ] 40% 139264 bytes
Erase [=========== ] 44% 151552 bytes
Erase [============ ] 49% 167936 bytes
Erase [============= ] 52% 180224 bytes
Erase [============== ] 56% 192512 bytes
Erase [=============== ] 61% 208896 bytes
Erase [================ ] 64% 221184 bytes
Erase [================= ] 68% 233472 bytes
Erase [================== ] 73% 249856 bytes
Erase [=================== ] 76% 262144 bytes
Erase [==================== ] 80% 274432 bytes
Erase [===================== ] 85% 290816 bytes
Erase [====================== ] 88% 303104 bytes
Erase [======================= ] 92% 315392 bytes
Erase [======================== ] 97% 331776 bytes
Erase [=========================] 100% 341656 bytes
Erase done.

Download [ ] 0% 0 bytes
Download [ ] 3% 12288 bytes
Download [= ] 4% 16384 bytes
Download [== ] 8% 28672 bytes
Download [=== ] 13% 45056 bytes
Download [==== ] 16% 57344 bytes
Download [===== ] 20% 69632 bytes
Download [====== ] 25% 86016 bytes
Download [======= ] 28% 98304 bytes
Download [======== ] 32% 110592 bytes
Download [========= ] 37% 126976 bytes
Download [========== ] 40% 139264 bytes
Download [=========== ] 44% 151552 bytes
Download [============ ] 49% 167936 bytes
Download [============= ] 52% 180224 bytes
Download [============== ] 56% 192512 bytes
Download [=============== ] 61% 208896 bytes
Download [================ ] 64% 221184 bytes
Download [================= ] 68% 233472 bytes
Download [================== ] 73% 249856 bytes
Download [=================== ] 76% 262144 bytes
Download [==================== ] 80% 274432 bytes
Download [===================== ] 85% 290816 bytes
Download [====================== ] 88% 303104 bytes
Download [======================= ] 92% 315392 bytes
Download [======================== ] 97% 331776 bytes
Download [=========================] 100% 341656 bytes
Download done.
File downloaded successfully
Transitioning to dfuMANIFEST state

And now it is not working again.
That is the usb is gone.

It is not.

Great! I guess you didn't get the timing quite right the first time you tried it:

The double timing is a bit tricky with the Portenta H7 because you have to wait a short time, but not too long, between the two button presses.

This is probably because the sketch you uploaded has some code that breaks the USB CDC functionality.

Please try this experiment and then report back here with the results:


:red_exclamation_mark: This procedure is not intended to solve the problem. The purpose is to gather more information.


  1. Select File > Examples > 01.Basics > BareMinimum from the Arduino IDE menus.
    The "BareMinimum" example sketch will open in a new Arduino IDE window.
  2. Activate the bootloader and upload the "BareMinimum" sketch, using the same recovery technique described in my previous reply.
  3. Wait for the upload to finish successfully.

Please add a reply here on this forum thread to tell us whether the problem of the board not producing a port still occurs when it is running this "BareMinimum" sketch.


In this experiment, the "BareMinimum" sketch is serving as a "known good" sketch that doesn't contain any code that might interfere with the board's ability to generate a USB CDC port. If the problem occurs when your real sketch is running on the board, but doesn't occur when "BareMinimum" is running on it, then we will know for certain that the problem is caused by something in the real sketch's code and we can focus our attention exclusively on identifying the problematic code.


Ok Now it works :smiley:

I somehow destroy my USB handling with the latest code ... :cold_face:

Thanks a lot!!!!!

It was not very easy to understand what had happened.
I did try the reset thing a supple of time but it was not until I did several multiple fast pushes on the reset as it started to work..

You are welcome. I'm glad it is working now.

Did you find the cause? If not, and you want assistance in tracking down the problem, you can post your sketch code here. The forum helpers will take a look and see if we might be able to spot the culprit.

Yeah, it is a bit tricky. Fortunately once you learn the technique you should be able to reliably recover the board from this state.

The breakage of the USB CDC functionality is is pretty much just an expected occurrence during the development of complex sketches when working with any of the boards with a native USB capability since it is inevitable that we will all write some buggy code from time to time. So this technique is definitely a valuable skill to have on hand for all your Arduino development endeavors.

Yes I think I know ....

    MachineControl_DigitalOutputs.begin();
    // Initialize the analog input channels of the Portenta Machine Control in 0-10V mode
    if (MachineControl_AnalogIn.begin(SensorType::MA_4_20)){
      Serial.println("- Failed to initialize the analog input!");
    }
    // Initialize the analog output channels
    MachineControl_AnalogOut.begin();
    // Set the PWM period for channel 0 to 4 ms (or 250 Hz)
    MachineControl_AnalogOut.setPeriod(0, PERIOD_MS);

    MachineControl_DigitalInputs.begin();

  //  if (!MachineControl_DigitalInputs.begin()) {
  //    Serial.println("- Failed to initialize the digital input GPIO expander!");
  //  }```


When I remove this line it works     MachineControl_DigitalInputs.begin(); 

When it is there the USB brakes down?

Now I know ... If you don't put Wire.begin(); before that line it crashes.