Tero's Arduino Blog

Using Arduino with Ada

Arduino Leonardo and (bad) USB interrupt

This is little heads-up for people, in case someone else also hits the same problem.

When playing with Arduino Leonardo, I noticed that if I enable interrupts, the code seems to freeze.

After some debugging and Google search, I found out that USB is turned on by the boot loader, but AVR-Ada does not install interrupt handler for USB.

So, when Leonardo has USB cable connected, it is getting USB interrupts all the time, but because there is no interrupt handler, the board continuous resets.

Easy solution was to turn off USB via PRR1 register:

AVR.MCU.PRR1_Bits(7) := True;

Copyright © 2012, 2013 Tero Koskinen - Theme Skeleton; Blogging engine Pelican; Powered by Python