Cube Orange plus keeps connecting and disconnecing to the USB port

Hello,
We’re trying to make a university project, where we have to alter some of the ArduCopter code on our Cube Orange plus. We have flashed our code and now when we plug it in the PC via USB port, it connects for 2 seconds and then disconnects. This happens in a loop.

We figured that our code may crash the bootloader or something like that, but we have no way of resetting the cube, because when we try to reflash it with fresh ArduCopter firmware, it disconnects and fails.

We have tried reflashing both in MP and through Ubuntu terminal.

Does anyone know how to reset the cube without connecting it through the USB port?

@niko5462 can you share the output when trying to flash through Ubuntu terminal. Also does the USB device disappear when it goes down, or only mavlink connection drops out.

Yes the USB device dissapears from the device manager, until it recoonects.

@niko5462 can you share the update result from ubuntu. Also another thing to try is try flashing Arduplane instead of ArduCopter so all the systems and parameters are reset.

I dont have the Ubuntu results right now, because somehow it just worked after 2 days of trying. I guess we were lucky enough to manage to flash in the 2 seconds it was connected

It is generally not possible to brick Cube like that. Unless the bootloader was changed. When you have a bad firmware loaded, the bootloader with start first. To recover it the best way is to start the uploader, then plug the cube as it is looking for bootloader. The cube is in bootloader state for a few seconds at boot. Which is enough for uploader to put it in update mode.