Author Topic: Send and Receive  (Read 1256 times)

sheeda1

  • NewMember
  • *
  • Posts: 2
  • Country: us
Send and Receive
« on: January 23, 2017, 07:09:32 PM »
Hi, I am new with RFM69HCW

I am using it for a project. I need to send data from adrafruit ultimate GPS breakout board using RFM69 and receive it on another receiver. I need to write the code for the receiver too. I have been looking at the library and datasheet to figure out the send and receive function. I found the packet structure but I couldn't find where it was defined in the library. Can someone please point me towards the file. Also I will greatly appreciate any advice in this matter. Thank you

ChemE

  • Sr. Member
  • ****
  • Posts: 419
  • Country: us
Re: Send and Receive
« Reply #1 on: January 23, 2017, 09:53:49 PM »
The following code is mine rather than from the library but it shows you the packet structure used.

Code: [Select]
SPI_XFER(REG_FIFO | 0x80);   // write to FIFO using SPI burst mode
SPI_XFER(bufferSize + 3);    // LEN byte - total length of packet in bytes
SPI_XFER(toAddress);         // 1st byte - who the packet is for
SPI_XFER(NODEID);            // 2nd byte - who the packet is from
SPI_XFER(requestACK ? RFM69_CTL_REQACK : 0x00);              // 3rd byte - control byte (ACK, NAK, etc)
for (uint8_t i = 0; i < bufferSize; i++) SPI_XFER(((uint8_t*) buffer)[i]);  // Write 6 more bytes to the FIFO - the data

As long as your receiver and sender agree on the structure of the packet you can use whatever you want though.  Felix's code which does the same is here starting on line 289: https://github.com/LowPowerLab/RFM69/blob/master/RFM69.cpp
« Last Edit: January 23, 2017, 09:55:52 PM by ChemE »

sheeda1

  • NewMember
  • *
  • Posts: 2
  • Country: us
Re: Send and Receive
« Reply #2 on: January 24, 2017, 07:50:23 PM »
Thank you for fast response, I really appreciate it. I was looking more in terms of where the preamble, Syn and CRC were implemented. I will need that information to program the receiver. I need to send 76 bits in terms of data. I am also thinking about using GMSK as the modulation scheme but all I saw in the data sheet was information on FSK and OOK. Can you please tell me where these are located.

ChemE

  • Sr. Member
  • ****
  • Posts: 419
  • Country: us
Re: Send and Receive
« Reply #3 on: January 24, 2017, 08:32:29 PM »
Thank you for fast response, I really appreciate it. I was looking more in terms of where the preamble, Syn and CRC were implemented. I will need that information to program the receiver. I need to send 76 bits in terms of data. I am also thinking about using GMSK as the modulation scheme but all I saw in the data sheet was information on FSK and OOK. Can you please tell me where these are located.

https://github.com/LowPowerLab/RFM69/blob/master/RFM69.cpp#L72
Lines 72-75 are where the preamble and sync words are laid out.