Try again: SAMD21 disconnecting from MacOSX after upload

I’ve posted about this issue before and had no responses, but I’ll try again with more information after fresh installs. [ viewtopic.php?f=117&t=59727&p=241894&hi … sx#p241875 ]

I’m able to compile code for the SAMD21 Pro RF on the Arduino IDE running on MacOSX, but after it uploads, the connection disappears. Has anyone else seen this problem? Has anyone found a solution.

Details:

Configuration

  • - SAMD21 Pro RF; VID: 0x1B4F; PID: 0x214F
  • - Freshly-installed MacOS Ventura on Intel Macbook Air; verified that no non-Apple USB-serial drivers are installed
  • - Arduino IDE 2.2.1
  • - Arudino SAMD 32-bit M0+ Board version 1.8.13
  • - Sparkfun SAMD Board version 1.8.3
  • Behavior:

    The behavior is much like I described in my earlier postings, but this time I started with a clean environment and tracked the details.

  • - Plug USB cable from SAMD into the Mac and /dev/cu.usbmodem14101 appears in /dev (but note that only one such serial port comes up)
  • - Start the Arduino IDE and it sees the SAMD on the appropriate port
  • - Compiles with no errors and uploads code to the SAMD and performs CPU reset
  • - IDE reports "port monitor error: command 'open' failed: no such file or directory. Could not connect to /dev/cu.usbmodem14101 serial port"
  • - SAMD red LED goes solid and stays lit
  • - ls -la /dev/cu.* shows that the USB-serial device has disappeared on the Mac
  • - Disconnect the USB cable from the Mac and reconnect; ls shows that cu.usbmodem14101 has reappeared; and the SAMD __*begins executing the uploaded code*__
  • - Compile and upload a different program (with a different pattern for LED flashing) and get the same result: IDE compiles and uploads the code (with error message at end); port disappears; unplugging and replugging the USB cable results in the SAMD executing the new code
  • - Compiling and uploading the Sparkfun example code ADKTerminalTest results in the same disconnect behavior, but on replugging the USB cable, the IDE monitor shows the "ADK demo start" message from the uploaded SAMD program, but then immediately disconnects from the port (and kills the /dev/cu.usbmodem14101 device).
  • - Power cycling the SAMD with the on-board switch does NOT restore the USB-serial device on the Mac: only replugging the USB cable does that.
  • From all this, I conclude that:

  • - The USB cable is not the problem (uploads work, and communication from SAMD to Mac work)
  • - The IDE is functioning correctly (as best it can tell): it compiles and uploads functional SAMD code
  • - The SAMD is functioning correctly: it executes a variety of codes, including LED manipulation and serial communication
  • It’s been over two years (and several MacOS changes) since I was able to smoothly compile and upload programs to the SAMD, but I think I recall that there were actually two USB-serial devices associated with the SAMD when it was working: one used for upload and one used for monitor. If I remember that correctly, I do not see that any more.

    This seems to be a problem with the Sparkfun SAMD board/communications interface that somehow kills the MacOS USB-serial device. But it may simply be a configuration issue that I can resolve .

    Does anyone have a SAMD uploading smoothly from the Arduino IDE running on MacOSX?

    Here’s the log from a compilation/upload of ADKTerminalTest from the IDE to SAMD:

    Sketch uses 15936 bytes (6%) of program storage space. Maximum is 262144 bytes.
    Atmel SMART device 0x10010005 found
    Device       : ATSAMD21G18A
    Chip ID      : 10010005
    Version      : v2.0 [Arduino:XYZ] Sep 24 2018 14:26:24
    Address      : 8192
    Pages        : 3968
    Page Size    : 64 bytes
    Total Size   : 248KB
    Planes       : 1
    Lock Regions : 16
    Locked       : none
    Security     : false
    Boot Flash   : true
    BOD          : true
    BOR          : true
    Arduino      : FAST_CHIP_ERASE
    Arduino      : FAST_MULTI_PAGE_WRITE
    Arduino      : CAN_CHECKSUM_MEMORY_BUFFER
    Erase flash
    done in 0.858 seconds
    
    Write 16200 bytes to flash (254 pages)
    
    [=======                       ] 25% (64/254 pages)
    [===============               ] 50% (128/254 pages)
    [======================        ] 75% (192/254 pages)
    [==============================] 100% (254/254 pages)
    done in 0.150 seconds
    
    Verify 16200 bytes of flash with checksum.
    Verify successful
    done in 0.020 seconds
    CPU reset.
    

    Apparently I killed the SAMD21 that I was testing with. It did upload code (and then disconnect) until I uploaded the ADKTerminalTest code. That code ran correctly (printing to the Mac serial monitor) but then disconnected from the USB-serial port (and something killed that driver on the Mac). After a couple of successful reconnects (in which the SAMD did print to the Mac IDE monitor), it stopped working altogether.

    I thought the continuing problem was that whenever I replugged the USB connection to the SAMD, the SAMD printed and disconnected faster than I could download code or even see the USB-serial driver on the Mac. But I stopped getting the ADKTerminalTest banner message, and trying to force into bootloader didn’t work, so I decided to try some of my other computers.

    I tried running the 2.2.1 IDE on an M2 Mac Mini Ventura (no luck), Intel Macbook Air Ventura (no luck), Intel Macbook Big Sur (no luck), and Raspberry Pi Bullseye (can’t even find a combination of IDE’s and drivers that will compile SAMD code).

    Finally, just to confirm, I tried my OTHER SAMD21. Code compiles and uploads on the Intel Macbook Airs (Big Sur and Ventura) but NOT the M2 Mac Mini Ventura (no compatible bossac error message).

    It seems improbable, but it looks like my first SAMD21 was killed after I loaded the ADKTerminalTest code. Attempting to force it into bootloader mode hasn’t worked.

    I (foolishly) uploaded the ADKTerminalTest to the still-working SAMD21, and it printed its banner string to the monitor AND THEN KILLED THE CONNECTION AND MacOS cu.usbmodemxxxxx DEVICE! Fortunately, hitting the reset button twice DID put it back into bootloader mode and I was able to upload Blink again.

    So at this point, it looks like I really did kill one SAMD21 with the tests, but I am able to compile and upload successfully from the Intel-based Macs, using IDE 2.2.1, to the remaining SAMD21.

    I’ll explore a bit more the suggestion to check using ATmel RESET pins on the SAMD that seems to be dead, but if anyone has other suggestions on how to reset the SAMD21, I’m willing to give them a try.

    Bringing this thread (these threads!) to closure.

    After struggling with this for MANY days over the past 2-3 years, it turns out that the problem was a failed/failing SAMD21 Pro RF. I’m sure I tried my other SAMD at times over that period, but perhaps with a bad USB cable or some other variation.

    But when I tried my other SAMD21 Pro RF yesterday, using Arduino IDE 2.2.1, Arduino SAMD board 1.8.13, and Sparfun SAMD board 1.8.3, it compiled and uploaded various codes repeatedly and correctly on Intel-based MacOS Big Sur and Ventana AND on Mac Mini M2 Ventura. I haven’t been able to find a combination of IDE and drivers that works on Raspberry Pi Bullseye yet, but my other platforms work.

    Thanks for the feedback I did get, but this turns out to have been a semi-failing SAMD21 device all along. Sigh.