Author Topic: FROM RFM12B to RFM69W 868Mhz  (Read 9725 times)

arrinkiiii

  • Newbie
  • *
  • Posts: 18
FROM RFM12B to RFM69W 868Mhz
« on: January 05, 2014, 07:48:31 PM »
Hi from Portugal  :D  Im a noobie-noobie (more is impossible) on Moteino/Arduino and special in code. I suck big time! But I start a project with 2 Moteino with RF69W at 868Mhz.

The project (from Adi Soffer) have the code for the RF12 I try to change but i got a error in the Arduino IDE. If some one could help me i would be very thankful.

This is the code:
http://pastebin.com/UzudqQnY

The error:
radio.Initialize(NODEID, RF69_868MHZ, NETWORKID);

'class RFM69' has no member named 'Initialize' If i delet this line everything compile good.

Thanks in advance for the help =))
Cheers
Tiago
« Last Edit: January 06, 2014, 01:31:12 PM by arrinkiiii »

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6018
  • Country: us
    • LowPowerLab
Re: FROM RFM12B to RFM69W 868Mhz
« Reply #1 on: January 05, 2014, 08:02:23 PM »
Hi from a huge winter storm in Michigan USA!

So you're converting a sketch from RFM12B to RFM69. There are a few essential differences.
Notice the two declarations for the initialize functions, names are different (C is CASE SENSITIVE), and arguments are in different order:

Code: https://github.com/LowPowerLab/RFM12B/blob/master/RFM12B.h [Select]
void Initialize(uint8_t nodeid, uint8_t freqBand, uint8_t groupid=0xAA, uint8_t txPower=0, uint8_t airKbps=0x08, uint8_t lowVoltageThreshold=RF12_2v75);


Code: https://github.com/LowPowerLab/RFM69/blob/master/RFM69.h [Select]
bool initialize(byte freqBand, byte ID, byte networkID=1);

arrinkiiii

  • Newbie
  • *
  • Posts: 18
Re: FROM RFM12B to RFM69W 868Mhz
« Reply #2 on: January 05, 2014, 08:28:47 PM »
Im sorry for the storm, good time to stay at home drinking a good tea and thinking in good new stuff from LowPowerLab  ;D

Thanks for the fast reply. I really don't understand nothing about code. Im trying, believe me. I have made some changes and then stay stuck in that error line. With your help i have change the I to an i in the  initialize word. But after that it just stuck with other error:

Receiver.ino: In function 'void setup()':
Receiver:98: error: 'class AccelStepper' has no member named 'setMinPulseWidth'
Receiver.ino: In function 'void loop()':
Receiver:110: error: 'class RFM69' has no member named 'ReceiveComplete'
Receiver:117: error: 'class RFM69' has no member named 'GetDataLen'
Receiver:119: error: 'class RFM69' has no member named 'Data'
Receiver.ino: In function 'int Transmit(int)':
Receiver:278: error: 'class RFM69' has no member named 'Wakeup'
Receiver:279: error: 'class RFM69' has no member named 'Send'
Receiver:280: error: 'class RFM69' has no member named 'Sleep'

Wish to know better =(( and not having to do this kind of questions. But i think with time i can progress better. 

Thanks you so much for the help.
« Last Edit: January 05, 2014, 08:42:56 PM by arrinkiiii »

arrinkiiii

  • Newbie
  • *
  • Posts: 18
Re: FROM RFM12B to RFM69W 868Mhz
« Reply #3 on: January 06, 2014, 08:47:32 AM »

Should i change from,

void setup
to
bool setup

???


Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6018
  • Country: us
    • LowPowerLab
Re: FROM RFM12B to RFM69W 868Mhz
« Reply #4 on: January 06, 2014, 08:51:06 AM »
Ok, I don't know what setMinPulseWidth is and what header file you need for that.
For all the RFM69 errors you will need to change the function names from the RFM12B old names to the RFM69 names similar to the initialize function (that was an easy change). Some functions work differently in the RFM69 lib, for instance ReceiveComplete is receiveDone in RFM69. The Data is DATA, Wakeup and Sleep are wakeup/sleep, and Send is either send or better alternative sendWithRetry(...). Please look at the header files for the actual names and parameter order, and also look at the examples in the RFM69 library where all the working code is already in place. I would probably start with a working example and add your custom code rather than migrate from RFM12B. But here are the header files and examples for RFM69:

https://github.com/LowPowerLab/RFM69/blob/master/RFM69.h
https://github.com/LowPowerLab/RFM69/tree/master/Examples

arrinkiiii

  • Newbie
  • *
  • Posts: 18
Re: FROM RFM12B to RFM69W 868Mhz
« Reply #5 on: January 06, 2014, 09:32:58 AM »
Thank you Felix, you are great  :D

The setMinPulseWidth is because the library AccelStepper was wrong, now that part is ok, because i reinstall it the librery again. It's so good wend you find the error =))  Thanks you for the links and explanation. I will ready and test more. Im in the midle of the code with the changes for the RF69

      if (radio.ReceiveComplete())

Receiver.ino: In function 'void loop()':
Receiver:110: error: 'class RFM69' has no member named 'ReceiveComplete'
Receiver:117: error: 'class RFM69' has no member named 'GetDataLen'
Receiver:119: error: 'class RFM69' has no member named 'Data'
Receiver.ino: In function 'int Transmit(int)':
Receiver:278: error: 'class RFM69' has no member named 'Wakeup'
Receiver:279: error: 'class RFM69' has no member named 'Send'
Receiver:280: error: 'class RFM69' has no member named 'Sleep'

Need to read your tips and see what is wrong. For the first time that i touch in code... =))

