Understanding SPI datasheet - MAX78615+LMU (details inside)

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 :slight_smile:

You should be able to just shift the ADDR_BYTE byte 2 bits left. That will put a 0 in bits 0 and 1.

But if I shifted the address 0x9E (PQA_NEG_CNT Lagging Reactive Energy Counter) by 2 the following would happen:

9E = 1001 1110
Shift by 2
78 = 0111 1000

I don't understand how you access 186 different address with only 6 bits :frowning: Am I reading this datasheet wrong?

Just to rap this up (I hate finding unanswered questions in a forum), I contacted Maxim, and they said to not use SPI (in fact they recommend against it; even though their reference design uses it by default...) and instead pick either I2C or UART.

I switched to using UART, and after poring over the datasheet, I've successfully been able to communicate with the device and get meaningful data. I hope to publish a library on Github to help anyone else who is looking to use this IC. Good times :slight_smile:

Hi, I'm starting with MAX78615 and MAXREFDES14# system board. Would you like to share the library o some information about it?. Thanks.

I have also started using the MaxRedDes14 module. Anybody have any updates on a library for it.

ty