Welcome, Guest. Please Login or Register
Arduino IDE for Visual Studio
 
 
When Logging a Support Issue in the Forum, please ensure you have also:-
  • Enabled vMicro > Compiler > Show Build Properties and Verbose
  • 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
 
  HomeSearch Tutorials & Wiki visualmicro.com LoginHelpRegister  
 
Page Index Toggle Pages: 1
Send Topic Print
MSVS 2019 + Adafruit Feather M0 + J-Link (Read 1075 times)
J Moore
Junior Member
**
Offline



Posts: 12
MSVS 2019 + Adafruit Feather M0 + J-Link
Jun 20th, 2021 at 4:52am
 
Hi my first post to the forum. Trying to move to Visual Studio/Visual Micro with JTAG/SWD debugging support for Cortex M0 and ESP32 family. I previously just used Visual studio and the arduino IDE for a Pololu A-Star 32U4 project.

I posted this over at the Adafruit forum but have had no response. I have effectively bricked two of the Feather M0's because Win 7 will not load a driver for some reason described in the last post to the thread.

Two Feather M0's not being recognized by Win7
https://forums.adafruit.com/viewtopic.php?f=24&t=180404

So while I want to do JTAG debugging (as I'm used to Rowley Crossconenct for ARM), I'm also trying to salvage something from these two Feather to figure out what happened. My hope is the issues are related to Win7 virtual com port USB drives and the J-Link will avoid that all together.

I'm using a Win7 environment using Dell Precision 490 Xenon desktop platform (I also have a very similar Dell Precision M6500 laptop). The feathers have been wired according to the instruction at Adafruit for SDW. I have uploaded the latest from all as described below:

Arduino 1.8.15

Visual Micro - Release 21.06.06.0 - 6th June 2021 - VS

J-Link V7.22b Windows Installer

2017-2019, AS7 Microsoft Visual Studio Community 2019
Version 16.0.1

Arduino IDE for Visual Studio by Visual Micro   19.0
Visual Micro is an Arduino Compatible IDE for Visual Studio 2017-2019.

I confirmed operation of the Segger using Crossworks on an old application. Then I used Zadig to ovewrite the Segger USB drive to WinUSB v6.1.7600.16385.

The verbose  VS output is captured in the attached text file.
The first error is an NV lock error which waterfalls into what amount to a failure to program the device.

Error: SAMD: NVM lock error
Error: Failed to erase row containing 00000000
Error: SAMD: failed to erase sector 0 at 0x00000000
Error: failed erasing sectors 0 to 81
embedded:startup.tcl:510: Error: ** Programming Failed **

Is overwriting the SAMD boot loader going to help this?

https://learn.adafruit.com/how-to-program-samd-bootloaders?view=all#flashing-a-s


P.S I do not seem to be able to attach the compiler output text file. Will email it.

I cross-posted these results to the Adafruit forum thread.

https://forums.adafruit.com/viewtopic.php?f=24&t=180404&p=878130#p878130
Back to top
« Last Edit: Jun 20th, 2021 at 5:09am by J Moore »  

Please Register or Login to the Forum to see File Attachments
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Online



Posts: 11115
United Kingdom
Re: MSVS 2019 + Adafruit Feather M0 + J-Link
Reply #1 - Jun 20th, 2021 at 4:57am
 
Hi

Please follow the guide in the yellow box near the top of this page.

Thanks
Back to top
 

Tim Leek
home
WWW  
IP Logged
 
J Moore
Junior Member
**
Offline



Posts: 12
Re: MSVS 2019 + Adafruit Feather M0 + J-Link
Reply #2 - Jun 20th, 2021 at 5:16am
 
Tim@Visual Micro wrote on Jun 20th, 2021 at 4:57am:
Hi

Please follow the guide in the yellow box near the top of this page.

Thanks


I thought I did.  Sad What did I miss?  Cry
Back to top
 
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Online



Posts: 11115
United Kingdom
Re: MSVS 2019 + Adafruit Feather M0 + J-Link
Reply #3 - Jun 20th, 2021 at 4:41pm
 
Smiley It's only got the upload output. If you have switched on the two properties mentioned above and click build or start we will see the build properties, the compiler settings and the verbose upload.

We have the verbose upload so just a build with the settings will do.
Back to top
 

Tim Leek
home
WWW  
IP Logged
 
J Moore
Junior Member
**
Offline



Posts: 12
Re: MSVS 2019 + Adafruit Feather M0 + J-Link
Reply #4 - Jun 20th, 2021 at 7:00pm
 
Full "Build & Upload" output attached.
The program file in the standard Arduino Blink example.
Back to top
 

Please Register or Login to the Forum to see File Attachments
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Online



Posts: 11115
United Kingdom
Re: MSVS 2019 + Adafruit Feather M0 + J-Link
Reply #5 - Jun 20th, 2021 at 11:12pm
 
Thanks, what is the date, time, name of the usb driver the jlink shows up as in device manager?
Back to top
 

Tim Leek
home
WWW  
IP Logged
 
J Moore
Junior Member
**
Offline



Posts: 12
Re: MSVS 2019 + Adafruit Feather M0 + J-Link
Reply #6 - Jun 20th, 2021 at 11:46pm
 
Tim@Visual Micro wrote on Jun 20th, 2021 at 11:12pm:
Thanks, what is the date, time, name of the usb driver the jlink shows up as in device manager?


Find attached.

J Moore wrote on Jun 20th, 2021 at 4:52am:
I confirmed operation of the Segger using Crossworks on an old application. Then I used Zadig to ovewrite the Segger USB drive to WinUSB v6.1.7600.16385.


Back to top
« Last Edit: Jun 21st, 2021 at 12:08am by J Moore »  

Please Register or Login to the Forum to see File Attachments
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline



Posts: 980
Re: MSVS 2019 + Adafruit Feather M0 + J-Link
Reply #7 - Jun 22nd, 2021 at 10:53am
 
Just to check the error is the same using the JLink configuration from the core, just listed as "J-Link over OpenOCD"?

Quote:
Is overwriting the SAMD boot loader going to help this?
https://forums.adafruit.com/viewtopic.php?f=24&t=180404&p=878130#p878130


I think it will be worth working through this process, at least up to the point where the fuses and other settings are read from the board, in Microchip Studio. 
Note - You will need to re-install the J-Link Driver from the Segger software to use the JLink in Microchip Studio.  Re-flashing the bootloader may help as well but I cannot be sure.

Microchip Studio will also allow the sketch to be uploaded via the JLink, using only their software and the Segger software, which would prove the board can be uploaded to successfully still.

Also to my knowledge this chip shouldn't need any specific NVM lock changes as part of the sketch upload normally (like on Arduino Due Native USB).



Back to top
 
 
IP Logged
 
J Moore
Junior Member
**
Offline



Posts: 12
Re: MSVS 2019 + Adafruit Feather M0 + J-Link
Reply #8 - Jun 22nd, 2021 at 6:49pm
 
Simon@Visual Micro wrote on Jun 22nd, 2021 at 10:53am:
I think it will be worth working through this process, at least up to the point where the fuses and other settings are read from the board, in Microchip Studio. 



Thank you for the response. My biggest concern is the possibility I did something to electrically damage the Feather M0. If it is a serial/USB/virtual comm loader screwup I will just as happily move on without any worries.

Given this error, I suspect it is a startup code issue where the startup code somehow branched/bombed to lockout the NVM/reprogramming. This seems to be below the Arduino loader at this point.

I have moved on to the ESP32 platform with the newer ST7789 color LCD (135x240) displays. I'm at the point of moving to VS with the ESP32 so I can single step/debug but have been waiting before upsetting my current Feather M0 configuration for the present J-Link trial. I will download and configure the latest Microchip studio and try as recommended.

Based on your comments, I assume that you can not see anything wrong with what I'm doing, so I will try and do the same SWD download over J-Link on the ESP while I have it running. The HiLetgo TTGO OLED seems more stable using the Silicon Labs CP2014. It is still virtual comports but windows don't seem to keep incrementing the installed virtual comm number and it seems to reliably load.

So thanks again and I will report back after I do some further setup/evaluation.

Back to top
 
 
IP Logged
 
J Moore
Junior Member
**
Offline



Posts: 12
Re: MSVS 2019 + Adafruit Feather M0 + J-Link
Reply #9 - Jun 23rd, 2021 at 10:44am
 
So I tried to install MicroChip Studio and it seemed to hang up. After reading all the complaints about the Micro Chip transition, I repaired the 2017 Atmel Studio 7 install I already have. This seemed to work (back then) as I recall (it has been a while).

I also reinstalled the latest Segger J-LInk but I'm not sure that changed anything. It still lists the  "J-Link over OCD" and the driver is the same one as posted befoire.

.I uninstalled the J-Link driver from the windows Device Driver dialog but windows just reinstalled the same drive back.

Back to top
« Last Edit: Jun 23rd, 2021 at 10:53am by J Moore »  

Please Register or Login to the Forum to see File Attachments
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline



Posts: 980
Re: MSVS 2019 + Adafruit Feather M0 + J-Link
Reply #10 - Jun 23rd, 2021 at 11:35am
 
Thanks for the detail, and windows does cache all the drivers, so sadly it often re-installs the previous driver on detection.

To force the Segger driver back in:
1) Run the \SEGGER\JLink\USBDriver\x64\dpinst_x64.exe to ensure the drivers are available in windows
2) Device Manager > Right click the JLink Device > Update Driver > Browse My Computer for Drivers > Let Me Pick from a list of available drivers on my computer
3) Select the "JLink driver", and next, this should now show the Segger driver in device manager.

