Author Topic: RFM69CW node with Attiny84  (Read 5050 times)

nerofirestarter

  • NewMember
  • *
  • Posts: 6
  • Country: de
RFM69CW node with Attiny84
« on: September 05, 2016, 01:48:03 PM »
Hi all,

I try to build up a node to measure the electric consumption of my flat and want to send the data wireless to my jeelink adapter.
something like this:
http://www.hobbyheizer.de/index.php/haussteuerung/stromzaehler

I have chosen the Attiny84 because I wanted to start with something small and simple, maybe this was a bit optimistic.

I have build up an Arduino Nano to be used as ISP programmer for the ATTINY84.

I have also connected a Serial connection to the ATTINY84 (RX and TX) and a LED for debugging,
both is working fine.

I can flash the ATTINY with the RF12DEMO.12 Sketch (slighly changed, see Attachment for details).
I am using the IDE 1.6.10 on a windows machine with the ATTinyCore from Spece Konde Version 1.1.1, PinMapping CounterClockwise(like AttinyCore).
I have "burned the bootloader" with the 8MHz (internal) setting.


The IDE reports this during upload to the ATTINY
Quote
avrdude: Version 6.3, compiled on Jun 22 2016 at 16:05:21
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\...\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino2/etc/avrdude.conf"

         Using Port                    : COM3
         Using Programmer              : stk500v1
         Overriding Baud Rate          : 19200
         AVR Part                      : ATtiny84
         Chip Erase delay              : 4500 us
         PAGEL                         : P00
         BS2                           : P00
         RESET disposition             : possible i/o
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65     6     4    0 no        512    4      0  4000  4500 0xff 0xff
           flash         65     6    32    0 yes      8192   64    128  4500  4500 0xff 0xff
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00

         Programmer Type : STK500
         Description     : Atmel STK500 Version 1.x firmware
         Hardware Version: 2
         Firmware Version: 1.18
         Topcard         : Unknown
         Vtarget         : 0.0 V
         Varef           : 0.0 V
         Oscillator      : Off
         SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x1e930c (probably t84)
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "C:\Users\
avrdude: writing flash (6924 bytes):

Writing | ################################################## | 100% 9.79s

avrdude: 6924 bytes of flash written
avrdude: verifying flash memory against C:\Users\...\AppData\Local\Temp\buildcf8a00e937f42983805471fd39c96602.tmp/RF12demo_sven2.ino.hex:
avrdude: load data flash data from input file C:\Users\...\AppData\Local\Temp\buildcf8a00e937f42983805471fd39c96602.tmp/RF12demo_sven2.ino.hex:
avrdude: input file C:\Users\...\AppData\Local\Temp\buildcf8a00e937f42983805471fd39c96602.tmp/RF12demo_sven2.ino.hex contains 6924 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 4.72s

avrdude: verifying ...
avrdude: 6924 bytes of flash verified

avrdude done.  Thank you.


It seems to me that workes fine.
Now to test the connection on the wireless side, I have another arduino nano with an RFM69 connected and the "standard Demo sketch" (including #define RF69_COMPAT 1).

The serial prompt from the Nano looks like this:
[RF12demo.12] A i1 g212 @ 868 MHz x2

The serial prompt from the Attiny84 looks like this:
[RF12demo.12] Tiny B i2 g212 @ 868 MHz x2

I am able to send a message from the nano to the Tiny, but I get no answer:
> 0t
test 04 -> 66 b

On the Tiny I see that the message has been received and an ACK has been send:
OKX 210405060708090A0B0C0D0E0F101112131415161718191A1 B1C1D1E1F202122232425262728292A2B2C2D2E2F30313233 3435363738393A3B3C3D3E3F404142434445 (35)
ASC <A . . . . . . . . . . . . . . . . . . . . . . . . . . . .   ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E
 -> ack


I have the feeling that something with the clock or some Interrupts are not correct.
I am quite new to this topic and I don't know were the problem is or were to start...

Thank you in Advance!

TomWS

  • Hero Member
  • *****
  • Posts: 1930
Re: RFM69CW node with Attiny84
« Reply #1 on: September 05, 2016, 04:27:28 PM »
I suspect that you are running out of RAM.  A normal ATMega328P build would issue warnings if there was less than 512bytes of memory LEFT and you have only this much to start with on a ATTiny84.

Tom

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: RFM69CW node with Attiny84
« Reply #2 on: September 05, 2016, 08:49:48 PM »
You will run out of memory very quickly on the attiny family.
Many folks have tried and most probably gave up on trying this.
Attiny are great at doing simple things where memory is not a worry.
May I also suggest at least an atmega328 which is a good compromise.

nerofirestarter

  • NewMember
  • *
  • Posts: 6
  • Country: de
Re: RFM69CW node with Attiny84
« Reply #3 on: September 06, 2016, 03:37:31 AM »
Hi TomWS,
Hi Felix,

thanks for the hint.
To be honest, I was not even thinking of such a problem.
I guess strange thinks happen when running out of RAM?

It is a pitty that I have build up my breadboard. It took a while to come to this point...
Next time I try an atmega :)

