Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: [1] 2  Send TopicPrint
Very Hot Topic (More than 25 Replies) Portenta h7 h7 fails to flash with ThreadDebug (Read 11188 times)
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2175
Joined: Feb 13th, 2019
Portenta h7 h7 fails to flash with ThreadDebug
Jul 2nd, 2021 at 1:48pm
Print Post  
After adding the Thread Debug Library and header code (as instructed here) to the sketch, it fails to flash to the Portenta Device:

Code
Select All
Uploading 'Visual_Micro_test_1' to 'Arduino Portenta H7 (M7 core)' using 'COM29'
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/
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/

The uploader returned an error
Warning: Invalid DFU suffix signature
A valid DFU suffix will be required in a future dfu-util release
No DFU capable USB device available 

  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Portenta h7 h7 fails to flash with ThreadDebug
Reply #1 - Jul 2nd, 2021 at 2:22pm
Print Post  
The h7 can end up in that state for various reasons unconnected to vmicro. And Always after debug session.

You have to click reset or reconnect the usb.
  
Back to top
WWW  
IP Logged
 
Sid Price
Junior Member
**
Offline


Posts: 54
Location: Tijeras
Joined: Jun 28th, 2021
Re: Portenta h7 h7 fails to flash with ThreadDebug
Reply #2 - Jul 2nd, 2021 at 3:02pm
Print Post  
I did try pressing reset and that did not help, although, when to press reset during the build/load/debug cycle is unclear.

Attached is the log requested.
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Sid Price
Junior Member
**
Offline


Posts: 54
Location: Tijeras
Joined: Jun 28th, 2021
Re: Portenta h7 h7 fails to flash with ThreadDebug
Reply #3 - Jul 5th, 2021 at 9:10pm
Print Post  
Any news on this issue, I really would love to be using Visual Micro on this Portenta project.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Portenta h7 h7 fails to flash with ThreadDebug
Reply #4 - Jul 6th, 2021 at 1:10am
Print Post  
You should click the reset before upload. The problem is that the board is confused with its usb. 

The board uses a type of upload first introduced for the Arduino Leonardo. When upload attempts to start it has to open the port you have selected and write to it at a speed of 1200 baud. That sends a signal the board looks out for, if it sees the 1200baud connection it re-boots onto a different serial port that must be used for upload.

In your output you can see visual micro scanning the com ports waiting for the new port to appear. It never does. The new port should appear immediately, after 20 secs Visual Micro gives up. This shows that the board is not responding and needs reset. 

Clicking reset during the "scan for new ports" phase will not help and will confuse things further, it must be reset before 
upload is attempted.

This is the trace that shows the scan for new port:-

Quote:
Uploading via Bootloader 
PORTS {COM1,COM5,COM16,COM17,COM29} / {COM1,COM5,COM16,COM17,COM29} => {}
PORTS {COM1,COM5,COM16,COM17,COM29} / {COM1,COM5,COM16,COM17,COM29} => {}

When you hit the issue please try same in the arduino ide. See if the board has an issue as ofte?

Thanks

« Last Edit: Jul 6th, 2021 at 1:11am by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
Sid Price
Junior Member
**
Offline


Posts: 54
Location: Tijeras
Joined: Jun 28th, 2021
Re: Portenta h7 h7 fails to flash with ThreadDebug
Reply #5 - Jul 6th, 2021 at 1:30pm
Print Post  
Thanks Tim, I tried the classic Arduino IDE and the upload afils there. I see the following:

Uploading using selected port: COM29
ino1/dfu-util --device 0x2341:0x035b -D  -a0 --dfuse-address=0x08040000:leave 
dfu-util 0.10-dev

Warning: Invalid DFU suffix signature
A valid DFU suffix will be required in a future dfu-util release
No DFU capable USB device available
An error occurred while uploading the sketch

Note I had to clip some of the output because of it using all caps.

It seems the DFU port is being found but the upload still fails, any suggestions?

Thanks
  
Back to top
 
IP Logged
 
Sid Price
Junior Member
**
Offline


Posts: 54
Location: Tijeras
Joined: Jun 28th, 2021
Re: Portenta h7 h7 fails to flash with ThreadDebug
Reply #6 - Jul 6th, 2021 at 2:40pm
Print Post  
I changed to a second Portenta H7 and the test sketch uploaded, I added a simple serial print, that sketch uploaded and ran.

