Moteino RFM69 Register bitrate setup

Started by Explorer, September 23, 2014, 04:49:13 PM

Explorer

Felix or anyone:

In the CONFIG array for the RFM69 register setup the REG_BITRATEMSB/LSB (0x03 and 0x04) are set to RF_BITRATEMSB_55555 the values are 0x02 and 0x40.  These are not listed on the Hope RFM69 document (Table 9 Bit Rate Examples) .  Is there a reason why this rate was chosen? (default is 4.8kbs or 0x1A, 0x0B)

If this bitrate is changed, do the REG_RXBW (0x19) and REG_PACKETCONFIG2 (0x3D) registers need to be changed too?

Finally, is there anywhere that the SPI max speed in bits per second is set?

Thanks

Felix

55.5Kbps bitrate was chosen because I considered it to be an optimal middle of the road speed between speed/low power and range.
According to the DS if you change the bitrate you should also tweak the BW. Faster bitrate means faster ramp-up/down so you will need to match that in REG_PACKETCONFIG2.
I've given some working example settings for BR-19200, commented out in RFM69.cpp.
SPI max speed in bits per second? I have no idea what you mean by that. SPI is set at MCU_SPEED/4, which for Moteino is 4Mhz. The DS of each SPI device will specify the limits of SPI speed that the device will accept, if you go faster than that your SPI comm will not be working as expected.

Explorer

Thanks.  On the last point I was looking at the low level spidev.c that sets a max rate for SPI communications. https://stuff.mit.edu/afs/sipb/contrib/linux/drivers/spi/spidev.c.

But more back to the Moteino, I am looking for a project that takes data received from the Moteino and dumps it to a RPi or Beaglebone using SPI or I2C.  I'm working on a "base station" example.

Felix

Yeah they are probably setting the SPI master clock to the max possible supported.
Why complicate your life with SPI and I2C? Why not use serial?

Explorer

Serial:  I will look at it -any good examples to help me out?

kiwisincebirth

Quote from: Explorer on September 29, 2014, 12:01:45 AM
Serial:  I will look at it -any good examples to help me out?
There are numerous discussions on this topic, search the forum for 'gateway'. There is also a sample included in the RFM69 library.

https://github.com/LowPowerLab/RFM69/blob/master/Examples/Gateway/Gateway.ino

Felix

UART is commonly referred to as serial. There is no clock, just a predefined bitrate like 57600 or 115200baud. All my examples include the use of serial.

Explorer

OK - I use Serial a lot "Serial.print(),  but it goes out via the USB cable to the PC.  Is there an example of wiring a Moteino to aBBB or RPi to receive UART/Serial data?

Felix

Sure, you just wire Moteino's RX to BBB/Pi's TX and the Moteino's TX to BBB/Pi's RX. No buffering needed since Moteinos run at 3.3V. Then you set the same baud on both ends and you're done. On a Pi the serial port is called something like "ttyAMA0" but you might need to enable it if not done already since by default it is reserved/used by the system console. See a guide for that here: http://www.raspberrypi-spy.co.uk/2013/12/free-your-raspberry-pi-serial-port/

The TX/RX pins are broken out on the side headers as well. Moteino USBs can also be plugged in to a USB port on the BBB/Pi and that should emulate a new serial port, something like "ttyUSB0" or similar.

Explorer

Did the wiring; just Rx and Tx cross over (also a common ground). Works great and the fact that the Serial interface is buffered saves a lot of headache with making sure the program is always listening.

Also unlike the I2C it is quite easy to send lots of bytes over at once.  Seems from my early trial that I2C is meant for reading / writing single registers on a dedicated chip.

Thanks for the help.