I think your cfg file is fine. I tried various things in my environment, but same error did not reproduce.
The cause of the âNVM programming errorâ is described as follows when looking at â22.8.7. Statusâ in the SAMD21G18A datasheet.
âAn invalid command and/or a bad keyword was/were written in the NVM Command register since this bit was last cleared.â
Iâve also read an article that changing âadapter_nsrst_delayâ from 100 to 200 may work correctly. But I donât know if it works.
Iâm sorry Iâm not an OpenOCD expert, so I donât know any more.
Thank you msfujino
there are some problems with Arduino IDE working with XIAO
I will send back the chip to seeedstudio
Their engineers will test the chip and fix it
If I have any news I will remind you.
Hello,
Iâve followed the guide and flashed the official bootloader (from https://github.com/Seeed-Studio/ArduinoCore-samd/blob/master/bootloaders/XIAOM0/bootloader-XIAO_m0-v3.7.0-33-g90ff611-dirty.bin), as well as the v3.13 bootloader from adafruit. The openocd command exits without errors.
In both cases the orange LED flashes after programming the XIAO, so it seems to do something, but the computer doesnât recognize the board. I also tried to âresetâ the board as per instructions from the wiki, but the result is the same (orange LED flashing).
Has anyone else had this problem?
Hi pata,
Does âafter programming the XIAOâ mean the bootloader flash? Or a sketch upload?
Does âthe orange LED flashesâ mean that the LED slowly brightens and slowly darkens? Or ON / OFF?
Does âthe computer doesnât recognize the boardâ mean that XIAO does not appear in Device Manager?
Hello and thanks for the quick reply
- I havenât really gotten to upload a sketch. I only tried flashing the bootloader with both âprogram ⌠verifyâ (from this guide) and âflash write_image âŚâ (from How to unbrick a dead xiao using raspberry pi [ GUIDE ][openocd]).
- The orange LED doesnât turn completely off, as in a blink sketch. It brightens and darkens but itâs not as slow as when entering bootloader mode with the other XIAO I have. Actually itâs much quicker (maybe OSC malfunction?).
- The XIAO doesnât appear in Device Manager.
When you flash the bootloader with ST-LINK, do you get the following message?
** Programming Started **
** Programming Finished **
** Verify Started **
** Verified OK **
Could you show me your screenshot?
Yes, apparently the programming is ok.
EDIT (since max replies reached):
I tried to âunbrickâ the XIAO because none of my machines would recognize it anymore (as in not seen by Device Manager or lsusb).
Itâs hard to say what sketch was uploaded before because Iâve been trying to unbrick it for a while now. But I believe that sketch shouldnât be there anymore since I used command âat91samd chip-eraseâ a couple of times before (after that the orange LED is off).
Why did you have to flush the bootloader in the first place?
Does the last uploaded sketch have code to make the orange LED bright / dark?
Worked like charm!!!
Thank you so much. I recovered a Xiao (stoped working after a few days transmitting LoRaWan to ThethingsNetwork on battery- brown out??). But most of all it was pure joy when I saw the Xiao port again.
Thank you!
Hi, Pedotech
Iâm glad I could help you.
You may also find the following link useful.
I canât say for sure because our PC environment are different, but it sounds like there is a problem with the USB driver.
I suggest you look into the USB driver âZadigâ.
Thank you it worked!
Hi PANOK,
I think the situation is exactly the same as post #32. It sounds like there is a problem with the USB driver. I suggest you look into the USB driver âZadigâ.
@msfujino Would you be able to give me a quick hand?
Iâm getting the error:
I ended up soldering the cables directly to the pads and using a multimeter I ensured there is connection between the ST-link V2 and the microcontroller. I also swapped SWDIO with SWCLK just in case I got it wrong the first time around but still no luck.
Iâm 100% sure the wiring is correct, I checked it a bunch of times and also rewired it from scratch a few times.
I was looking around and found this article (Programming RP2040 with ST-LINK - Electrical Engineering Stack Exchange) that explains how the ST-LINK V2 canât connect to the Seeed XIAO RP2040. Someone said to do the update however I have no idea what that guide is talking about. I updated it to the latest version (V2.J37.S7) using the âSTM32 ST-linkâ software.
Did you have to do some weird update or did it just work?
Am I missing something?
Any Idea on how I can fix it?
Thank you,
Andrea
Hi Andrea_Nizzola,
If you have an unbricked XIAO_SAMD21, the method in the link below is very easy.
âHow to unbrick a dead XIAO using a XIAO(DAPLink) and OpenOCDâ
Hi Andrea_Nizzola,
I have made a RescueTool for ST-Link.
Unzip the file to a suitabule location and rewrite xxxxxxxx to yours in two places in âflash.batâ.
Double-click âflash.batâ to write the bootloader.
XIAO_BootloaderRescueTool_STLink.zip (10.5 KB)
Andrea_Nizzola,
@msfujino Would you be able to give me a quick hand?
Since you seemed to be in a hurry to resolve the issue, I posted two solutions.
What were the results?