So, I switched back to VM and attempted to upload the same sketch to the same Portenta H7 and the upload failed.

Then, back to the classic Arduino IDE and it uploaded fine.

Seems there are two issues, one, my original Portenta H7 has failed in someway, and two, VM is unable to flash the second Portenta.
  
Back to top
 
IP Logged
 
Sid Price
Junior Member
**
Offline


Posts: 54
Location: Tijeras
Joined: Jun 28th, 2021
Re: Portenta h7 h7 fails to flash with ThreadDebug
Reply #7 - Jul 6th, 2021 at 4:32pm
Print Post  
What I have discovered so far:

If I use the 2.0 (beta 8) IDE to upload the sketch to the original Portenta and double press reset while the output window says it is waiting for the bootloader, the code flashes.

When I go back to Visual Studio and VM I get the original problem of the GDB error about not being able to start debugging.

  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2175
Joined: Feb 13th, 2019
Re: Portenta h7 h7 fails to flash with ThreadDebug
Reply #8 - Jul 7th, 2021 at 2:36pm
Print Post  
Checking the upload on my system today:
If double tap the reset button on the board, the Green LED fades in and out to show its in bootloader mode.
Then check the COM Port in IDE of choice is correct.
Then Upload

After stopping a debugging session:
If you cannot upload, repeat the process above.
Also note you have to tap reset once to allow it to re-attach again, again check the COM port before re-attaching.

We are improving the GDB Debugging configuration in the next release which should resolve the error on trying to attach the debugger,  and give an option to reset the board when stop debugging is pressed automatically.  This will be available over the coming day or so, and we will update this thread when it is available.
  
Back to top
 
IP Logged
 
Sid Price
Junior Member
**
Offline


Posts: 54
Location: Tijeras
Joined: Jun 28th, 2021
Re: Portenta h7 h7 fails to flash with ThreadDebug
Reply #9 - Jul 7th, 2021 at 4:46pm
Print Post  
Quote:
Checking the upload on my system today:
If double tap the reset button on the board, the Green LED fades in and out to show its in bootloader mode.
Then check the COM Port in IDE of choice is correct.
Then Upload


If the Green LED is flashing, even if the DFU port is selected in VisualMicro, the DFU port is not found. This is what I would expect since I assume VisualMicro is looking for a "regular" Arduino port before it begins the DFU process.

Quote:
After stopping a debugging session:


I am not able to start a debug session.  Sad

Looking forward to the next release.
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2175
Joined: Feb 13th, 2019
Re: Portenta h7 h7 fails to flash with ThreadDebug
Reply #10 - Jul 7th, 2021 at 5:19pm
Print Post  
You can prevent the COM Port scanning in the interim, by adding a local board.txt to the project (vMicro > Add Code > Add Local Board.txt), and paste in the entry below:
Code
Select All
upload.use_1200bps_touch=false 

  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2175
Joined: Feb 13th, 2019
Re: Portenta h7 h7 fails to flash with ThreadDebug
Reply #11 - Jul 7th, 2021 at 5:48pm
Print Post  
The latest release is now available (21.06.06.13) at the top of the board below:
https://www.visualmicro.com/forums/YaBB.pl?board=VS_ARDUINO_EXT_RELEASES

This includes both the serial port touch amendment, and the fix to the MIR Debugging configuration.
  
Back to top
 
IP Logged
 
Sid Price
Junior Member
**
Offline


Posts: 54
Location: Tijeras
Joined: Jun 28th, 2021
Re: Portenta h7 h7 fails to flash with ThreadDebug
Reply #12 - Jul 7th, 2021 at 9:16pm
Print Post  
Thank you, some progress Smiley

I am able to download the sketch by double-clicking the reset button and placing the Portenta into DFU mode. However, the debugger only ran the very first time I tried the code. It stopped at a breakpoint in Setup and I was able to step-in and over. However, that was only the first time I ran the debugger. Now I see the same message box I saw previously about "unexpected output from gdb."
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2175
Joined: Feb 13th, 2019
Re: Portenta h7 h7 fails to flash with ThreadDebug
Reply #13 - Jul 8th, 2021 at 9:41am
Print Post  
Thanks for the update, and glad there is forward progress.

After the debugger has been stopped, you will need to press the reset button once to reset the board, before it will re-attach.

