Author Topic: RMF69W RFM69HW and Arduino MEGA, ATMega2560, 2560  (Read 24891 times)

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: RMF69W and Arduino ATMega2560
« Reply #15 on: December 22, 2013, 08:22:04 PM »
Haven't played with atmega2560 but it sounds like you have to first identify the INT0 and move from there. I'd probably setup a basic sketch where you read the interrupt (attach a button) and flash the LED or something like that.

sntlewis

  • NewMember
  • *
  • Posts: 17
Re: RMF69W and Arduino ATMega2560
« Reply #16 on: December 23, 2013, 03:13:39 PM »
**** IT WORKS ****

Now for the specifics. 

1) Running vanilla Gateway/Node code except for frequency declaration.
2) one end is a Moteino (no hookup, circuit issues here)!  This end ran NODE code
3) one end is a Genuine Arduino Mega2560.  This end ran GATEWAY code.
4) circuit hookup as follows.

RFM69W pin --> Mega2560 Pin

NSS <-- D53 (SS) using voltage divider (see notes below)
SCK <-- D52 (SCK) using voltage divider
MISO --> D50 (MISO) straight thru
MOSI <-- D51 (MOSI) using voltage divider
DIO0 --> D2 (INT0) tried voltage divider, no worky

Notes on voltage divider...

I tried the 4.7K/10K divider and got nothing....
I tried the 1K/2.2K divider and got some joy.  Mega2560/Gateway doesn't get the interrupt properly..

Moved to next level of testing..

Tried level shifter from Adafruit on ALL lines  ---> MUCH joy works without issues
Moved back to voltage divider on ALL lines EXCEPT DIO0 (used level shifter here)  --> MUCH joy, works without issues....

Conclusion:  voltage divider works OK for everything except interrupt line.  Need level shifter on interrupt!

Now that I've got it working... Time to break it  8)
Stan

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: RMF69W and Arduino ATMega2560
« Reply #17 on: December 23, 2013, 03:59:52 PM »
Quote
Moved back to voltage divider on ALL lines EXCEPT DIO0 (used level shifter here)  --> MUCH joy, works without issues....

Ummm .. i think that is the correct way to wire it, I fully expect it to work like that. If the MISO line works, then the DIO-to-D2 straight through should also work.
So I think if you keep doing that then you don't even need the level shifter, just the resistors. Can you try again or confirm this is true?

sntlewis

  • NewMember
  • *
  • Posts: 17
Re: RMF69W and Arduino ATMega2560
« Reply #18 on: December 23, 2013, 09:25:22 PM »
The straight through DIO0 to D2 doesn't work, though the MISO line works.  That was the way I had it wired up in the beginning and tried again after verifying that the level shifter on DIO0 worked. 

If I use the resistors on MOSI, NSS, and SCK, straight through on MISO, and the level shifter on DIO0 then it works...  And of course level shifter on all 5 lines works as well.
Stan

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: RMF69W and Arduino ATMega2560
« Reply #19 on: December 23, 2013, 11:47:07 PM »
Oh interesting... why would MISO work and not DIO0...
Anyway at least there's a resolution. Thanks for pulling through and taking the time to document and share this ;)

sntlewis

  • NewMember
  • *
  • Posts: 17
Re: RMF69W and Arduino ATMega2560
« Reply #20 on: December 24, 2013, 04:24:23 PM »
yeah, my thoughts followed the same reasoning for MOSI and DIO0.  I would have expected both to work/fail.  Not MOSI work and DIO0 fail.

Now someone needs to create a small breakout board with necessary supporting chips (maybe even an 3v3 LDO regulator) to run the RFM69W on 5V.
Stan

NixHydra

  • NewMember
  • *
  • Posts: 41
Re: RMF69W and Arduino ATMega2560
« Reply #21 on: December 24, 2013, 08:43:20 PM »
Hi Stan,

   Curious stuff concerning the 2560 and RFM69W. I cobbled together an Arduino footprint RFM69W/HW shield recently and have tested it on an Arduino clone (Freetronics Kit Ten) , it works flawlessly. The design deliberately avoids using voltage dividers but handles 5 volt/3.3 volt logic level conversion, via a 74HC4050 hex buffer. Anyway, maybe you might find the following of some interest ... maybe not?

