MAX31864 SPI

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Post Reply
kabouras_33
Posts: 84
Joined: Thu Jul 27, 2017 5:23 am
Contact:

MAX31864 SPI

Post by kabouras_33 »

Hello!!!
Does anyone have any working example of how to read values from the adafruit max31865?
I try to use the spi master but I get nothing in return....I also cannot find any examples to read from an spi sensor in general
Attachments
temp.fcfx
(26.2 KiB) Downloaded 26 times

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1189
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Contact:

Re: MAX31864 SPI

Post by QMESAR »

Hi.
For a start when you select Auto CS to "NO"(as you did in your FC chart)
P2.jpg
P2.jpg (98.39 KiB) Viewed 1370 times
Then you have to control the CS pin yourself in the Flowchart and normally SPI chips need to see a transition from High ---> low to start transmission
as I show you here with your C13 pin, which I assume you use for CS ,if you select auto CS and define the pin the component will do this all automatically for you
P1.jpg
P1.jpg (63.68 KiB) Viewed 1370 times
Secondly are you sure your controller is running at the correct speed? I looked at your Config settings and they seems strange to me

kabouras_33
Posts: 84
Joined: Thu Jul 27, 2017 5:23 am
Contact:

Re: MAX31864 SPI

Post by kabouras_33 »

Dear Mr QMESAR
Thank you very much for your quick response and your valuable information!! well noted and already tried but nothing the response is FFFF...
I also tried to understand the datasheet, and it looks like there is a register to write configuration sending a byte array and read..
The problem is that I am not familiar with registers and bytes so I ve been trying now for a couple of hours with no result...
It would be nice for flowcode to have it as a sensor because it is so much in use...
Attachments
temp.fcfx
(36.45 KiB) Downloaded 28 times

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1189
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Contact:

Re: MAX31864 SPI

Post by QMESAR »

Hi

Yes normally there is some command you should send to read the specific information from the device
post the datasheet that we can see what you need.
It is impossible for Flowcode to support all sensors and chips this one might be for you important then for 1000 people some other chips is important
it is always good to learn to write the correct information yourself

Post the datasheet and we can try to help

kabouras_33
Posts: 84
Joined: Thu Jul 27, 2017 5:23 am
Contact:

Re: MAX31864 SPI

Post by kabouras_33 »

Thank you again very much!!!
And yes i totally agree with you!!!if i (or anyone else ) we can learn the fundmentals then it is much better because we can fix anything....So i keep trying maximum effort :D
attached please find the sensor module and the datasheet!!!
Thank again for your help!!!
Attachments
MAX31865.pdf
(836.12 KiB) Downloaded 38 times
Untitled.png
(243.36 KiB) Downloaded 1154 times

kabouras_33
Posts: 84
Joined: Thu Jul 27, 2017 5:23 am
Contact:

Re: MAX31864 SPI

Post by kabouras_33 »

oh and I forgot,
yes, the controller is running perfectly!!
Led flash test 1 sec DONE!
uart comm 115200 baud rate and hello to pc DONE!
All looks well!!
plus I am already interfacing with ethernet and UDP to android etc with same configurations!
I must say that we have no problem there.
My humble opinion is that I need to sent bytes to configure the module and then request bytes to take the measurement.
The problem is I have never worked with bytes arrays and reg addresses before...
Now it is my chance to start learning but every single example I can find is for Arduino and basically they use libraries...so no hint...

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1189
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Contact:

Re: MAX31864 SPI

Post by QMESAR »

Hi
My humble opinion is that I need to sent bytes to configure the module and then request bytes to take the measurement.
The problem is I have never worked with bytes arrays and reg addresses before...
You are right with this
I am out the next few days but I am sure there will be some one here that can help you with that . :D

kabouras_33
Posts: 84
Joined: Thu Jul 27, 2017 5:23 am
Contact:

Re: MAX31864 SPI

Post by kabouras_33 »

Hello,
Thanks a lot for your time!!
Hopefully someone can guide me to the solution :wink:

User avatar
LeighM
Matrix Staff
Posts: 2043
Joined: Tue Jan 17, 2012 10:07 am
Contact:

Re: MAX31864 SPI

Post by LeighM »

Hi,
From the datasheet it looks like you will need to use the TransactionArray()
rather than Get and SendByteArray.
The first byte of the array is to be set to the required address.
If you are writing data, bit 7 is set to 1, i.e. addresses start at 0x80, for reading they start at 0x00
So to read the RTD data from the device set DataOut[0] = 0x01 and Numbytes to 3
Call TransactionArray() and the RTD MSB will be in DataIn[1] and the RTD LSB in DataIn[2]

kabouras_33
Posts: 84
Joined: Thu Jul 27, 2017 5:23 am
Contact:

Re: MAX31864 SPI

Post by kabouras_33 »

