Hi
I hope this is not a stupid question, I would like to know if there is a way to check that the radio (rfm69hw) is present in code. If I use "if (radio.initialize(FREQUENCY,NODEID,NETWORK))" to initialize the radio without it being present, my code stalls.
This type of check works well in the radiohead library.
My second issue is that when I receive RF communication on my gateway node (atmega328p-au) running serial at 400 000 baud (this happens at any baud rate) and print the message to serial, sometimes the message is truncated. My guess is that the Serial.print function is interrupted by the radio's interrupt.
I am using the arduino 1.0.5 cores
Any advice would be appreciated.
Kind Regards
H
What kind of hardware do you have?
Hi
All my radios are rfm69HW 915Mhz
The gateway is based on a atmega328p-au with a ftdi ft232rl usb serial converter.
My nodes are based on atmega328p-au, atmega644p-au and atmega1284p-pu chips.
The MCUs run 5v and some of them run 3.3v. The 5v boards have the radios connected via a mosfet level shifter configuration and LDO for radio/shifting reference power.
All the nodes communicate very well except for the truncation issue on the gateway.
Quote from: overdrive on July 21, 2014, 05:30:13 AM
I would like to know if there is a way to check that the radio (rfm69hw) is present in code. If I use "if (radio.initialize(FREQUENCY,NODEID,NETWORK))" to initialize the radio without it being present, my code stalls.
This type of check works well in the radiohead library.
My second issue is that when I receive RF communication on my gateway node (atmega328p-au) running serial at 400 000 baud (this happens at any baud rate) and print the message to serial, sometimes the message is truncated. My guess is that the Serial.print function is interrupted by the radio's interrupt.
I am using the arduino 1.0.5 cores
You can't tell from software how the hardware amplifier path is implemented. The radiohead library has a settxpower function with these comments:
652 /// Sets the transmitter power output level.
653 /// Be a good neighbour and set the lowest power level you need.
654 /// Caution: legal power limits may apply in certain countries.
655 /// After init(), the power will be set to 13dBm.
656 /// \param[in] power Transmitter power level in dBm. [i][b]For RF69W, valid values are from -18 to +13 [/b][/i]
657 /// (higher power settings disable the transmitter).
658 /// For RF69HW, valid values are from +14 to +20. Caution: at +20dBm, duty cycle is limited to 1% and a
659 /// maximum VSWR of 3:1 at the antenna port.
660 void setTxPower(int8_t power);http://www.airspayce.com/mikem/arduino/RadioHead/RH__RF69_8h_source.html
So
you are telling the chip how the radio is implemented (W/HW so it matches hardware amp) not the other way around.
400kbaud serial? That's
reallly pushing it my friend, not surprised at all. Try 115kbaud, that's more than most things and works well on the mega328.
Hi, maybe I was unclear in describing my issue, I want to check to see if the radio is physically connected to the board or responding /functioning normally. In radiohead if you try to initialize the radio and it is not present or it is not responding the code returns false and you can compensate for that or display an error code.
With your library, when I initialize, the MCU without the radio physically connected to the pcb, it "freezes" at the if (radio.initialize(FREQUENCY,NODEID,NETWORK)) step (if the watchdog is disabled).
400 000 baud is still fine, the truncation issue worsens a lot at lower baud rates.
A sample taken just now (each line is a sensor sending data every 10 minutes):
<- : NETWORK:0;ADDRESS:20;COMMAND:41;DATA:21.125<- : [RX_RSSI:-38]
<- : NETWORK:0;ADDRESS:20;COMMAND:41;DATA:20.625<- : [RX_RSSI:-68]
<- : NETWORK:0;ADDRESS:21;COMMAND:41;DATA:18.250<- : [RX_RSSI <-incomplete
<- : NETWORK:0;ADDRESS:20;COMMAND:41;DATA:19.750<- : [RX_RSSI:-66]
<- : NETWORK:0;ADDRESS:21;COMMAND:41;DATA:18.000<- : [RX_RSSI:-39]
<- : NETWORK:0;ADDRESS:21;COMMAND:41;DATA:16.500 <-incomplete
<- : NETWORK:0;ADDRE <-incomplete
Quote from: overdrive on July 21, 2014, 05:25:31 PM
400 000 baud is still fine, the truncation issue worsens a lot at lower baud rates.
A sample taken just now (each line is a sensor sending data every 10 minutes):
<- : NETWORK:0;ADDRESS:20;COMMAND:41;DATA:21.125<- : [RX_RSSI:-38]
<- : NETWORK:0;ADDRESS:20;COMMAND:41;DATA:20.625<- : [RX_RSSI:-68]
<- : NETWORK:0;ADDRESS:21;COMMAND:41;DATA:18.250<- : [RX_RSSI <-incomplete
<- : NETWORK:0;ADDRESS:20;COMMAND:41;DATA:19.750<- : [RX_RSSI:-66]
<- : NETWORK:0;ADDRESS:21;COMMAND:41;DATA:18.000<- : [RX_RSSI:-39]
<- : NETWORK:0;ADDRESS:21;COMMAND:41;DATA:16.500 <-incomplete
<- : NETWORK:0;ADDRE <-incomplete
Well in my mind when you do 120mph on the freeway it's much more probably someone will die very soon. But everyone is happy at 70mph. Same is true in hardware in most cases. :)
I've never seen weirdness at 115kbps under normal circuimstances. Haven't tried 400kbps on a mega328 but that's not even close to any standard baud rates that I know of (closest i heard of are 256k and 460k). And I would fully expect it to fail at anything above 115200. It doesn't sound like you're using Moteinos so I think we've covered more than was necessary.
At lower baud rates, (115200 is my default for all nodes except gateway node), the truncation is worse. If I comment out any interrupt driven library the serial outputs fine, when I re-introduce the libraries, sporadic truncation occurs.
Some further reading points to the poor implementation of the serial.print function and it not handling interrupts properly.
It seems that any interrupt will cause the serial.print(ln) method to fail in some instances.
I have never seen that happen, not with my libraries. The interrupts are very fast. Also the serial device is non blocking. Hence I don't know why you have a need for 400kbaud.
You might have some poorly implemented libraries or perhaps (but less likely) hardware issue.