Author Topic: RFM69CW@868 MHz version for AVRs  (Read 3366 times)

RafPe

  • Newbie
  • *
  • Posts: 6
RFM69CW@868 MHz version for AVRs
« on: February 07, 2015, 05:21:12 PM »
Hello everyone!

Inspired by great library of Felix I'm trying to port this into AVR friendly (so written in C ) library. At the moment I have successfully ported the code however my modules do not seems to be communicating between each other.

Looking at interrupts I do see that packet has been sent but it never gets received on the other end. Therefore in my attempts to get this working could someone who have modules on 868 MHz running do a "register dump" ? I think that would help me a lot to find differences in code and continue to work on getting this running.

Thanks and looking forward for your help!

Rafal

TomWS

  • Hero Member
  • *****
  • Posts: 1883
Re: RFM69CW@868 MHz version for AVRs
« Reply #1 on: February 07, 2015, 08:02:14 PM »
Hello everyone!

Inspired by great library of Felix I'm trying to port this into AVR friendly (so written in C ) library. At the moment I have successfully ported the code however my modules do not seems to be communicating between each other.

Looking at interrupts I do see that packet has been sent but it never gets received on the other end. Therefore in my attempts to get this working could someone who have modules on 868 MHz running do a "register dump" ? I think that would help me a lot to find differences in code and continue to work on getting this running.

Thanks and looking forward for your help!

Rafal
Another thing that helps is to have a third Moteino running as a 'snooper' with the same network settings but with promiscuous mode on.  Have this dump to a serial port so you can see which end of your 'communication' is failing.  Easy to do and, I'm sure, Felix would be happy to send one to you  :D
This is a seriously useful tool!

Tom

RafPe

  • Newbie
  • *
  • Posts: 6
Re: RFM69CW@868 MHz version for AVRs
« Reply #2 on: February 08, 2015, 03:50:18 AM »
Hey Tom ,

At the moment I do not have monteino. I'm using custom made PCBs by me on AVR evaluation board with Atmega32. Therefore I was after config registers from someone who has it already running.

RafPe

  • Newbie
  • *
  • Posts: 6
Re: RFM69CW@868 MHz version for AVRs
« Reply #3 on: February 09, 2015, 03:55:37 PM »
So for anyone who would be crawling internet in search of more info here is some update on progress.

I have somekind of communicaiton established between 2 RFM69CW@868 MHz .

Comm gives me following :

Code: [Select]
IRQ1 : 128
IRQ2 : 0
RX mode....
IRQ1 : 217
IRQ2 : 70
Standby mode....
Reading FIFO....
FIFO len is ....: 9
FIFO says: RafRadio
Clearing FIFO
IRQ1 : 128
IRQ2 : 0
RX mode....
IRQ1 : 217
IRQ2 : 70
Standby mode....
Reading FIFO....
FIFO len is ....: 9
FIFO says: RafRadio
Clearing FIFO
IRQ1 : 128
IRQ2 : 0
RX mode....
IRQ1 : 217
IRQ2 : 70
Standby mode....
Reading FIFO....
FIFO len is ....: 9
FIFO says: RafRadio
Clearing FIFO
IRQ1 : 128
IRQ2 : 0
RX mode....
IRQ1 : 217
IRQ2 : 70
Standby mode....
Reading FIFO....
FIFO len is ....: 9
FIFO says: RafRadio
Clearing FIFO
IRQ1 : 128
IRQ2 : 0
RX mode....
IRQ1 : 217
IRQ2 : 100
Standby mode....
Reading FIFO....
FIFO len is ....: 30
▒▒5▒▒▒▒k▒▒\V'▒((?▒▒,▒▒X
Clearing FIFO
IRQ1 : 128
IRQ2 : 0
RX mode....
IRQ1 : 217
IRQ2 : 100
Standby mode....
Reading FIFO....
FIFO len is ....: 30
FIFO says: ▒▒▒▒٨▒▒_▒▒}wd▒▒=
                           ▒O▒p
/I
Clearing FIFO
IRQ1 : 128
IRQ2 : 0


So I have been sending "RafRadio" as C-String from one node to another. However I get a lot of garbage :/ My config regiisters looks following :

Code: [Select]
//	rfm69_cmd(REG_BITRATEMSB,0x34, cmd_write);
// rfm69_cmd(REG_BITRATELSB,0x10, cmd_write);

rfm69_cmd(REG_BITRATEMSB,0x0D, cmd_write);
rfm69_cmd(REG_BITRATELSB,0x05, cmd_write);


// rfm69_cmd(REG_FDEVMSB,0x02, cmd_write);
// rfm69_cmd(REG_FDEVLSB,0x41, cmd_write);

rfm69_cmd(REG_FDEVMSB,0x02, cmd_write);
rfm69_cmd(REG_FDEVLSB,0x41, cmd_write);

rfm69_cmd(REG_FRFMSB,0xD9, cmd_write);
rfm69_cmd(REG_FRFMID,0x21, cmd_write);
rfm69_cmd(REG_FRFLSB,0xC2, cmd_write);

