I tried to migrate the ADE7763 chip from bit-banged SPI to the HW peripheral in the Arduino. Should have been easy right?Well after reworking the board for the new pins and rewriting the code, i was not surprised that it did not work right out the gate. But after days of tearing out my hair, I followed my companies procedure for failures. First step is to write the problem down in words. Next is to list all possible contributing factors and possibilities no matter how idiotic. Next prove that each item is not a contributor starting with the most obvious issues.
So the issue was that the zero crossing interrupt no longer was occurring. Working my way though the list I checked that I could read and write registers. And although the logic analyzer told me the write timings were spot on, the read back gave me the default value. What????
Went back the the previous wiring and code and that did not work. Checked the wiring. Checked the solder joints on the adapter board. Buzzed out everything. But still not able to get a value to stick on a write operation. And then I noticed that the clock output was not stable till nearly 2 milliseconds after the reset line. The datasheet indicates a handful of microseconds. I added the delay and poof it now works. Go figure.
Now back to the original task of using HW SPI.