kevinmehall / usb

Minimalist portable USB device stack for SAMD21, LPC1800, LPC4300, Xmega
MIT License
100 stars 20 forks source link

Porting the minimal example to XMEGA 128A3U #7

Closed kuro68k closed 7 years ago

kuro68k commented 7 years ago

I'm trying to get the minimal example for XMEGA to work on a 128 A3U. So far I imported all the code into Atmel Studio 7 and set the device type to 128A3U. I also set F_CPU and F_USB.

The code compiles but the device does not enumerate. The Windows PC can't even read the VID/PID.

The hardware is proven and works fine with the ASF USB stack. It's literally just the USB port, a voltage regulator, 16MHz crystal and the micro.

I tried setting the clock to use the 16MHz crystal and PLL to generate 48MHz for USB and 24MHz for the CPU clock, but that didn't work either.

Any ideas? Thanks.

kuro68k commented 7 years ago

The A4U USB peripheral seems to be identical to the A3U one, so I can't see any issues there.

kuro68k commented 7 years ago

Confirmed solid 48MHz clock via CLKOUT.

kuro68k commented 7 years ago

usb_xmega.c:

CLK.USBCTRL = CLK_USBPSDIV_1_gc | CLK_USBSRC_PLL_gc | CLK_USBSEN_bm;

Still no joy though.

kuro68k commented 7 years ago

In the end I needed the -fno-jump-tables compiler option, after which it worked. I thought that was fixed in gcc, but I guess not.