Maxim MAX31855 and SPIN Propeller
Jkane
Posts: 113
Hello,
II was working with the Maxim Max31855, and was using the spi code for DS1620, It is a SPI device, but I think the ShiftIN is different,
Here is the initial code for the DS1620
I think the code for this statement is different: Celsius := SPI.SHIFTIN(SO, SCK,SPI#LSBPOST, 9) '' read the temperature
If anyone has experience with spin and this chip, I would be most grateful:
(I get output, but it keeps changing)
regards
Jeff
II was working with the Maxim Max31855, and was using the spi code for DS1620, It is a SPI device, but I think the ShiftIN is different,
Here is the initial code for the DS1620
I think the code for this statement is different: Celsius := SPI.SHIFTIN(SO, SCK,SPI#LSBPOST, 9) '' read the temperature
If anyone has experience with spin and this chip, I would be most grateful:
(I get output, but it keeps changing)
regards
Jeff
{{ ************************************************ * Propeller SPI Spin Demo v1.0 * * Author: Beau Schwabe * * Copyright (c) 2009 Parallax * * See end of file for terms of use. * ************************************************ }} CON _CLKmode = xtal1 + pll16x _xinfreq = 5_000_000 OBJ SPI : "SPI_Spin" ''The Standalone SPI Spin engine Ser : "FullDuplexSerial" ''Used in this DEMO for Debug CON WrCfg = $0C '' write config register StartC = $EE '' start conversion RdTmp = $AA '' read temperature PUB SPI_DEMO|SO,SCK,CS,ClockDelay,ClockState,Celsius,Fahrenheit {{ -------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------- The DS1620 temperature sensor is used to demonstrate the SPI's SHIFTIN and SHIFTOUT functions. most of the code follows the "Stamp Works" documentation that can be found here... [URL]http://www.parallax.com/Portals/0/Downloads/docs/books/sw/Web-SW-v2.1.pdf[/URL] -------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------- Schematic: Vdd  330 ┌────┴────┐ P0 ────┤1 8 7├──NC │ │ P1 ───────┤2 6├──NC │ │ P2 ───────┤3 4 5├──NC └────┬────┘  Vss }} '' -----[ Initialization ]-------------------------------------------------- ''Serial communication Setup Ser.start(31, 30, 0, 57600) '' Initialize serial communication to the PC through the USB connector '' To view Serial data on the PC use the Parallax Serial Terminal (PST) program. ''SPI Setup ''SPI.start(ClockDelay, ClockState) SPI.start(15,1) '' Initialize SPI Engine with Clock Delay of 15us and Clock State of 1 ''DS1620 Setup ' SO := 0 '' Set DS1620 Data Pin ' SCK := 1 '' Set DS1620 Clock Pin ' CS := 2 '' Set DS1620 CS Pin SO := 25 '' Set DS1620 Data Pin CS := 26 '' Set DS1620 Toggle for data send SCK := 27 '' Set DS1620 Clock Pin 'LOW(CS) 'HIGH(CS) '' alert the DS1620 'SPI.SHIFTOUT(SO, SCK, SPI#LSBFIRST , 8, WrCfg) '' Request Configuration Write 'SPI.SHIFTOUT(SO, SCK, SPI#LSBFIRST , 8, ) '' configure for ; CPU / Free-run mode 'HIGH(CS) 'LOW(CS) '' release the DS1620 'waitcnt(cnt+CLKfreq*10/1000) '' Pause for 10ms 'HIGH(CS) 'LOW(CS) '' alert the DS1620 'SPI.SHIFTOUT(SO, SCK, SPI#LSBFIRST , 8, StartC) '' Request a Start Conversion 'HIGH(CS) 'LOW(CS) '' release the DS1620 ' -----[ Program Code ]---------------------------------------------------- repeat LOW(CS) 'HIGH(CS) '' alert the DS1620 SPI.SHIFTOUT(SO, SCK, SPI#LSBFIRST , 8, RdTmp) '' Request to read the temperature 'Celsius := SPI.SHIFTIN(SO, SCK, SPI#LSBPRE, 9) '' read the temperature Celsius := SPI.SHIFTIN(SO, SCK,SPI#LSBPOST, 9) '' read the temperature HIGH(CS) 'LOW(CS) '' release the DS1620 Celsius := Celsius << 23 ~> 23 '' extend sign bit Celsius *= 5 '' convert to tenths Fahrenheit := Celsius * 9 / 5 + 320 '' convert Celsius reading to Fahrenheit Ser.str(string("DS1620 thermometer")) Ser.tx(9) Ser.tx(9) Ser.dec(Celsius/10) Ser.tx(".") Ser.dec(Celsius - Celsius/10*10) Ser.str(string("°C")) Ser.tx(9) Ser.tx(9) Ser.dec(Fahrenheit/10) Ser.tx(".") Ser.dec(Fahrenheit - Fahrenheit/10*10) Ser.str(string("°F")) Ser.tx(13) PUB HIGH(Pin) dira[Pin]~~ outa[Pin]~~ PUB LOW(Pin) dira[Pin]~~ outa[Pin]~ {{ ┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ TERMS OF USE: MIT License │ ├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation │ │files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, │ │modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software│ │is furnished to do so, subject to the following conditions: │ │ │ │The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.│ │ │ │THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE │ │WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR │ │COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, │ │ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. │ └──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ }}
Comments
I found your posting on another thread using this chip, thanks for info, I'll test it this morning. .
regards
Jeff
works great, thanks
Jeff
Be careful with certain versions of this MAX31855 chip...
MAX31855 Factory Calibration (Trim) Issue:
I first saw this issue on 07 July 2014 here:
http://www.adafruit.com/blog/2014/07/07/product-id-269-max31855-thermocouple-breakout-notice-from-maxim/
Excerpting (shamelessly) from the above link (thank you Adafruit):
--snip--
"Product ID: 269 MAX31855 Thermocouple breakout Notice from MAXIM"
If you received a MAX31855 Thermocouple breakout (https://www.adafruit.com/products/269) within the last few months and you may have a incorrectly trimmed chip as per MAXIM, the chip maker. Weve only had 3 reports of this so far, however we sent this to all customers today.
** The affected chips are Lot #FM385253AK date code 201345″ **
Please check your MAX31855 thermocouple breakout for 1345″ on the second line or 253AK written on the third line of the chip
** If you have a 253AG chip that one is OK, we hand verified that the 253AGs are not affected! **
--/snip--
Evidently from the Adafruit post (link above) Maxim knew about this problem from around 27 March 2014, but did not notify users.
As of my post date here I went to the Maxim-Integrated MAX31855 homepage and I cannot find an obvious release note or document referring to this problem. (Shame on you Maxim-Integrated). Maybe it is in the updated(?) part Data-Sheet? Dunno. I don't have time to look at it right now.
----
I am not affiliated with Maxim-Integrated or Adafruit Industries in any way. I only post this to the Propeller forum for information purposes. I am not a current user of the chip referenced above, but it is on my hit-list to try.
----