arrinkiiii

  • Newbie
  • *
  • Posts: 18
Re: FROM RFM12B to RFM69W 868Mhz
« Reply #6 on: January 06, 2014, 10:23:06 AM »

All most there =))

I Just got more 2 errors

for (byte i = 0; i < radio.GetDataLen(); i++)

Receiver.ino: In function 'void loop()':
Receiver:117: error: 'class RFM69' has no member named 'GetDataLen'

I saw in RF69.h  that is writing static volatile byte DATALEN; and i have change to GetDATALAN but still give's me the error.


I have change from W to w  and still give's me this error
Receiver.ino: In function 'int Transmit(int)':
Receiver:278: error: 'class RFM69' has no member named 'wakeup'

arrinkiiii

  • Newbie
  • *
  • Posts: 18
Re: FROM RFM12B to RFM69W 868Mhz
« Reply #7 on: January 06, 2014, 11:57:30 AM »
YEAHHHH  i think i solve more one =)))

In the RFM12 code are:

for (byte i = 0; i < radio.GetDataLen(); i++)

and i change to

for (byte i = 0; i < radio.DATALEN; i++)

 I change the function and take the brackets. Are this correct?

Wake or wake are not from RFM69. For what i should change?


« Last Edit: January 06, 2014, 12:04:15 PM by arrinkiiii »

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6018
  • Country: us
    • LowPowerLab
Re: FROM RFM12B to RFM69W 868Mhz
« Reply #8 on: January 06, 2014, 12:11:20 PM »
the DATALEN is correct, you got it.
I was wrong about wake. There is no wakeup in RFM69, only a sleep() function. When you want to wake the radio, you don't have to do anything, just use send() or sendWithRetry() directly and the radio will wake up. So I think if you remove that you're all done.

arrinkiiii

  • Newbie
  • *
  • Posts: 18
Re: FROM RFM12B to RFM69W 868Mhz
« Reply #9 on: January 06, 2014, 01:30:14 PM »
YEAHHHHHH  I SOLVE ONE by my self   ;D    coff, coff... THANK YOU FELIX

While im writing this im trying the code and i remove the line:  radio.wakeup ();

and now fail to compile =(( 

C:\Users\SKAT VILLE\Documents\Arduino\libraries\RFM69\RFM69.cpp: In member function 'bool RFM69::initialize(byte, byte, byte)':
C:\Users\SKAT VILLE\Documents\Arduino\libraries\RFM69\RFM69.cpp:65: error: 'SPI' was not declared in this scope
C:\Users\SKAT VILLE\Documents\Arduino\libraries\RFM69\RFM69.cpp:65: error: 'SPI_MODE0' was not declared in this scope
C:\Users\SKAT VILLE\Documents\Arduino\libraries\RFM69\RFM69.cpp:67: error: 'SPI_CLOCK_DIV2' was not declared in this scope
C:\Users\SKAT VILLE\Documents\Arduino\libraries\RFM69\RFM69.cpp: In member function 'void RFM69::sendFrame(byte, const void*, byte, bool, bool)':
C:\Users\SKAT VILLE\Documents\Arduino\libraries\RFM69\RFM69.cpp:212: error: 'SPI' was not declared in this scope
C:\Users\SKAT VILLE\Documents\Arduino\libraries\RFM69\RFM69.cpp: In member function 'virtual void RFM69::interruptHandler()':
C:\Users\SKAT VILLE\Documents\Arduino\libraries\RFM69\RFM69.cpp:242: error: 'SPI' was not declared in this scope
C:\Users\SKAT VILLE\Documents\Arduino\libraries\RFM69\RFM69.cpp: In member function 'void RFM69::encrypt(const char*)':
C:\Users\SKAT VILLE\Documents\Arduino\libraries\RFM69\RFM69.cpp:309: error: 'SPI' was not declared in this scope
C:\Users\SKAT VILLE\Documents\Arduino\libraries\RFM69\RFM69.cpp: In member function 'byte RFM69::readReg(byte)':
C:\Users\SKAT VILLE\Documents\Arduino\libraries\RFM69\RFM69.cpp:333: error: 'SPI' was not declared in this scope
C:\Users\SKAT VILLE\Documents\Arduino\libraries\RFM69\RFM69.cpp: In member function 'void RFM69::writeReg(byte, byte)':
C:\Users\SKAT VILLE\Documents\Arduino\libraries\RFM69\RFM69.cpp:342: error: 'SPI' was not declared in this scope
C:\Users\SKAT VILLE\Documents\Arduino\libraries\RFM69\RFM69.cpp: In member function 'void RFM69::readAllRegs()':
C:\Users\SKAT VILLE\Documents\Arduino\libraries\RFM69\RFM69.cpp:393: error: 'SPI' was not declared in this scope 


Again, back to the examples and try to see whats wrong.  Uhmmm maybe i need <SPI.h>  library  =))