Thank you Leigh for your quick response,
Well i was trying all night yesterday but i got some weard results....
meaning:
The way you proposed (if i understood it correctly)works but....
it is noty stable sometimes i read values msb/lsb sometimes(most of the times 0)...somethink is not appropriate.
I tested with and arduino by the way and the demo code from adafruit and i made it work in 2 minutes!!!!amazing but i cannot understand the structure of their code cause everything in libraries :evil:
Attachments
temp.fcfx
(32.63 KiB) Downloaded 28 times

User avatar
LeighM
Matrix Staff
Posts: 2043
Joined: Tue Jan 17, 2012 10:07 am
Contact:

Re: MAX31864 SPI

Post by LeighM »

Try changing the SPI properties...
"Use Auto CS" to "No"
"Clock Polarity" to "Idle High"

kabouras_33
Posts: 84
Joined: Thu Jul 27, 2017 5:23 am
Contact:

Re: MAX31864 SPI

Post by kabouras_33 »

ok but if i put auto cs to no it means i will configure an output high and low manually before and after each transaction???

kabouras_33
Posts: 84
Joined: Thu Jul 27, 2017 5:23 am
Contact:

Re: MAX31864 SPI

Post by kabouras_33 »

ok I tried and after I compiling the first time I took some values to MSB and LSB but after shutdown and open again all 0...
Attachments
temp.fcfx
(32.6 KiB) Downloaded 23 times

User avatar
LeighM
Matrix Staff
Posts: 2043
Joined: Tue Jan 17, 2012 10:07 am
Contact:

Re: MAX31864 SPI

Post by LeighM »

Might be worth reading the "Fault Status" register (0x07)
and setting up the "Configuration" register (0x80)?

kabouras_33
Posts: 84
Joined: Thu Jul 27, 2017 5:23 am
Contact:

Re: MAX31864 SPI

Post by kabouras_33 »

datain[2]=255??all else zero....overvoltage/undervoltage fault??

kabouras_33
Posts: 84
Joined: Thu Jul 27, 2017 5:23 am
Contact:

Re: MAX31864 SPI

Post by kabouras_33 »

can you send me please a short and quick example of how to write in specific adress?

User avatar
LeighM
Matrix Staff
Posts: 2043
Joined: Tue Jan 17, 2012 10:07 am
Contact:

Re: MAX31864 SPI

Post by LeighM »

Hi,
From the datasheet page 18 it shows how to write to a register with a two byte transaction.
So set the register address, e.g. the Config address of 0x80, into DataOut[0] = 0x80
Set the value into DataOut[1]
Then set Numbytes to 2 and call TransactionArray()

The fact that you sometimes get 255 and others 0 implies a problem with the SPI.
Are your voltage levels and clock speed OK?
Could you try the SPI in software mode?

kabouras_33
Posts: 84
Joined: Thu Jul 27, 2017 5:23 am
Contact:

Re: MAX31865 SPI

Post by kabouras_33 »

Hello again,
Well after months of trying well I couldn't make it to work..... It looks like it makes me very confused and apparently I cannot understand the datasheet no matter what..... I had to find a workaround so I used an Arduino boot loaded Atmel with adafruit code for the module and talked to my cpu......horrible but worked........any example of any module of just how you make a transaction would be greatly appreciated after that i hope i can use it as guided!!
thank everyone :wink:

TaliG
Posts: 45
Joined: Fri Apr 07, 2017 1:55 am
Location: Greece
Contact:

Re: MAX31864 SPI

Post by TaliG »

Hi kabouras,

I do have a working example for max31865 but includes LODS of code irrelevant to this sensor.
I will take out all the irrelevant code to the sensor and upload it for you this weekend.

George

kabouras_33
Posts: 84
Joined: Thu Jul 27, 2017 5:23 am
Contact:

Re: MAX31864 SPI

Post by kabouras_33 »

Really you would do that for me???
Thank you very very very much!!!!!!!!!!

TaliG
Posts: 45
Joined: Fri Apr 07, 2017 1:55 am
Location: Greece
Contact:

Re: MAX31864 SPI

Post by TaliG »

Hi
PM send.

jgu1
Posts: 1188
Joined: Tue Oct 06, 2009 9:39 am
Contact:

Re: MAX31864 SPI

Post by jgu1 »

Hi Talig!

Please will you share with me too? I will be grateful...

Br Jorgen

TaliG
Posts: 45
Joined: Fri Apr 07, 2017 1:55 am
Location: Greece
Contact:

Re: MAX31864 SPI

Post by TaliG »

Hi Jorgen

this is not privet,

I thought it would be better if I cleaned the flowchart from other irrelevant tasks before I upload.

My goal is to declutter the flowchart and make it understandable enough for someone who is familiar with component creation , so he can build a flowcode component with it.

Anyway, here is a sample.

I ll be back during the weekend

George
Attachments
Max31865.fcfx
(31.45 KiB) Downloaded 13 times

jgu1
Posts: 1188
Joined: Tue Oct 06, 2009 9:39 am
Contact:

Re: MAX31864 SPI

Post by jgu1 »

Waov George, thank you very much. :D :D :D :D

Br Jorgen

Post Reply