Author Topic: RFM69 library - changing the Slave Select Pin  (Read 5419 times)

labusr

  • NewMember
  • *
  • Posts: 34
RFM69 library - changing the Slave Select Pin
« on: May 22, 2014, 12:26:08 AM »
I'm trying to use an Ethernet Shield along with the RFM69HW.  In order to do so, I first tried testing if I can change the slave select pin (default pin 10) to pin 9 instead.  I edited the RFM69.h file like this, making sure to save:

Quote
#define SPI_CS               9

But when I compiled and uploaded the sketch, and moved the NSS pin from 10 to 9, the RFM69 never initializes.  I don't get the "Listening at 915MHz" message.

If I put the SS back into the SPI_CS definition and moved NSS back to pin 10, it's fine again and I can receive messages.




NixHydra

  • NewMember
  • *
  • Posts: 41
Re: RFM69 library - changing the Slave Select Pin
« Reply #1 on: May 22, 2014, 02:43:45 AM »
Hi labusr,

   Doesn't the Moteino use digital pin 9 to drive the LED?

                                  cheers,


Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: RFM69 library - changing the Slave Select Pin
« Reply #2 on: May 22, 2014, 08:39:49 AM »
Yes, D9 is for the LED. And D8 is for the FLASH if you have it. I would use another pin. Please see the pinout diagrams at moteino.com

labusr

  • NewMember
  • *
  • Posts: 34
Re: RFM69 library - changing the Slave Select Pin
« Reply #3 on: May 22, 2014, 10:13:12 AM »
Yes, D9 is for the LED. And D8 is for the FLASH if you have it. I would use another pin. Please see the pinout diagrams at moteino.com

I'm using an Arduino Uno with an ethernet shield on it, which is the reason I need to change the default Slave Select pin for the RFM69HW on the SPI bus.  So I'm not using the Moteino sketch.

But the way I'm going about it, simply replacing SS on the header file with "9", doesn't seem to be working, and I'm doing this as a test without the ethernet shield on the Uno - it's just the Arduino and the RFM69HW, with the NSS pin on 9.

I see other people on this forum have done it before, but it's not clear what they changed.

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: RFM69 library - changing the Slave Select Pin
« Reply #4 on: May 22, 2014, 03:03:49 PM »
Oh, well if the RFM is soldered on the board, the CS trace is hardwired to D10, so you'd have to cut that and rewire it to something else, while also changing it in the firmware.

labusr

  • NewMember
  • *
  • Posts: 34
Re: RFM69 library - changing the Slave Select Pin
« Reply #5 on: May 22, 2014, 10:18:02 PM »
Oh, well if the RFM is soldered on the board, the CS trace is hardwired to D10, so you'd have to cut that and rewire it to something else, while also changing it in the firmware.

I'm afraid I wasn't being clear.  I'm just using a regular Arduino, and I can put the NSS wire from the RFM69HW anywhere.  When I compile the default RFM69 library with the NSS pin on 10, it works.  When I compile the library with the modified header file such that SPI_CS is defined at pin 9, and I move the NSS wire to 9, the RFM69HW stops working.

So I don't think I have the right method of modifying the code to change the SS pin...is it really as simple as changing the "SS" in the header file to "9"?

NixHydra

  • NewMember
  • *
  • Posts: 41
Re: RFM69 library - changing the Slave Select Pin
« Reply #6 on: May 23, 2014, 04:34:21 AM »
Hi labusr,

   Couldn't you just include the line

   radio.setCS(9);

    in your code?

                               cheers,
« Last Edit: May 23, 2014, 04:54:43 AM by NixHydra »

labusr

  • NewMember
  • *
  • Posts: 34
Re: RFM69 library - changing the Slave Select Pin
« Reply #7 on: May 23, 2014, 03:41:12 PM »
NixHydra,
Thanks for the suggestion.  I tried it, but it didn't work - the initialization of the module didn't work.

I tried putting it before and after radio.initialize(FREQUENCY,NODEID,NETWORKID);

Is there another place it's suppose to go?

Hi labusr,

   Couldn't you just include the line

   radio.setCS(9);

    in your code?

                               cheers,