Add ATmega32U4 (Arduino Leonardo) support to RFM12B lib #18

merged 1 commit into from Jun 2, 2012


3 participants

glynhudson commented Jun 1, 2012

I've successfully managed to hook up an RFM12B up to an Arduino Leonardo (ATmega32U4), it was a bit of a port mapping nightmare! The hardware SPI pins and IRQ ports have moved from where they are on the ATmega328. I've added the correct port mapping into RF12.cpp.

Full details and connection diagram here:

All the best,

add ATmega32U4 support
Please enter the commit message for your changes. Lines starting

jcw added a commit that referenced this pull request Jun 2, 2012

Merge pull request #18 from glynhudson/master
Add ATmega32U4 (Arduino Leonardo) support to RF12 lib

@jcw jcw merged commit 9c4f130 into jcw:master Jun 2, 2012


jcw commented Jun 2, 2012

Fantastic achievement, Glyn! Many thanks for sharing this!


JohnOH commented on 86245b1 Oct 18, 2016

Hi Glyn, we ran into a problem yesterday with the definitions for ATMega32U4 - from June 2012 would you believe. One interpretation is that your line:

#define SPI_SS      17     // PB0, pin 8, Digital17

should read:

#define SPI_SS      10     // PB6, pin 30, Digital10

Do you still have the ATMeaga32U4 equipment to verify correct operation on your equipment?


glynhudson replied Oct 18, 2016


JohnOH replied Oct 18, 2016


jcw replied Oct 18, 2016

Could my comment on the forum be related, by any chance?

#define SPI_SS 10

This is a quirk in AVR's implementation of SPI: the pin must be defined as an output pin for SPI to be used as master - even if some other pin is actually selecting the slave. IOW, pin 10 must be set as an output, regardless what it's used for, and the actual select bit must match what's hooked up to the radio module.

There's a discussion going on there about getting the RFM radio going.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment