
adccommunitymod (AutomationDirect) asked a question.
Created Date: March 25,2020
Created By: snowrodeo
**** This post has been imported from our legacy forum. Information in this post may be outdated and links contained in the post may no longer work.****
Hey all, Baseline: I have a Adafruit MAX31856 (Thermocouple) as the only device on the SPI bus via the official proto board. The CS is connected to pin 7 (not A3 and A4). When I power the system via USB, the SPI device works as intended as the read temp is displayed on a 7 segment LED. This system drives three relays on the P1-08TRS module. Case 1: Works Power the system via the P1-01AC PS Do NOT init base controller chip (via P1.init() ) Case 2: The TC doesn't work (but the rest of the system does) Power the system via the P1-01AC Init the base controller I haven't thrown the analyzer on this yet because I must be doing something stupid. Any ideas?!?
Created Date: March 25,2020
Created by: snowrodeo
Hey all,
Baseline:
I have a Adafruit MAX31856 (Thermocouple) as the only device on the SPI bus via the official proto board. The CS is connected to pin 7 (not A3 and A4). When I power the system via USB, the SPI device works as intended as the read temp is displayed on a 7 segment LED. This system drives three relays on the P1-08TRS module.
Case 1: Works
Power the system via the P1-01AC PS
Do NOT init base controller chip (via P1.init() )
Case 2: The TC doesn't work (but the rest of the system does)
Power the system via the P1-01AC
Init the base controller
I haven't thrown the analyzer on this yet because I must be doing something stupid.
Any ideas?!?
Created Date: March 25,2020
Created by: FACTS_ENG_TEAM1
Could you post your code. An attachment or gist link is best.
Created by: snowrodeo
03-25-2020, 02:05 PM
Yep, here is the code. I didn't squeeze it down, sorry.
Created Date: March 25,2020
Created by: FACTS_ENG_TEAM1
I think your issue is with this line
I'm fairly certain your fix will be changing it to this:
It looks like this library has an unusual feature where you can choose to bit-bang SPI through GPIO. For the unfamiliar that means you are quickly toggling GPIO pins to emulate a SPI bus. Passing in all 4 pin parameters for your MAX31856 class uses this bit-banging method. What's happening, is when you call P1.init() afterwards, those pins are re-defined from GPIO to hardware SPI pins. This makes the underlying bit-bang functions stop working as the pins have been re-configured. If you create your class instance with just a CS pin, it defaults to true SPI behaviour.
-Adam
Created Date: March 25,2020
Created by: snowrodeo
Nailed it!
Great system by the way. Hope to install a bunch of these for various projects!!
Created Date: March 25,2020
Created by: FACTS_ENG_TEAM1
Thanks a lot! What kind of project are you doing with this code?