rfm69_cmd(REG_LNA,0x88, cmd_write);
rfm69_cmd(REG_RXBW,0x52, cmd_write);
rfm69_cmd(REG_AFCBW,0x8B, cmd_write);

// 0x25
rfm69_cmd(REG_DIOMAPPING1, RF_DIOMAPPING1_DIO0_01, // RX=PayloadReady | TX=TXready
   cmd_write); // write command

// 0x26 (Robimy '&0xCF' poniewaz musimy sie pozbyc wartosci spod pozycji 4-5)
rfm69_cmd(REG_DIOMAPPING2, (rfm69_cmd(REG_DIOMAPPING2,0, cmd_read) & 0xCF)
| RF_DIOMAPPING2_DIO5_11,
  cmd_write);

rfm69_cmd(REG_RSSITHRESH,0xEC, cmd_write);
rfm69_cmd(REG_PREAMBLEMSB,0x00, cmd_write);
rfm69_cmd(REG_PREAMBLELSB,0x05, cmd_write);
rfm69_cmd(REG_SYNCCONFIG,RF_SYNC_ON | RF_SYNC_BYTE8_VALUE, cmd_write);

rfm69_cmd(REG_SYNCVALUE1,'R', cmd_write);
rfm69_cmd(REG_SYNCVALUE2,'A', cmd_write);
rfm69_cmd(REG_SYNCVALUE3,'F', cmd_write);
rfm69_cmd(REG_SYNCVALUE4,'A', cmd_write);
rfm69_cmd(REG_SYNCVALUE5,'L', cmd_write);
rfm69_cmd(REG_SYNCVALUE6,'.', cmd_write);
rfm69_cmd(REG_SYNCVALUE7,'N', cmd_write);
rfm69_cmd(REG_SYNCVALUE8,'L', cmd_write);


rfm69_cmd(REG_PACKETCONFIG1,RF_PACKET1_FORMAT_VARIABLE | RF_PACKET1_DCFREE_WHITENING | RF_PACKET1_CRC_ON | RF_PACKET1_CRCAUTOCLEAR_OFF | RF_PACKET1_ADRSFILTERING_OFF, cmd_write);
rfm69_cmd(REG_PAYLOADLENGTH,66, cmd_write);
rfm69_cmd(REG_NODEADRS,node_addr, cmd_write);
rfm69_cmd(REG_BROADCASTADRS, 254, cmd_write);

rfm69_cmd(0x58, 0x1B, cmd_write); //RegTestLna


rfm69_cmd(REG_FIFOTHRESH, 0x8F, cmd_write);
rfm69_cmd(REG_TESTDAGC, 0x30, cmd_write);
rfm69_cmd(REG_OPMODE, RF_OPMODE_STANDBY, cmd_write);


I believe my luck on further success is not fully understanding radio communications. Could someone more experienced share some thoughts what could I do to improve this packet send/receive to not get those garbage ?


Thanks!

RafPe

  • Newbie
  • *
  • Posts: 6
Re: RFM69CW@868 MHz version for AVRs
« Reply #4 on: February 22, 2015, 12:49:55 PM »
Hey again!  ;D

Good news! It has all come down to frequency deviation + bitrate + Channel filter bandwidth control.

I must say that there are a lot of combination affecting proper communication of those radios. For those on AVR : "pay attention to DS equations" :)

Thanks for those who suggested possible solutions!

ZeroGee

  • Newbie
  • *
  • Posts: 1
Re: RFM69CW@868 MHz version for AVRs
« Reply #5 on: March 06, 2015, 09:35:42 PM »
Very nice! I'm in the process of porting the library to avr-gcc and asf for use on an xmega192a3u, and I'm wondering what you actually used for the frequency deviation + bitrate + channel filter bandwidth control.

Currently I've been able to send and recieve one packet, but the ACK has failed to either send or be recieved by the sending module. :\ That and I have to wait significant times between sending packets. I'm still working the bugs out...

RafPe

  • Newbie
  • *
  • Posts: 6
Re: RFM69CW@868 MHz version for AVRs
« Reply #6 on: March 07, 2015, 05:16:05 AM »
Hey ,

Great to hear you also got working. I have not tested ACK response system yet. Can you share your init function ?

For my calculations I have used following info :

BR = 32 000 000 / (REG_BITRATE) = 32 000 000 / 0x0D05 = 32 000 000 / 33333 = 9600 b/s
W REG_FDEV :
FDEV = 32 000 000 / 2^19 * REG_FDEV = 32 000 000 / 2^19 * 0x0241 = 35 kHz

REG_RXBW accordingly to table in DS : REG_RXBW -> RxBw = 83 kHz and fc = 4% z RxBw

The following needs to applied
0,5 <= 2 * FDEV / BR <= 10
BR < 2 * RxBw
RxBw > 2 * FDEV
FDEV + BR / 2 < 500 kHz

Hope it helps

Rafal

RafPe

  • Newbie
  • *
  • Posts: 6
Re: RFM69CW@868 MHz version for AVRs
« Reply #7 on: March 08, 2015, 01:59:02 PM »
To just show you it works really well and extremely fast small screenshot