MKR 1010 - led red ON when connecting USB

Hi, I have MKR 1010 for my project; however, suddenly, the LED red ON when connecting the USB of my computer and also miss contact to the port.
Can you help me?
Thanks!
Wilson

The tricky thing about the boards with native USB functionality like your board is that 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, it no longer presents a port.

That 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 and you will get a port back and be able to upload.

Fortunately, there is an easy way to recover from this situation:

  1. Press and release the reset button on your board quickly twice. You should now see the LED on the board pulsing, which means the bootloader is running. The double press causes the bootloader to run indefinitely (until the board is reset, powered off, or an upload is done), which means you don't need to get the timing of the reset just right.
  2. Select the port of your board from the Tools > Port menu. The port number may be different when the bootloader is running so don't assume you already have the correct port selected.
  3. Start an upload in the Arduino IDE.

The upload should now finish successfully. After this, you should be able to go back to doing normal uploads without needing to press the reset button. If you still need to do the reset trick to do uploads after this, the problem may be caused by your code. You can verify this by uploading a simple sketch like File > Examples > 01.Basics > BareMinimum.

Unfortunately doesn't work. This problem continues equally.
Follow the message that shows in IDE.

Arduino: 1.8.13 (Windows 10), Card: "Arduino MKR WiFi 1010"

The sketch uses 12000 bytes (4%) of storage space for programs. The maximum is 262144 bytes.

Global variables use 2204 bytes (6%) of dynamic memory, leaving 30564 bytes for local variables. The maximum is 32768 bytes.

Could not find a card in the selected port. Make sure you have selected the correct port. If so, try pressing the reset button on the board after starting the charge.

This report would have more information with
"Show verbose output during compilation"
option can be activated in "File -> Preferences"

Do you see the LED next to pin 13 start pulsing after you do the double reset?

Hi,
So, we're talking about MKR 1010. However, I don't see LED next to pin 13. Turn out that when I connect this device in USB, I see two LED on, LED green (power) and LED red(Battery Lipo); when I connect to the battery Lipo, just the LED green light.

Sorry, I meant the LED next to the 5V pin:
abx00023_front_1_2

First of all, thank you very much for your dedication to that. When I do RESET, this LED doesn't turn on.
Wilson

If you don't get the pulsing LED after a double reset, this means one of two things:

  • There has been serious physical damage to the board such that the ATSAMD21G18 primary microcontroller is not running at all.
  • The bootloader on the ATSAMD21G18 primary microcontroller has been erased or corrupted. The most common way this happens is if you accidentally have the Nano 33 BLE selected from the Arduino IDE's Tools > Port menu when you upload to the MKR WiFi 1010.

In the first case, it's unlikely that the board can be repaired and your best way forward is to just get another board.

In the second case, the board can be recovered by burning the bootloader. I'll provide instructions in case you want to give that a try:


Note: alternative methods are described at the end of the post.

Using an Arduino board as the programmer

You'll need

  • An extra Arduino board that runs at 3.3 V to use as the programmer.
    • Note: certain Arduino boards can't be used with the sketch that converts it to a programmer.
      • Working: SAMD architecture boards (e.g., MKR boards, Nano 33 IoT, Zero).
      • Untested: AVR architecture boards (e.g., Uno), but the sketch does compile for them.
      • Not working: Nano 33 BLE
    • It is possible to use an Arduino board that runs at 5 V as the programmer, but you'll need to use level shifting circuitry on the programming lines to avoid exposing the target board to 5 V logic levels, which would damage it.
  • An SD slot. This could be built into your Arduino board (e.g., MKR Zero), a shield (e.g., MKR SD Proto Shield), or one of the common SD modules.
  • An SD card that fits your SD slot.
  • A way to connect the SD card to your computer.
  • A way to make the connections to the SWD pins on your target Arduino board. For the Nano 33 IoT and the MKR Boards other than MKR1000, I like to use a 0.1" pitch 2x3 POGO adapter. You could also solder wires to the test points if you prefer. On the MKR boards other than the MKR1000, the SWD header is on the bottom of the board and is the footprint for a 0.1" pitch 2x3 SMD header (e.g., [url=https://www.digikey.com/short/z3dvdv]https://www.digikey.com/short/z3dvdv[/url]). On the MKR1000, it is a 0.05" pitch 2x5 male header on the top of the board, which you will need an adapter and cable for.

Instructions

  1. Connect an SD card to your computer.

  2. Open this link in your browser: https://github.com/arduino/ArduinoCore-samd/tree/master/bootloaders

  3. Click the folder that matches the name of your target board.

  4. Click the file that ends in .bin

  5. Click the Download button.

  6. Rename the downloaded file to fw.bin

  7. Move fw.bin to the SD card.

  8. Eject the SD card from your computer.

  9. Plug the USB cable of the Arduino board you will be using as a programmer into your computer.

  10. Select Sketch > Include Library > Manage Libraries... from the Arduino IDE's menus.

  11. Wait for the download to finish.

  12. In the "Filter your search..." field, type "Adafruit DAP library".

  13. Press Enter.

  14. Click on "Adafruit DAP library by Adafruit".

  15. Click the Install button.

  16. Wait for the installation to finish.

  17. Click the Close button.

  18. Select File > Examples > Adafruit DAP library > flash_from_SD from the Arduino IDE's menus.

  19. Change this line:

    #define SD_CS 4
    

    according to the Arduino pin connected to the SD CS pin. If your board has a built-in SD slot (e.g., MKR Zero), then you can change this line:

    if (!SD.begin(SD_CS)) {
    

    to:

    if (!SD.begin()) {
    
  20. Select the correct board from the Tools > Board from the Arduino IDE's menus.

  21. Select the correct port from the Tools > Port from the Arduino IDE's menus.

  22. Select Sketch > Upload from the Arduino IDE's menus.

  23. Wait for the upload to finish successfully.

  24. Unplug the programmer Arduino board from your computer.

  25. Plug the SD card into the SD slot connected to your Arduino board.

  26. Connect the programmer Arduino board to the target Arduino board as follows:

    Programmer Target
    VCC +3V3
    10 SWDIO
    9 SWCLK
    GND GND
    11 RESETN

    SWD pads on MKR boards other than MKR 1000):
    MKR SWD
    MKR1000 SWD header pinout:
    MKR1000 SWD
    Nano 33 IoT SWD pads:
    Nano 33 IoT SWD

  27. Plug the USB cable of the programmer Arduino board into your computer.

  28. Select Tools > Serial Monitor from the Arduino IDE's menus. You should now see the Serial Monitor output showing the target board detected, and the bootloader file flashed to it successfully.

  29. Unplug the programmer Arduino board from your computer.

  30. Disconnect the programmer Arduino board from the target Arduino board.


Alternatives

These are some alternatives to the "Adafruit DAP" method I described above.

Using a CMSIS-DAP debug probe as the programmer

If you have a CMSIS-DAP compliant debug probe, you can just do this instead:

  1. Connect the debug probe to your Arduino board.
  2. Select Tools > Programmer > Atmel EDBG from the Arduino IDE's menus.
  3. Select Tools > Burn Bootloader from the Arduino IDE's menus. - The "Burn Bootloader" process should now finish successfully.

I use this little open source debugger.


Using a J-Link as the programmer

Segger J-Link debug probes (e.g., J-Link EDU Mini) can be used with the Adalink software:
https://github.com/adafruit/Adafruit_Adalink

This is a fairly complex procedure, so I recommend against this option unless you already own a J-Link and don't have the supplies on hand for one of the other options.

1 Like

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.