Don't get me wrong,
I got so many little things solved so I would like to see it run in the end :)
Maybe I am still too optimistic?


I have recompiled the sketch to check the IDE messaged after compiling:
"
Der Sketch verwendet 6.924 Bytes (84%) des Programmspeicherplatzes. Das Maximum sind 8.192 Bytes.
Globale Variablen verwenden 296 Bytes (57%) des dynamischen Speichers, 216 Bytes für lokale Variablen verbleiben. Das Maximum sind 512 Bytes.
"
Sorry, I missed to copy this to my initial post.
I do not know if 216 Bytes is enough so I tried something else and copied a Sketch from the TinxTX and modified the code a bit assuming that it is alsready running on a Attiny84 (see Attachment) and tested (,indeed with RFM12B connected).

IDE message:
"
Der Sketch verwendet 3.734 Bytes (45%) des Programmspeicherplatzes. Das Maximum sind 8.192 Bytes.
Globale Variablen verwenden 177 Bytes (34%) des dynamischen Speichers, 335 Bytes für lokale Variablen verbleiben. Das Maximum sind 512 Bytes.
"

I see the LED blinking and I am still not able to receive something with the Nano RF12demo.12
Does any one know how much RAM is required from the JeeLib in RF_COMPAT mode?

Thanks for your help,
Sven

emjay

  • Full Member
  • ***
  • Posts: 119
  • Country: nl
Re: RFM69CW node with Attiny84
« Reply #4 on: September 06, 2016, 01:52:21 PM »
@nerofirestarter,

I suggest you pose these questions on the JeeLabs Forum.  The configuration you describe is similar to the JeeNode Micro which does work with the RFM69CW provided you are very careful with keeping the code size small.

nerofirestarter

  • NewMember
  • *
  • Posts: 6
  • Country: de
Re: RFM69CW node with Attiny84
« Reply #5 on: September 06, 2016, 03:08:49 PM »
Hi emjay,

thanks for the answer.
I will try.

Sven

nerofirestarter

  • NewMember
  • *
  • Posts: 6
  • Country: de
Re: RFM69CW node with Attiny84
« Reply #6 on: September 08, 2016, 04:36:19 AM »
Hi all,

I have found a solution to test my hardware and see if it works in principle (replacement of RF12demo).
If anyone is interested I got the code from here:

Tiny Node:
https://github.com/flabbergast/RFM69/tree/attiny
Arduino Gateway:
https://github.com/flabbergast/RFM69/tree/master


I changed the code a bit. Not perfect, but working with the used core including status LED and Serial.

I guess this is not compatible with my jeelink adapter due to RFM12B (, encryption if used), data rate, crc and
RAM limitations on the Tiny.
Maybe there is also a solution ?

For now I am happy to see it run :)
Let's see if it can be improved,
Sven

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: RFM69CW node with Attiny84
« Reply #7 on: September 08, 2016, 08:30:53 AM »
Looks like an old old fork... good luck  :'(

nerofirestarter

  • NewMember
  • *
  • Posts: 6
  • Country: de
Re: RFM69CW node with Attiny84
« Reply #8 on: September 20, 2016, 07:01:15 AM »
Hi Felix,

sorry for the late response, I was not available.
I have tested the node and the gateway and they work fine (as far as I could test).

Do you have any suggestion for a more up-to-date fork?

Sven

KISA

  • NewMember
  • *
  • Posts: 8
Re: RFM69CW node with Attiny84
« Reply #9 on: June 07, 2018, 07:08:24 PM »
Hi Sven (I hope you get this),
I'm trying to send you a question via your website (http://www.hobbyheizer.de/), but I can't get the security code to send the message will not appear, so I can't send it. Can you please check it?
But failing that, here is my question:-

I am trying to successfully run an RFM69 from an ATTiny84, but am not having much luck :(. I saw on this post (https://jeelabs.net/boards/7/topics/7192) you may have had some success.
If you did have success, could you please share with me a circuit diagram of how you connected the ATTiny84 to the RFM69 and the code you used on the ATTiny84?

nerofirestarter

  • NewMember
  • *
  • Posts: 6
  • Country: de
Re: RFM69CW node with Attiny84
« Reply #10 on: June 11, 2018, 06:21:07 AM »
Hi KISA,

long time ago I tried to do this.
Unfortunately I have not finished my project yet, but I got it working so far...

I used "hobbyheizer" only for information, you will not find me there.

As far as I remember I have used the following Pins (no garantee):
ATTINY84 / RFM69CW
PIN3 / NSS-SEL
PIN9 / SCK
PIN8 / SDI
PIN7 / SDO
PIN5 / IRQ-DIO0
My documentation is poor, I know...
As far as I remember the RFM69CW was sensitive on the voltage level (3.3V)...

I used the Core of Spence Konde as descirbed in the post of:
http://highlowtech.org/?p=1695

-use 8MHz (internal)
-count Counterclockwise

For the code to run, check:
https://jeelabs.net/projects/cafe/wiki
and download the required package.
I would suggest to start with "RadioBlip2" which comes with the package,
but don't forget to set:
#define RF69_COMPAT 1     // use RFM69 instead of RFM12

good luck,
Sven