sandeepmistry / arduino-LoRa

An Arduino library for sending and receiving data using LoRa radios.
MIT License
1.64k stars 628 forks source link

Arduino MKR WAN 1300 random() always returning 0 #172

Open bravech opened 6 years ago

bravech commented 6 years ago

I was trying to use the LoRa.random() function with the Arudino MKR WAN 1300, and every time it returns 0x00. I checked this by dumping the registers with a radio transmitting and with nothing transmitting, and the value didn't change. I noticed that in issue #59, @YannikW stated that register 0x1b is the raw RSSI, but that isn't the register used for measuring "Wideband RSSI", which is register 0x2c.

Does anybody have a list of the registers and what they do? I couldn't find the document that @YannikW referenced.

morganrallen commented 6 years ago

Here's the data sheet with the relevant Register Summary on page 91. 0x2C does appear to be the correct register and unfortunately the datasheet doesn't really say much about generating random numbers beyond... Wideband RSSI measurement used to locally generate a random number

I'll try this on another device as soon as I can.

https://cdn-shop.adafruit.com/product-files/3179/sx1276_77_78_79.pdf

bravech commented 6 years ago

It seems that the RSSI measurements "stagnate" when it's been a while since a call to LoRa.parsePacket(). It seems to be a problem with the actual LoRa chip itself, but I'll look more into what happens when parsePacket is caled.

This also affects other RSSI measurements, such as the raw RSSI measurement on register 0x1b and packet RSSI on register 0x1a.

sandeepmistry commented 6 years ago

@bravech any progress on this?

Is PR #150 of any interest?

bravech commented 6 years ago

I just worked around this by doing LoRa.parsePacket() before trying to measure the RSSI.

On Mon, Aug 6, 2018, 7:48 PM Sandeep Mistry notifications@github.com wrote:

@bravech https://github.com/bravech any progress on this?

Is PR #150 https://github.com/sandeepmistry/arduino-LoRa/pull/150 of any interest?

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/sandeepmistry/arduino-LoRa/issues/172#issuecomment-410887773, or mute the thread https://github.com/notifications/unsubscribe-auth/AAtnlQjXDWK0XrFYVZRiEkB6qilq7ujEks5uONW7gaJpZM4VYV5U .