Imp004m and Adafruit MAX 31856

I am new to the IoT arena but want to learn all I can. The hardware nomenclature is new but not completely foreign. I understand the concepts and I have no problem on the programming side of things. What I lack is knowledge concerning the pin assignments and the use of the library files in the device code (i.e. spi )

For my first project I would like to get a thermocouple connected to an imp004m using an Adafruit 31856 with a K type thermocouple. I found an old article on the Adafruit web site connecting a 31855 to an April board but I used it to get started.

I have been trying different combinations of pins using what little I can interpret from the Mux table for the imp004m, with no luck. I have verified the max board is getting power on my breadboard with my voltage meter so I know my pin assignments and/or device code need help.

I am attempting to use pinJ to get the reading. In my code and I initialize spi using the following, with parameters but I am uncertain about those also:
spi = hardware.spiGJKL;
spi.configure(MSB_FIRST, 4000);
hardware.pinJ.configure(DIGITAL_OUT);

BUT … I am not sure what pins the Chip Select maps to
I have:
imp004… MAX 31856 pin
pinJ … SD0 (MISO)
pin ? … CS (chip select)
pinK …SCK

AND I am not initializing pinK in the device code … pretty sure I need help there too.

Any and all help is appreciated.

First, drop the hardware.pinJ.configure(DIGITAL_OUT); as this reconfigures pinJ as as a digital output and is not needed.

What you want is:

spi = hardware.spiGJKL;
local actualClock = spi.configure(MSB_FIRST | CLOCK_IDLE_LOW | CLOCK_2ND_EDGE, 3000);
server.log("SPI clock " + actualClock + "kHz.");

Then pin J will connect to the max31856’s SDO, pin K to SCK, pin L to CS (NSS on the imp004m pin mux) and pin G to SDI.

The SPI configuration you need is based on the max31856 datasheet, ie. CPHA = 1, CPOL = 0, which translates in imp terms to CLOCK_IDLE_LOW | CLOCK_2ND_EDGE. See SPI Explained for more info.

Note this is just based on a glance at the datasheet, but it should work.

smittytone… you are the man! thanks for setting me on the right path and the additional information.