LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

communicate with multiple SPI devices (MAX31855)

Dear LabViewers,

Since NathanB. and LexLuther422 got the MAX31855 thermocouple sensor to work over SPI at the beginning of the month, it's working great for me; but now I tried to use multiple MAX31855s "instantaneously" (some minor delay doesn't matter), and am not sure whether the way I do it is ok.

If it's complete nonsense (e.g. not closing every "instance" of MAX31855 communication; etc...), I would be very grateful if some kind person could turn me in the right direction.

multiple chips.JPG

I currently use a breadboard for evaluation, and the readings are very inacurate, so I don't know whether it is working correctely or not, but I receive data from the chips, at least - so that's a good sign, I guess.

I also tried to use a variable to change the CS port, but couldn't get it to work as I couldn't figure out how to structure the programme so that the pin selection would switch at the right moment...

Kind regards,

Theo

p.s.: The data of each chip should be one separate column in the measurement file, so I can't have just one "accquisition routine" and loop the CS pin selection through from x to x+1 to ... x+n. (As I see it...)

0 Kudos
Message 1 of 15
(11,377 Views)

It is only written to work with a single device because I had to write custom code for it since it doesn't actually use SPI protocol.

0 Kudos
Message 2 of 15
(6,804 Views)

Thank you for your fast response, NathanB.

So that's what you ment in the "original" MAX31855 thread by saying:

NathanB. schrieb:

When we get this part of the library 100% working, we can look into adding the multiple TC sensors.

Is there a chance that you might make it work, or is it too laborious?

Or is there a particular part of code you can point me to so that I could at least try to get it to work on my own?

Thanks for your help!

0 Kudos
Message 3 of 15
(6,804 Views)

It shouldn't be that hard to implement.  I'll try to look into it this weekend sometime.

0 Kudos
Message 4 of 15
(6,804 Views)

Thank you very much, sir!

I'm really in your debt...

0 Kudos
Message 5 of 15
(6,804 Views)

Ok, here we go.  Please let me know if it all works correctly so I can post it as a document.

You should still initiate both and then you need to supply the "chip select" pin to the read VIs.

0 Kudos
Message 6 of 15
(6,804 Views)

Thank you for the fast work!

Unfortunately, it doesn't work correctly. Using the new (v2) firmware and VIs - of course - I do get data, but seemingly random data. The CJC temp varies ~ between -200°C and +200°C, and the error indicator gives me every possible permutation: 1 error, 2 errors (but in different combinations), or all three errors. The only nearly constant reading is the TC temp: it's 768°C, except when I hold the TC into a flame; then it goes slightly up to ~ 770°C.

Strangely enough the TC temp doesn't change with varying CJC temps; no matter whether the CJC temp is at -150°C or at +150°C, the TC temp seems nailed to 768°C.

The chip and setup are ok; using the old firmware and old VIs I get correct readings.

Is there a possibility that it's because I've done something wrong?

0 Kudos
Message 7 of 15
(6,804 Views)

That is strange.  I didn't actually change all that much. You or someone else could take a look at the firmware to see if I've made any mistakes.  It's hard to debug stuff like this when the mistake is not obvious without any hardware to test with.

0 Kudos
Message 8 of 15
(6,804 Views)

I went over literally every line of code in the new firmware, I compared it to version 1 with the help of a file comparison tool and looked specially accurate at the differences - but I couldn't figure out what the problem is. Is it possible that the error isn't in the firmware, but sits in one of the new VIs? (As it looks as there is some kind of wiredly "switched bits" regarding the completely random CJC reading...)

Thanks for the great help so far...

0 Kudos
Message 9 of 15
(6,804 Views)

I changed even less on the LabVIEW side.

0 Kudos
Message 10 of 15
(6,804 Views)