After a very frustrating weekend, I am pretty confident I have the worst of the integration problems behind me. The Embedded Adventures board is a very nice board but did take the choice of SPI or I2C out of my hands. It was designed to be I2C only. Not a problem. The Arduino does I2C.
So I hooked up the break out board to my Arduino UNO and started to write some basic “Wire Library” code. How hard could this be? Well after the first day, I would say pretty hard. Turns out the AS3935 has some pretty stringent demands for reading and writing registers. Mostly, when turning around the bus, you must use a “Repeated Start” and not a more normal Stop and Start sequence. After I figured that out, I was able to realize that the Wire library does support that, but not in so many words. After Day one, I at least was getting some ACKs from the device address part of the bus transfer.
After day two, I was able to read and write most registers except register 0x00. This one kept giving me a NAK when I sent over the device address for the read after I had sent over the register address in the write part of the transaction. Much aggravation because sometimes it would work and other times not.
In the mean time, I have exchanged numerous emails with the Embedded Adventures people in the UK. They must never sleep and take days off over there because I was getting very fast turn arounds on the questions I was asking. The upshot is that they had issues as well with register 0x00. So with that in mind, I did a careful survey of the issue and discovered what must be an “undocumented feature”. Reading register 0x00 will always NAK you till such time as you read a different register. After that you can read and write any and all legal registers. I have sent out yet another email to the AMS people in Austria asking them about this issue and any other errata they might like to share.
At the end of day three with the low level communication finished, I was able to get the unit to self calibrate and to sit in listen mode. Further more, I was able to get it to respond with “disturber (not lightning)” reports when I generated sparks in the area. Without the awfully expensive lightning simulator from AMS, I will now have to sit around and wait for a storm. That might be many months from now.
But now with this off my plate (its been a running project for more than two years) I can get back to the AVC. Just so happens that I got two thermo electric coolers in the mail over the weekend just waiting to try to temperature stabilize the IMU and to characterize it for hard and soft magnetic properties.