http://jeelabs.net/boards/6/topics/2934

   Merry Christmas!!



   

sntlewis

  • NewMember
  • *
  • Posts: 17
Re: RMF69W and Arduino ATMega2560
« Reply #22 on: December 27, 2013, 08:12:26 PM »
NixHydra, I saw that some time ago (I think I found the Moteino while looking at the Jeelabs stuff).  Still puzzled as to why I have to have the level shifter on the DIO0 line.  I noticed that yours did not have anything on the DIO0 line..

And now since the overall project prevents me from using D2 (on the Mega2560), I will look at moving the interrupt pin.  Boy this was confusing because looking at INT0 on the Mega schematic puts it on D21 but that doesn't work.  I found the attachInterrupt documentation but that confused me more.

Then I found this post http://www.gammon.com.au/forum/?id=11488&reply=8#reply8 and some others....

Then I realized that if one wants to use INT0 (vector table) then D21 is the pin BUT attachInterrupt(0, isr, RISING) is mapped to D2 on the Mega just like the UNO....

So in theory I can move the interrupt to say D19 by changing two lines in the code.....

attachInterrupt (4, RFM69::ISR0, RISING) (in .cpp) and #define RF69_IRQ_PIN  19 (in .h)

I will try this when I have some more time....

Stan
Stan

camdenl

  • NewMember
  • *
  • Posts: 13
Re: RMF69W and Arduino ATMega2560
« Reply #23 on: January 06, 2014, 04:51:34 PM »
Kind of forgot about this thread over the holidays...

Anyways just wanted to say that I had no problem changing the default interrupt on the Mega and using the rfm's, and the two lines of code you posted should work.

Also wanted to add that straight through on the MISO line worked for me but I needed a voltage divider onr the interrupt pin as well.
« Last Edit: January 06, 2014, 04:54:31 PM by camdenl »

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: RMF69W and Arduino ATMega2560
« Reply #24 on: January 06, 2014, 05:24:31 PM »
So this pretty much confirms that the MISO does not need level shifting while the interrupt needs it (ie level up to 5V).
Without digging in the datasheets or doing some scope captures for answers it's hard to guesstimate why this is happening but perhaps there's a difference in voltage when logic 1 is present on the two outputs of the RFM transceiver (ie DIO is lower logic 1 voltage than MISO). If this is true then the level-up shifting solves the problem by putting that voltage above the logic-1 threshold of 5V.

shakeycal

  • NewMember
  • *
  • Posts: 1
Re: RMF69W and Arduino ATMega2560
« Reply #25 on: January 09, 2014, 11:30:09 AM »
Hi, I've just started playing around with my moteino, and was having issues running an Uno + RFM69HW as a basestation. After reading through a few threads and trying to find a super simple + cheap way to raise the level, can confirm that incorporating the following for DIO0 --> D2 has solved the problem:

 

(Borrowed from http://electronics.stackexchange.com/questions/81580/step-up-3-3v-to-5v-for-digital-i-o)

Cal




chalupien

  • NewMember
  • *
  • Posts: 21
Re: RMF69W and Arduino ATMega2560
« Reply #26 on: March 20, 2014, 01:39:27 AM »
No. It's an input to the Arduino so no need to do that. Only the input to the transceiver should be divided.


So only one divider is needed on the MISO (input) what about Output and the Select pins?

chalupien

  • NewMember
  • *
  • Posts: 21
Re: RMF69W and Arduino ATMega2560
« Reply #27 on: March 20, 2014, 01:47:56 AM »
Reading this post

RFM69W pin --> Uno Pin

NSS <-- D13 (SS) using voltage divider
SCK <-- D12 (SCK) using voltage divider
MISO --> D10 (MISO) straight thru
MOSI <-- D11 (MOSI) using voltage divider
DIO0 --> D2 (INT0) straight thru

Does this seem to be the consensus for communicating to the RFM via the UNO's 5V pins 11,12,13?