Page 1 of 1

MAX31864 SPI

Posted: Sun Nov 03, 2019 11:45 am
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

Re: MAX31864 SPI

Posted: Sun Nov 03, 2019 2:09 pm
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 8497 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 8497 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

Re: MAX31864 SPI

Posted: Sun Nov 03, 2019 2:43 pm
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...

Re: MAX31864 SPI

Posted: Sun Nov 03, 2019 3:23 pm
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

Re: MAX31864 SPI

Posted: Sun Nov 03, 2019 3:39 pm
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!!!

Re: MAX31864 SPI

Posted: Sun Nov 03, 2019 6:35 pm
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...

Re: MAX31864 SPI

Posted: Sun Nov 03, 2019 7:23 pm
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

Re: MAX31864 SPI

Posted: Sun Nov 03, 2019 7:37 pm
by kabouras_33
Hello,
Thanks a lot for your time!!
Hopefully someone can guide me to the solution :wink:

Re: MAX31864 SPI

Posted: Mon Nov 04, 2019 9:17 am
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]

Re: MAX31864 SPI

Posted: Tue Nov 05, 2019 11:40 am
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:

Re: MAX31864 SPI

Posted: Tue Nov 05, 2019 12:32 pm
by LeighM
Try changing the SPI properties...
"Use Auto CS" to "No"
"Clock Polarity" to "Idle High"

Re: MAX31864 SPI

Posted: Tue Nov 05, 2019 3:30 pm
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???

Re: MAX31864 SPI

Posted: Tue Nov 05, 2019 3:48 pm
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...

Re: MAX31864 SPI

Posted: Tue Nov 05, 2019 4:13 pm
by LeighM
Might be worth reading the "Fault Status" register (0x07)
and setting up the "Configuration" register (0x80)?

Re: MAX31864 SPI

Posted: Tue Nov 05, 2019 4:22 pm
by kabouras_33
datain[2]=255??all else zero....overvoltage/undervoltage fault??

Re: MAX31864 SPI

Posted: Tue Nov 05, 2019 4:47 pm
by kabouras_33
can you send me please a short and quick example of how to write in specific adress?

Re: MAX31864 SPI

Posted: Wed Nov 06, 2019 9:01 am
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?

Re: MAX31865 SPI

Posted: Mon May 25, 2020 7:34 pm
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:

Re: MAX31864 SPI

Posted: Mon May 25, 2020 11:30 pm
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

Re: MAX31864 SPI

Posted: Tue May 26, 2020 8:03 am
by kabouras_33
Really you would do that for me???
Thank you very very very much!!!!!!!!!!

Re: MAX31864 SPI

Posted: Tue May 26, 2020 4:24 pm
by TaliG
Hi
PM send.

Re: MAX31864 SPI

Posted: Tue May 26, 2020 5:21 pm
by jgu1
Hi Talig!

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

Br Jorgen

Re: MAX31864 SPI

Posted: Tue May 26, 2020 6:44 pm
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

Re: MAX31864 SPI

Posted: Tue May 26, 2020 7:39 pm
by jgu1
Waov George, thank you very much. :D :D :D :D

Br Jorgen