Hello. I finished making revision 1.1 of my ATSAMD21G18A based flight computer and I'm having some problems with USB. When I upload the SAMD21 Dev Board bootloader to the device using Atmel studio and a knock-off J-Link, I get this error when connecting the device through the USB port in USBView.exe:
[Port4] FailedEnumeration: Unknown USB Device (Port Reset Failed)
Is Port User Connectable: yes
Is Port Debug Capable: no
Companion Port Number: 0
Companion Hub Symbolic Link Name:
Protocols Supported:
USB 1.1: yes
USB 2.0: yes
USB 3.0: no
==>Device Information<===‒‒‒
ConnectionStatus: FailedEnumeration
Current Config Value: 0x00 -> Device Bus Speed: Low 0x00
Device Address:0x00
Open Pipes:0
**ERROR: No open pipes!
===> Device Descriptor<===
* ! *ERROR: bLength of 0 incorrect, should be 18
bLength: 0x00
bDescriptorType: 0x00
bcdUSB: 0x0000
bDeviceClass: 0x00
* ! *ERROR: Device enumeration failure
I then try uploading the arduino-zero bootloader and the usb does nothing. When I connect it to my device there is no connection sound and nothing shows up in USBView.exe.
The USB port is connected through PA30 and PA31 and there is a 32.768K crystal connected to XIN32 and XOUT32 through 15pF caps. Is there any registers, fuses, and/or compiler flags that I need to configure before I plug in usb? I've never seen this USB behavior before.
Did you by any chance download your version of the Arduino IDE (version 1) through the Microsoft app store?
It's just that the SAMD21 makefile references the standard Arduino IDE install directory pathways and not the Microsoft app install. Unfortunately, the Microsoft app install stores SAMD21 Arduino core files in a completely different directory structure.
Hey @MartinL. Thanks for the reply. I’ve downloaded version 2.x of the Arduino IDE when I was prompted to do to from the 1.x IDE that I installed through the installer on the Arduino website. I downloaded the ArduinoCore-samd github repo and made the bootloader using the makefile in bootloaders/zero. I uploaded this using atmel studio 7. For whatever reason if I select Arduino zero in the Arduino IDE and select my J-link debugger and press “burn bootloader” I get an error saying that it doesn’t detect any CMIS-DAP device on the port. Are the preconfigured bootloader files in the Arduino/boards directory?
It's possible to use Atmel Studio to burn the binary bootloader file to flash memory directly using the Tools->Device Programming dialog box. It's also possible to change the fuse settings from here as well, which can be really handy.
I've used a Segger EDU J-Link Mini before with Atmel Studio without any issues, so it should be possible use your J-link programmer as well.
@MartinL
I've just got home and tried the bootloader in the
Arduino15/packages/arduino/hardware/samd/1.8.13/bootloaders/zero
directory and I'm getting the same issue. I noticed that when I connect the device with the Arduino bootloader on there(either from the GitHub repo or the Arduino one) the device does nothing initially but then after I hold the reset button for ~2 seconds the device exhibits the exact same behavior as the sparkfun bootloader would have.
here's the schematic: Forza R1.pdf (35.9 KB)
Proscessor wiring-wise, schematic is almost identical to the Sparkfun SAMD21 Mini breakout board schematic found here
The only difference is the usb ID pin being connected to a SN74AHC1G125 line driver (SN74AHC1G125 data sheet, product information and support | TI.com)
I think this is to enable usb power as the output of the line driver is connected to the gate pin of a mosfet. That's just my best guess though. The circuit board has 2 pyro channels for setting of a powder charge for the parachutes as well as some sensors to detect position and an sd card for datalogging.
When I connect the microcontroller to the device programming dialog in Atmel studio it comes back with a device id of 0x10010305 and the "Target Voltage" box comes back as 3V. I edited the blink sketch to use PIN_PA12 so I could hook a multimeter up to the breakout connections. I then hit verify in the IDE and found the .hex file in the Temp directory. There were two relevant files named Blink.hex and Blink_with_bootloader.hex. Neither of these worked. I think it might be a clock configuration problem in the bootloader and the 15pF capacitors are higher than the 6.8pF capacitors in the actual Arduino zero that the bootloader was programmed for.