Arduino IDE USB upload deletes driver on Mac / SAMD21 Pro RF / MacOSX Ventura 13.4 / CH34x driver

After posting this thread a year ago, viewtopic.php?f=117&t=57315&p=234819&hi … 21#p234819 , when I thought I had resolved my problems on my Mac, I was unable subsequently to upload code to either SAMD21 from either OSX Catalina or Raspberry Pi Linux, so I stopped working on that project.

I recently replaced that Mac with a new one (M2, Apple Silicon) with Ventura (13.4) installed, and I would really like to get back to working with the SAMD21. So I removed all traces (all that I could find) of Arduino on the new Mac, following removal instructions, and installed Arduino IDE 2.1.0.

I tried to compile & upload blink via USB to one of my SAMD’s, and it failed – there was no usbmodem port visible to the Arduino IDE.

I installed the CH341SER_MAC driver (v 1.5), rebooted, and tried again. There was one usbmodem port, which I selected with the SAMD21 board, and it compiled the code and uploaded successfully … then broke the connection and lost the usbmodem port. I rebooted the Mac and the driver reappeared as both a /dev/cu* device (seen by Arduino IDE) and as one of the USB devices listed by the Mac System Report. Uploaded again and it again broke the connection and deleted the driver.

I did a little more searching and found that there’s a newer driver (CH34xVCPDriver, v 1.8) that is supposed to work on Apple Silicon. Tried to install it, and the driver doesn’t even show up under /Library/Extensions, much less in the System Report.

Attempts to delete all the CH34* drivers to start again from scratch seem to be successful, but when I reboot, System Report shows that the Sparkfun SAMD21 is attached to a USB port … until I try to upload to usbmodem port again, after which it disappears again.

So I appear to have a phantom installation of something that blocks installation of the newer CH34x driver, and sorta works but disappears. The upload of the compiled code seems to complete, then the USB connection is dropped and the SAMD goes dark except for the red LED. But when powercycled, the new, just-downloaded code starts running. So uploads work, but then something kills the connection and deletes the driver.

If I plug an Arduino Uno into the same USB port to my Mac, the IDE sees it on port /dev/cu.usbmodem314401, so this problem seems to be with the SAMD21 USB interface.

Yes, I did the Command-R reboot during the driver install, went into Security Utility and enabled installation of Apple Developer extensions as a part of the first installation, and Privacy/Security settings shows that those extensions are enabled.

If you have successfully uploaded from OSX Ventura to a SAM21, could you tell me what you’re using for a driver and where I might find it?

And if you’re familiar with the details of the SAMD21 USB interface, could you tell me what driver I should be looking for? CH34x? I’ve seen FTDI mentioned in this context, too, but I’m not sure if that’s relevant. I’m not even sure if that’s a meaningful question, since I don’t (yet) understand the USB-serial uploading process.

Any suggestions for things to explore would be welcome. I’d really like to get back to working on the SAMD21.

Addendum:

Removed the CH341 install and rebooted; the usbmodem device reappeared. Compiled and uploaded sparfun’s blink.

Here’s the output from the compile and upload. After the upload, the port usbmodem port disappeared from the IDE, the SAMD21 is no longer listed as attached in the Mac System Report, and the SAMD21 sits there with the red light on. And this time, the upload apparently didn’t succeed since after a power cycle, the SAMD is not flashing the LED’s in sequence.

Sketch uses 10192 bytes (3%) 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 10448 bytes to flash (164 pages)

[===========                   ] 39% (64/164 pages)
[=======================       ] 78% (128/164 pages)
[==============================] 100% (164/164 pages)
done in 0.068 seconds

Verify 10448 bytes of flash with checksum.
Verify successful
done in 0.009 seconds
CPU reset.

That board usually doesn’t require drivers for Mac/Linux…I’m guessing the issues being seen are related to the bootloader modes; see https://learn.sparkfun.com/tutorials/sa … leshooting, or start over entirely by following the whole guide https://learn.sparkfun.com/tutorials/sp … -guide/all

There isn’t a CH341 on your SAMD21 board. Why are you installing this driver?

That was the question. I didn’t know if there was a CH341, or anything else, that needed a special driver.

It appears that the CH341 driver didn’t install, but I removed the app entirely last night before continuing to try different approaches to uploading.

Russell,

I’ve continued to tinker with all “foreign” drivers removed, but I get the same result pretty consistently:

  • - Fresh reboot of the Mac: it sees "SFE SAMD21" on a USB port
  • - Arduino IDE sees "usbmodemxxxx" as an available port
  • - Compile succeeds, upload starts and completes verification, then disconnects
  • - Mac System Report no longer sees SAMD21 on a USB port, and Arduino IDE no longer sees "usbmodemxxxx" port
  • - *Most times*, power cycling the SAMD shows that the code *did upload* (I upload a sequence of programs with different LED flashing patterns, so I watch the pattern on the next SAMD reboot). *Sometimes* upon SAMD reboot the blue LED is pulsing slowly in bootloader mode; haven't yet discerned variations in my procedure that could cause the variation in behavior.
  • - Attempts to force the SAMD into bootloader mode with quick double-pressing of reset fail
  • - All operations with an Arduino Uno (the real thing, not a clone) succeed as expected: the Mac System Report sees the Uno; the Arduino IDE sees the "usbmodemxxxx" port; repeated uploads function just fine with no rebooting or Uno power cycling needed.
  • It’s been almost two years since I could compile code for the SAMD, but I vaguely recall that there were two ports reported by the Arduino IDE when the SAMD was connected. I now see only one, when the Mac is first rebooted, and that one works fine, repeatedly, with the Uno but disappears after uploading to the SAMD.

    I’m suspecting that the Mac sees a device on the USB port and loads the driver – it’s own driver – to connect to it. But the SAMD21 requires a duplex driver (bootloader port and sketch port), and attempts by the IDE to switch from bootloader to sketch operation crashes the driver.

    That is just an uninformed guess based on the behavior I’ve seen. Does that seems possible? If that’s the case, then it’s up to Apple to fix it … or I need a third-party driver (which probably doesn’t exist) for whatever the SAMD uses for USB serial duplexing.

    Has anyone gotten SAMD21 to accept uploads from Arduino IDE on a Mac OSX 13.x (Ventura)?

    I should add that I’d be OK moving back to the Raspberry Pi, but the version available from the Pi library won’t install the Sparkfun SAMD board definition (something like “no bossac driver available for your operating system”). That “distributed” version is 1.8.6 (I think). A year ago, I tried downloading the source and installing a 2.x version, but I got a similar issue (I couldn’t find a bossac that was compatible).

    I’ll likely give that another try: perhaps, a year later, that package is more complete and the Pi OS is more aligned with standard Debian releases.

    I uninstalled and reinstalled Arduino IDE 2.1.0 and followed the Sparkfun guide to reinstall the Arduino and Sparkfun SAMD boards.

    Same behavior: reboot the Mac and the IDE sees the SAMD; compile and upload and the uploader does a CPU reset upon completion and verification; SAMD shows constant red LED; powercycling the SAMD this time didn’t instantiate the uploaded blink program. But upon a reboot of the Mac, the blink program I had uploaded was activated on the SAMD.

    Trying the Raspberry Pi (Buster), the Pi library version failed as noted above; downloaded and compiled from source the 1.8.20 version and it loaded the Arduino SAMD boards but not the Sparkfun SAMD boards (1.8.3: “tool arm-none-eabi-gcc is not available for your OS”; 1.8.1 and others: " tool bossac is not available for your OS". I downloaded the source for 2.1.0 and tried to compile it, too, but it has dependencies that have dependencies that aren’t available on this OS. I chased down that rabbit hole a year ago and won’t bother again.

    Again, has anyone gotten OSX 13.4 / Arduino IDE to upload to a Sparkfun SAMD21 reliably?