Back to top
 
 
IP Logged
 
J Moore
Junior Member
**
Offline



Posts: 12
Re: MSVS 2019 + Adafruit Feather M0 + J-Link
Reply #11 - Jun 23rd, 2021 at 10:02pm
 
Simon@Visual Micro wrote on Jun 23rd, 2021 at 11:35am:
Thanks for the detail, and windows does cache all the drivers, so sadly it often re-installs the previous driver on detection.

To force the Segger driver back in:
1) Run the \SEGGER\JLink\USBDriver\x64\dpinst_x64.exe to ensure the drivers are available in windows
2) Device Manager > Right click the JLink Device > Update Driver > Browse My Computer for Drivers > Let Me Pick from a list of available drivers on my computer
3) Select the "JLink driver", and next, this should now show the Segger driver in device manager.



Thank you very much, after several false starts I finally got a J-Link SWD download of blink  Cheesy Cheesy

After getting the correct Segger driver, I used the Armel Studion 7: tools> device programmer. screen shots attached in the following posts.

Back to top
 

Please Register or Login to the Forum to see File Attachments
 
IP Logged
 
J Moore
Junior Member
**
Offline



Posts: 12
Re: MSVS 2019 + Adafruit Feather M0 + J-Link
Reply #12 - Jun 23rd, 2021 at 10:03pm
 
