Project

General

Profile

new RF12.cpp drop-in replacement with #define PINCHG_IRQ 1 ?

Added by edllew about 6 years ago

Hello,

This is my first post here, though I have been thoroughly enjoying reading the JeeLabs blog and other activity here for a couple months.

I have been using the RF12 component of jeelib for a few months for an energy monitoring project, similar to the OpenEnergyMonitor project. I just updated to the new RF12 code (Feb 13) and my energy monitor stopped working. If I go back to the older code (was using November 2012 vintage), then things work. Should the new version be a drop-in replacement?

I do use it with non-default settings, which might be causing the problem. I am using an AtMega328p under Arduino 1.0.1.

For my build of RF12.cpp I set two #defines different from the default:

#define PINCHG_IRQ 1 (use pin-change interrupts, default is other type)
#define RFM_IRQ 9 (use D9 for the RMF12B interrupt line, rather than D2)

I’ve attempted briefly to determine if my non-default use is the problem, but thought I’d ask here before digging farther on my own.

I am able to use the latest jeelib successfully with some other RFM12b hardware, just not this particular setup.

Thanks for any hints,
Ed


Replies (4)

RE: new RF12.cpp drop-in replacement with #define PINCHG_IRQ 1 ? - Added by JohnO about 6 years ago

Strange, my understanding was that pin change interrupts did not work correctly in the mainline jeelib. May I ask for details of the hardware you are using? There is a branch by tht in which pin change interrupts did work - but not verified since the latest changes to the mainline.

RE: new RF12.cpp drop-in replacement with #define PINCHG_IRQ 1 ? - Added by edllew about 6 years ago

I should have mentioned that I am using an ATmega328p. The comment in RF12.cpp says “pin change interrupts are currently only supported on ATmega328’s”. I am using the default pin wiring defined in RF12.cpp except I am using pin D9 (physical pin 15) connected to the RFM12B nIRQ pin.

The reason I chose this interrupt was to facilitate layout of a PCB. All 5 connections Atmega328 <==> Rfm12b can be continguous on the Atmega328. Plus it freed up the default interrupt line on the Atmega328 which was useful.

So I can in future revisions change my layout - but it would be nice to not have to keep an old version of RF12.cpp around.

I didn’t do exhaustive testing with PINCHG_IRQ set - so I may have just been lucky that it works for my particular use. That is, maybe it doesn’t really work correctly, as you suggest.

RE: new RF12.cpp drop-in replacement with #define PINCHG_IRQ 1 ? - Added by padvinder95 about 6 years ago

However, @tht’s branch that John mentioned does definitely work with pin change interrupts and is, I think, a working drop-in replacement for the main jeelib.

RE: new RF12.cpp drop-in replacement with #define PINCHG_IRQ 1 ? - Added by edllew about 6 years ago

Thanks for the input. I will report back if and how I get the latest library working.

    (1-4/4)