Closed jerryneedell closed 6 years ago
I added setting the baudrate as a parameter to init and that seems to work well. I left the default at 10000000 and it fails - setting it to 1000000 works. BTW - another user tried 9000000 and it still failed on a breakout, but 1000000 worked....
The values for SPI baudrate have large granularity, so 9M and 10M might actually be the same. In CircuitPython 3.0, you can use the SPI.frequency
property to find out what the actual setting is.
I did some measurements here: https://github.com/adafruit/circuitpython/issues/464#issuecomment-347676877, though those might not be the same numbers for 2.x.
That's a good point. I was just trying values to see what worked. Since the rfm69 data packets are very small I'm not sure it makes a lot of difference what rate is used for them. I suppose this is really a more general SPI issue when using breakout boards or other connections at the end of long-ish wires. Is there some better hardware solution to improve the signal quality? Or should we just slow it down when needed?
probably I just need to replace my jumper wires and breadboards more often ;-)
Yeah I would say if anything we could just put baud rate or any kwargs passed to the initializer as values that override the defaults vs. just trying to lower it globally. Most folks will want the fastest speed possible, but in odd cases like very long wires (not recommended but might be unavoidable in some cases) you could pass something to drop the baud rate to a lower speed. Also good to consider many folks will use the feather m0 board with built-in module that won't have wiring issues and would want to run at the fastest speed possible.
Just merged in the pull from Jerry to add baudrate as an optional parameter. If folks run into ID issues try initializing with baudrate=1000000 (1mhz) as an alternative:
rfm69 = adafruit_rfm69.RFM69(spi, cs, reset, 915.0, baudrate=1000000)
I'll put a quick note in the guide too to mention it if using longer cables or getting odd results.
When using the RFM69HCW breakout board, I was getting and error that the board version was incorrect.
Failed to find RFM69 with expected version, check wiring!
I put a print statement in the lib and found that it was returning a 0x10 not the expected 0x24
Note - it works fine fine with an RFM69HCW Featherwing
with help from @sommersoft It appears that this is due to a garbled read of the board version register.
Lowering the SPI baud rate from 10000000 to 9000000 appears to have fixed the problem. https://github.com/adafruit/Adafruit_CircuitPython_RFM69/blob/1abb4f7ce6fa5513c4e9c7dc280c1c2c28a7d062/adafruit_rfm69.py#L267
Presumably this is due to the longer jumper wires when using the breakout. I'm not sure what the best fix is for this.
Perhaps allowing the baud rates as an input parameter with a warning for breakout board users.