Pages 3,4

Back to top
 

Please Register or Login to the Forum to see File Attachments
 
IP Logged
 
J Moore
Junior Member
**
Offline



Posts: 12
Re: MSVS 2019 + Adafruit Feather M0 + J-Link
Reply #13 - Jun 23rd, 2021 at 10:03pm
 
pages 5,6
Back to top
 

Please Register or Login to the Forum to see File Attachments
 
IP Logged
 
J Moore
Junior Member
**
Offline



Posts: 12
Re: MSVS 2019 + Adafruit Feather M0 + J-Link
Reply #14 - Jun 23rd, 2021 at 10:06pm
 
Finally, I used removed the "Erase Flash before programming" flag and hit "Program".

In the status window, you can see it worked.

Now what? Should this not work in Visual Studio with Visual Micro over the other driver?

Preliminary conclusion.

1.) There is apparently nothing physically wrong with the device.

2.) The Adafruit boot loader is hosedead because it will not respond to the USB I/F chip when Win7 is trying to load its drivers.

3.) At this point, I should probably reburn the boot loader but will wait for advice as I only have the two of them in this state.

I'm moving to ESP32 now and will be dropping the adafuit stuff so this is more for getting the J-Link to work within Visual studio to enhance bebugging.
Back to top
« Last Edit: Jun 23rd, 2021 at 10:14pm by J Moore »  

Please Register or Login to the Forum to see File Attachments
 
IP Logged
 
J Moore
Junior Member
**
Offline



Posts: 12
Re: MSVS 2019 + Adafruit Feather M0 + J-Link
Reply #15 - Jun 23rd, 2021 at 11:17pm
 
I am cross-posting between the Adafruit forum and this one. The directions for using Atmel Studio are shown below (at the adafruit website) along with my post.


I had some success today with the help of the Visual Micro forum tech support. I was able to resurrect my 2017 copy of Atmel Studio 7 running under Win7 and enable the Segger J-Link download under Atmel Studio 7: tools>device programmer. .

I did follow the direction here for setting up JTAG SWD support on the feather M0.
https://learn.adafruit.com/how-to-progr ... -m4-wiring

It turns out the directions for doing setting up Atmel Studio are located here (now I find them).
https://learn.adafruit.com/how-to-progr ... mel-studio

As I look at these detailed instructions I can only imagine I'm not the first person to Brick their Feather M0's .
Back to top
 
 
IP Logged
 
J Moore
Junior Member
**
Offline



Posts: 12
Re: MSVS 2019 + Adafruit Feather M0 + J-Link
Reply #16 - Jun 24th, 2021 at 12:45am
 
I have gone back and reprogrammed the BootLoader in Flash according to the instructions at AdaFruit using J-Link. These directions seem old but generally work.

I have also reprogrammed the Blink program using J-Link as well.

However, there seems to be something (buggy) fragile in the integration. This is a brief summary of one set of observations. This is generally what is happening because there seem to be so many paths through this maze I may not have it quite right.

For example, after burning the boot loader, the feather M0 was detected by windows and a virtual comm port (59) was loaded. Then I used the arduino IDE to download through that comm port 59 and and during the startup process another driver 62 got installed.

Arduino show both 59 and 62 but with the feather on the port 62. But then you try to run the Serial monitor and even through I have selected 62 it tries on 59 and says nothing is there.

What is crazy is now that port 59 has been installed once (after the boot loader burn), it now is persistent across restarts of the Arduino IDE even though it does not exist in windows.

This is the kind of crazy stuff that drives you away from the Arduin com port loaders.

At this point, I have tried multiple boot loader downloads and I either get a failure to load the device drives in windows and now I'm having check sum errors in the download.

I think this device is sufficiently screwed up to give up on it. I'm still interested in why the J-Link over OpenOCB (VisualMicro) is unable to talk at all to the Feather M0.

When this reaches a road block or point of diminishing, I'll configure the ESP32 for Jtag SWD and drop the Feathers.
Back to top
« Last Edit: Jun 24th, 2021 at 12:49am by J Moore »  

Please Register or Login to the Forum to see File Attachments
 
IP Logged
 
Page Index Toggle Pages: 1
Send Topic Print