abcminiuser / lufa

LUFA - the Lightweight USB Framework for AVRs.
http://www.lufa-lib.org
1.03k stars 321 forks source link

Add support for RC calibration in AVRISP-MKII #142

Closed jacobseptember closed 5 years ago

jacobseptember commented 5 years ago

This change adds a function in the ISPProtocol.c file that handles the CMD_OSCCAL command as specified in AVR053. The programming tool toggles MOSI at a rate of 32.768 kHz and listens on MISO for a "calibration successful" signal, which takes the form of eight toggles by the device. Criticism very much welcome.

I'm not certain if this function is best placed in ISPProtocol or ISPTarget—it can be moved as needed.

There are some #defines at the beginning of the function. It didn't seem like the header files had that sort of definition in them, but they could move there if desired. On a related note, ports/pins are set to match the AT90USB162 used in Olimex's AVRISP-MK2. I didn't see generic SPI definitions elsewhere in the project so I just used the ports/pins themselves.

Also my tabs don't always line up nicely on Github's viewer... they look okay in my editor.

jacobseptember commented 5 years ago

All your requested changes should be implemented now!

abcminiuser commented 5 years ago

Thanks!