sparkfun / SparkFun_AS3935_Lightning_Detector_Arduino_Library

Other
37 stars 19 forks source link

SPI Code is off by 1 bit #21

Closed iseries1 closed 8 months ago

iseries1 commented 8 months ago

The documentation shows that bits 5:1 is used for indoor and outdoor and should be 10010 and 01110. This combined with the other bits would now be 100100 (0x24) and 011100 (0x1C). Bit zero is missing from all the SPI reads.

For example, if you power down the unit by writing a 1 to bit zero in register zero the unit powers down and if you read it back it should read back that bit zero is now a 1 but it doesn't.

I proved this by reading back 9 bits instead of just 8 and did get the zero bit to show up as a 1.

This is another case of what?

For the most part I guess everything should work but some values are going to be wrong because the zero bit is not read. For example the distance values.

Mike

iseries1 commented 8 months ago

Never mind, I see where you are shifting things around to make the values work. It looks like my SPI functions are a little different than yours and I seem to have a problem with dropping a bit of data.