[Solved] Compiling own RFM2Pi_v2 firmware

Hi all.

I'm trying to compile and load my own RFM2Pi_v2 firmware.

I'm following the wiki and I can successfully load RF12_Demo_atmega328.cpp.hex.

However, when I try to recompile it (I did add the lines in boards.txt and select the right target), I don't get a bit-exact copy of it.

The .hex I generate can be loaded, but I don't receive any value.

I can identify a difference in the logs.

Working version, RF12_Demo_atmega328.cpp.hex:

2014-03-01 12:06:23,841 INFO Setting RFM2Pi | frequency: 4
2014-03-01 12:06:24,845 INFO Setting RFM2Pi | sgroup: 210
2014-03-01 12:06:25,848 INFO Setting RFM2Pi | baseid: 15
2014-03-01 12:06:26,878 INFO Serial RX: > 4b
2014-03-01 12:06:27,082 INFO Serial RX: ^A
2014-03-01 12:06:27,085 WARNING Misformed RX frame: ['\x01']
2014-03-01 12:06:27,290 INFO Serial RX: > 210g
2014-03-01 12:06:27,494 INFO Serial RX: ^A
2014-03-01 12:06:27,496 WARNING Misformed RX frame: ['\x01']
2014-03-01 12:06:27,701 INFO Serial RX: > 15i
2014-03-01 12:06:27,923 INFO Serial RX: ^A
2014-03-01 12:06:27,925 WARNING Misformed RX frame: ['\x01']

The version I compiled:

2014-03-01 11:54:03,909 INFO Setting RFM2Pi | frequency: 4
2014-03-01 11:54:04,912 INFO Setting RFM2Pi | sgroup: 210
2014-03-01 11:54:05,916 INFO Setting RFM2Pi | baseid: 15
2014-03-01 11:54:06,960 INFO Serial RX: > 4b
2014-03-01 11:54:07,169 INFO Serial RX:  A i1 g210 @ 433 MHz o0
2014-03-01 11:54:07,179 WARNING Misformed RX frame: ['A', 'i1', 'g210', '@', '433', 'MHz', 'o0']
2014-03-01 11:54:07,387 INFO Serial RX: > 210g
2014-03-01 11:54:07,596 INFO Serial RX:  A i1 g210 @ 433 MHz o0
2014-03-01 11:54:07,600 WARNING Misformed RX frame: ['A', 'i1', 'g210', '@', '433', 'MHz', 'o0']
2014-03-01 11:54:07,806 INFO Serial RX: > 15i
2014-03-01 11:54:08,033 INFO Serial RX:  O i15 g210 @ 433 MHz o0
2014-03-01 11:54:08,036 WARNING Misformed RX frame: ['O', 'i15', 'g210', '@', '433', 'MHz', 'o0']

(Yes, I should add cases in the gateway code to handle these frames correctly instead of generating those warnings...)

At least this shows my .hex is correctly generated. I mean it can run. Looks more like a code issue. Except, of course, I didn't modify the code in this first test. I'm trying to have it working before doing my modifications.

In fact, I'm wondering about those A i1 g210 @ 433 MHz o0 lines.

  • They don't appear in the working version.
  • I find lines in the code that would generate that, but then, does this mean the compiled version on GitHub does not correspond to the code ?
  • I don't understand how the code generates this exact string: I don't see the "Lock" string printed.

OK, now I understand the A and O: In ASCII, @+1 = A, @+15 = O.

Serial.print('@' + id,DEC);

But I still don't get the "Lock" issue.

Could there be something wrong happening while "Lock : 0" gets printed ?

Any hint appreciated.

Thanks.

Jérôme's picture

Re: [Solved] Compiling own RFM2Pi_v2 firmware

Bump. Did anyone succeed in recompiling this firmware ?

Bra1n's picture

Re: [Solved] Compiling own RFM2Pi_v2 firmware

I just tried recompiling the RF12_Demo_atmega328.ino and got a hex file very different to the one provided but I've not tried testing it to see if it works. I just used an online Diff Checker http://www.diffchecker.com/ and pasted the file contents in.

Having said that my own modified and compiled version seems to work fine when tested (as you are already aware).

Bra1n's picture

Re: [Solved] Compiling own RFM2Pi_v2 firmware

I just did another Diff Check between my modified version of the firmware as generated by me and the one now online generated by Glynn Hudson and again I'm seeing loads of differences so I'm guessing he's using a different compiler and/or libraries and thus generating a different source. It may be both versions of the hex work equally well, I've yet to test that.

Maybe the file differences are a Red Herring and some other issue is causing the data to differ as after all the code is running apparently ok.

Jérôme's picture

Re: [Solved] Compiling own RFM2Pi_v2 firmware

Related thread: https://github.com/mharizanov/RFM2Pi/pull/9

I tried to compile again today. I realize I forgot to mention something that might be relevant.

When I compile, I get the following error:

RF12_Demo_atmega328.ino:72:18: error: variable ‘helpText1’ must be const in order to be put into read-only section by means of ‘__attribute__((progmem))’

This is an easy fix.

- char helpText1[] PROGMEM =
+ const char helpText1[] PROGMEM =

But if you don't have this error, I guess you must be using another compiler, or other compiling options...

My arduino version is 2:1.0.5+dfsg2-3. Which version are you using ?

By the way, I use master latest version of the Jeelink lib.

Thank you for your support.

glyn.hudson's picture

Re: [Solved] Compiling own RFM2Pi_v2 firmware

I had to use the 'old' per rfm69 jeelib, it's a tagged download. Info here http://openenergymonitor.org/emon/node/3850.

also compiled using modified opti boot bootloader for 8mhz oscillator http://wiki.openenergymonitor.org/index.php?title=RFM12Pi_V2#Modified_OptiBoot_Bootloader

Jérôme's picture

Re: [Solved] Compiling own RFM2Pi_v2 firmware

I forgot to come back here and mark as solved.

Using v11 of jeelib solved my issues.

I'm not sure I understand every bit of it, but at least I'm not stuck anymore. Thanks for the support.

(I didn't say it specifically but since I followed the wiki, I did use the modified bootloader.)

Jérôme's picture

Re: [Solved] Compiling own RFM2Pi_v2 firmware

I took a bit of time to try the lowest possible bitrate, and I now I'm receiving the data !

Trystan and I have been running a few tests with his emonTXv3 and a RF USB stick. The low range could be due partly to bad soldering of the antenna on the TX, but mostly to the step-up. He said that Glyn may have had the same kind of issues when designing the emonTH.

I'd like to take some time to modify the RFM2Pi firmware to allow for dynamic bitrate change. Then try intermediate bitrates.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.