Edit:

...and this is what i like the feeling,  DONE !!! Just need to include the <SPI.h> library. Thanks Felix  8)

Now i go to the sender/transmitter try to solve de code. Did i say solve de code?? lol  ;D   i wish =DD 
« Last Edit: January 06, 2014, 01:44:15 PM by arrinkiiii »

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6018
  • Country: us
    • LowPowerLab
Re: FROM RFM12B to RFM69W 868Mhz
« Reply #10 on: January 06, 2014, 01:39:37 PM »
Try adding this to the top of your sketch:

Code: [Select]
#include <SPI.h>

LazyGlen

  • Newbie
  • *
  • Posts: 48
Re: FROM RFM12B to RFM69W 868Mhz
« Reply #11 on: January 06, 2014, 01:41:21 PM »
When you removed that line did you accidentally delete anything else?

I don't see a
Code: [Select]
#include <SPIFlash.h>
statement in your pastebin code. It looks like you have removed most of the stuff related to SPI from your code, but from the error messages it looks like some of the RFM69 code may need the SPI file.

LG

arrinkiiii

  • Newbie
  • *
  • Posts: 18
Re: FROM RFM12B to RFM69W 868Mhz
« Reply #12 on: January 06, 2014, 01:56:19 PM »
 Thank you guys. I have edit the post above... Need the line/library  #include<spi.h> and then everything as compile. Im learning so much but i need to learn more or start to learn C++   i come from Pascal and is so old, old, old that i don't remember nothing... but at that time i was the best at my class  ;D   

Regarding the line wakeup that i take out im afraid that something don't work good after. I got the Moteinos but still waiting for the stepper motor and the easydriver. Get this time for see and change the code.

I start now with the sender/transmitter and almost all the problems solve. Now it show up that 'class RFM69' has no member named 'CRCPass'   can i change this for a working name?

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6018
  • Country: us
    • LowPowerLab
Re: FROM RFM12B to RFM69W 868Mhz
« Reply #13 on: January 06, 2014, 05:29:31 PM »
RFM69 lib does not have a CRCPass function. Look at the examples how a packet is received. Basically the CRCPass step is completely eliminated - because it makes no sense to check whether a packet has passes CRC or not - (ie if it doesn't it's garbage and you never want to hear about it). The RFM69 transceiver has a mechanism by which it automatically filters out the bad CRC packets and only notifies you when good packets arrive, which is awesome, less code to mess with.

arrinkiiii

  • Newbie
  • *
  • Posts: 18
Re: FROM RFM12B to RFM69W 868Mhz
« Reply #14 on: January 06, 2014, 06:04:26 PM »

Thanks again Felix, very appreciated. I have remove if (radio.CRCPass()) and everything compile good. I can see that RFM69 is more simple. From my last post i have digging in the internet looking for CRCPass + RFM69 and didn't find anything that help me... and for that i should see that RFM69 didn't use ( i didn't see also in RFM69.h) CRCPass and i should take it off from the code... but have afraid that something didn't work good.

Hope other people can use this post for achieve the transition from RFM12 to RFM69. With the trill that i have doing this i don't want to stop... it's a good rush/feeling =)) Need to learn more and so i have a few questions if Felix or other beloved fellows  what/know to hawser.

1- Can i attach to Moteino one screen in particular this one? http://www.ebay.de/itm/1-8-Serial-128X160-SPI-TFT-LCD-Module-Display-PCB-Adapter-with-SD-Socket-/380809480973?pt=Bauteile&hash=item58aa038b0d

2-What Library's do i need to operate this screen? What i want to try is instead of having led's showing what im doing it's show on screen. Like the name of what im doing.

3- What is the best language to learn programming/code the Moteino? C++ ?

Thanks again for the help, this is a new world for me and for my friends, now they all want to try this thing... Moteino! Let's go   :D