An alternative option is to add a Local Board.txt to the project (vMicro > Add Code > Add Local Board.txt), and the below code:
Code
Select All
vs-cmd.Debug.ResetOnStop=true 



This will reset the board when the debugger stops automatically, BUT only works when you stop debugging whilst stopped on a breakpoint.
  
Back to top
 
IP Logged
 
Sid Price
Junior Member
**
Offline


Posts: 54
Location: Tijeras
Joined: Jun 28th, 2021
Re: Portenta h7 h7 fails to flash with ThreadDebug
Reply #14 - Jul 9th, 2021 at 1:24pm
Print Post  
I am still not able to debug the Portenta H7 with Visual Micro.

I have added the line you suggested to "Board.txt".

This is my procedure:

  • Start Visual Studio and open the test solution
  • Request Visual Micro to Start Debugging
  • Double press the reset switch on the Portenta to enter bootloader mode
  • Code compiles and is downloaded
  • Visual Micro shows message box "Unable to start debugging ... Unexpected output etc.


Hoping this can be addressed  Smiley
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2175
Joined: Feb 13th, 2019
Re: Portenta h7 h7 fails to flash with ThreadDebug
Reply #15 - Jul 9th, 2021 at 1:41pm
Print Post  
Can you confirm you have the Debugger set to the normal Serial Port (e.g. COM24 in my setup) when you run Debug > Attach to Process

The Upload Port would still be set to the DFU Port (e.g. COM20 in my setup).

Also make sure (just in case) there aren't any orphaned instances of the arm-none-eabi-gdb.exe running before starting debugging.
« Last Edit: Jul 9th, 2021 at 2:04pm by Simon@Visual Micro »  
Back to top
 
IP Logged
 
Sid Price
Junior Member
**
Offline


Posts: 54
Location: Tijeras
Joined: Jun 28th, 2021
Re: Portenta h7 h7 fails to flash with ThreadDebug
Reply #16 - Jul 9th, 2021 at 2:22pm
Print Post  
More observations:

If I use "Debug/Attach to Process", debugging works every time. I have the serial port drop-down next to the board-selector drop-down set to the DFU port, and the debug port (next to "MIR (Built-In)") set to the normal serial port.

When using the "Start Debugging" selection, and using my procedure from above, I see the error from Visual Micro BEFORE Windows has finished re-enumerating the Portenta after it is being switched back to the normal serial port. This is why GDB cannot start I think.
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2175
Joined: Feb 13th, 2019
Re: Portenta h7 h7 fails to flash with ThreadDebug
Reply #17 - Jul 9th, 2021 at 2:36pm
Print Post  
Thanks for the detail.

We will look at the Debug > Start option to see if we can resolve the issue, and amend the documentation accordingly.

The ThreadDebug code doesn't allow the program to start until the debugger connects to my knowledge, so Debug > Attach should still get to the start of the program, just with one more click.

On a related note, we will also be able to update more on the use of External Hardware Probes (JLink,STLink etc) in the coming weeks as well.
« Last Edit: Jul 9th, 2021 at 2:42pm by Simon@Visual Micro »  
Back to top
 
IP Logged
 
Sid Price
Junior Member
**
Offline


Posts: 54
Location: Tijeras
Joined: Jun 28th, 2021
Re: Portenta h7 h7 fails to flash with ThreadDebug
Reply #18 - Jul 9th, 2021 at 3:58pm
Print Post  
Quick note: I was able to switch over to debugging my "real" project, a multi-threaded Wi-Fi project, and begin debugging on the M7. Later I need to try out debugging the same code on the M4. Is there anything I should be aware of when debugging the M4?

Also, I have a JLink-Ultra and would really like to be doing this debugging using it. So, would be happy to work with you when you get that feature ready.

Many thanks, I will be purchasing a commercial license right away!   Smiley
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2175
Joined: Feb 13th, 2019
Re: Portenta h7 h7 fails to flash with ThreadDebug
Reply #19 - Jul 9th, 2021 at 4:17pm
Print Post  
I'm not sure that the ThreadDebug Library compiles on the M4 Core, so it may only support the M7 Core in isolation at present, I'll be able to test this further later and update.

Thanks for the assistance here, and it is always helpful to have your help in the future as well, we will update when that feature is available.

  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint