Author Topic: Change RST, GO/IRQ, and CS Pins in RFM69 Library?  (Read 2008 times)

handyguy

  • NewMember
  • *
  • Posts: 27
Change RST, GO/IRQ, and CS Pins in RFM69 Library?
« on: June 04, 2020, 05:44:27 PM »
Not sure if this is the right category for this, so please redirect me if it needs to move.

I'm trying to drive a 16x32 RGB LED Panel (Adafruit) from a Moteino USB and I'm running out of pins to run everything. The panel takes a ton of pins that are hardwired in the driver library and (I'm told) extremely difficult to reconfigure because they tie to specific registers. So it appears that simply changing the pins the panel uses is out of the question. Thus I'm left to see if perhaps I can adjust the RFM69 libraries to accommodate.

At this point the only pins available on the Mote are D0, D1, D10, D11, D12, & D13, and that's before I even start to program/use the radio. Here are my questions:
  • Is it possible to remap the current pins D2-D4 to pins D11-D13 in the library to leave 2-4 open for the radio?
  • If so, what's the library/header file I need to adjust?
  • Are there any other pins I need open for the radio to work?

I've tried looking through the forum to find some answers to these questions but haven't come up with anything. Apologies if this has been discussed before and I missed it.

Thanks in advanmce for any help/advice you may be able to give.

lemonforest

  • NewMember
  • *
  • Posts: 16
  • Country: us
  • breaking all the things
Re: Change RST, GO/IRQ, and CS Pins in RFM69 Library?
« Reply #1 on: June 05, 2020, 12:50:26 AM »
I sorta feel like the blind leading the blind here but I'm thinking that if you instantiate it without specifying values, it takes these default values (doxygen magic);
Code: [Select]
RFM69 (uint8_t slaveSelectPin=RF69_SPI_CS, uint8_t interruptPin=RF69_IRQ_PIN, bool isRFM69HW=false)
In one of my sketches, I use a different slave pin and a different external interrupt so it looks like this (it is HCW);
Code: [Select]
RFM69 radio(R_SS, R_INT, true); 
instead of simply;
Code: [Select]
 RFM69 radio;
where I've defined what the radio ss and int are by the arduino pin numbering farther up.

Your MISO/MOSI pins are gonna be fixed unless your uC has more than one set or using bitbang spi. In either of the latter cases, I think you'd have to edit the value in the library itself.
Forgot this also, the library doesn't care about reset and can be any gpio that you output high/low. Somewhere else, I also define it R_RST for that and have only used it in the init, err setup in arduino. I can't convince myself to quit calling it init.

Anyway, this is what it seems like you're after and I don't think I've goofed on any of it but if I have, here's hoping someone will correct it or delete it.

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Change RST, GO/IRQ, and CS Pins in RFM69 Library?
« Reply #2 on: June 05, 2020, 09:29:41 AM »
Hi @handyguy,
What @lemonforest posted is valid.
With RFM69 on 328p based Moteinos, pins 2,10-13 are tied up by the radio. All other pins are usable including the analog pins, as digital pins. For instance pin A0=14, A1=15 etc.
But why not use a MoteinoMEGA or MoteinoMEGA-USB instead? More pins available, the sketches all work the same with the LPL RFM69 library.

handyguy

  • NewMember
  • *
  • Posts: 27
Re: Change RST, GO/IRQ, and CS Pins in RFM69 Library?
« Reply #3 on: June 05, 2020, 10:16:13 AM »
@Felix I had a few of the M-USBs lying around so I was trying to use up existing inventory before buying new. Upgrading to the Mega class is certainly an option if I can't get this to work with the existing boards.

Is  pin 2 a hard setting on the Motes? If I can just reallocate that pin/function somewhere else (e.g., pin 0 or 1) I can probably get the rest to work.

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Change RST, GO/IRQ, and CS Pins in RFM69 Library?
« Reply #4 on: June 05, 2020, 11:36:08 AM »
I understand some people may be short on a budget and need to make it work with whatever they got. Totally OK and we all do that at times, part of learning and growing our skills.
To me personally every bit of time I spend on a project matters, since I have very little time to spare in general.
So when it comes to cost in buying the right tool for the job that requires little to no attention/hacking from my part, that is the way to go, cost is secondary or tertiary. That's how I look at it. I could spend the hours trying to make a camel fit through the eye of the needle doing many other far more productive things, which are far more valuable than the added cost.
Just my 2 pennies.

handyguy

  • NewMember
  • *
  • Posts: 27
Re: Change RST, GO/IRQ, and CS Pins in RFM69 Library?
« Reply #5 on: June 05, 2020, 11:43:39 AM »
I totally agree with you, and the cost of the Motes isn't so high that it's a serious detractor. But I'm also using this as a bit of a training/learning exercise, so I don't mind spending a bit of time trying to figure this out. This isn't a "gotta have it now" project so time isn't a factor. However, if it takes much longer patience does become a factor, so I'll probably just toss it in & upgrade to a bigger Mote. :-)

Can you address the other question I had: Is  pin 2 a hard setting on the Motes? If I can just reallocate that pin/function somewhere else (e.g., pin 0 or 1) I can probably get the rest to work.

Thanks,

HG

lemonforest

  • NewMember
  • *
  • Posts: 16
  • Country: us
  • breaking all the things
Re: Change RST, GO/IRQ, and CS Pins in RFM69 Library?
« Reply #6 on: June 05, 2020, 01:13:54 PM »
So apparently I neglected to mention I'm using a breakout board and custom PCB in two different scenarios. Looks like it you're using a moteino with the radio on the landing pad, those traces already have a way home which you're not gonna change without an xacto blade and the spaghett mess of hookup wires.

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Change RST, GO/IRQ, and CS Pins in RFM69 Library?
« Reply #7 on: June 05, 2020, 02:21:29 PM »
Can you address the other question I had: Is  pin 2 a hard setting on the Motes? If I can just reallocate that pin/function somewhere else (e.g., pin 0 or 1) I can probably get the rest to work.
Sorry I missed that, @lemonforest was faster than me :-)
So yes the connection between the radio and D2, as well as D10-13, are all hardwired on the Moteino PCB. You'd have to cut traces, rewire to D3 (which on the 328P moteino is the only other hardware interrupt pin), and then change the pin in the RFM69 constructor.

handyguy

  • NewMember
  • *
  • Posts: 27
Re: Change RST, GO/IRQ, and CS Pins in RFM69 Library?
« Reply #8 on: June 05, 2020, 02:49:12 PM »
Well that pretty much seals it, then. Looks like I need to rethink the project.

Thanks for the help and advice, folks. I appreciate it!

HG

handyguy

  • NewMember
  • *
  • Posts: 27
Re: Change RST, GO/IRQ, and CS Pins in RFM69 Library?
« Reply #9 on: August 27, 2020, 04:46:30 PM »
I realized I never followed up to close out this thread. I ended up splitting up the functionality for the LED panel between two 'inos. I used an Arduino Mini to actually drive the panel and the Moteino USB to send/receive panel messages to the Mini, then programmed some I2C messaging between the two boards. This eliminated the available pin problem and actually gave me some more flexibility in how to wire up the boards.

Thanks for the discussion and the assistance.

HG