I've got a development board which has an SPI interface to the MAX78615+LMU - an energy monitoring IC.
I've been looking at the datasheet, and I don't quite understand how to start talking to it... I've figured out so far that its SPI_MODE3 and MSBFIRST. However, after that, I don't understand what this means:
The ADDR[5:0] refers to bits 2, 3, 4, 5, 6, 7? So byte 1 would be (from bit 7 through 0): ADDR ADDR ADDR ADDR ADDR ADDR 0x00 0x00?
The last three bytes I'm assuming can be anything, but most likely just 0x00?
In psuedo code:
Spi.setupIncTransaction(MSBFIRST, MODE3);
Spi.transfer(0x01);
Spi.transfer(ADDR_BYTE);
uint8_t firstByte = Spi.transfer(0x00);
uint8_t secondByte = Spi.transfer(0x00);
uint8_t thirdByte = Spi.transfer(0x00);
With that said, and as the datasheet says, having only 6 bits to work with gives a maximum value of 0x3F or 64 (6^2) possible addresses. But, the ADDR[5:0] should be 'filled with the word address of the read transaction', which is a list of words that far exceeds the 0x3F limit; shown on page 43 of the datasheet.
I'm guessing I'm missing something fundamental.
How do I construct this magical byte 1 with the ADDR[5:0] bits in it? I've used bit maths before, but never in anger