Home/Support/Support Forum/SPIRead library function hangs
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

SPIRead library function hangs

0 votes
I am using the DC 10.72 SPIRead library function to read out the temperature and humidity from a device. After several tens of thousands of readings (sometimes less iterations, sometimes more) the program hangs in the SPIRead function.

Anyone have this issue and solution?

The default settings (which I am using) are on Port B. PB0 is used for the serial flash clock. Possible conflict and source of my hang?
asked Dec 21, 2015 in Rabbit Software by bflusche New to the Community (3 points)

Please log in or register to answer this question.

2 Answers

0 votes
The problem appears to be the library using Serial Port B with the clk on PB0. I hooked up a scope and saw clock activity on the line even with my SPI routine disabled. Something else is periodically clocking 2 bytes. The literature says the serial flash uses the line at INIT, but not after. Something is using it though. I wrote a bit-bang routine and used PB4 for the clock, works like a champ now.
answered Jan 4, 2016 by bflusche New to the Community (3 points)
0 votes
What product was this? There are a few SPI-related bug fixes in the GitHub repository:


If you make use of the UserBlock on products that boot from a serial flash, they will access the SPI bus.
answered Jan 20, 2016 by TomCollins Veteran of the Digi Community (1,718 points)
Dynamic C 10.72 and RCM 5650.  To my knowledge, I am not using User Blocks, but perhaps the WiFi routines are accessing calibration data?
Is there an ADC on the 5650?  Take a look at the schematic and you should be able to see what devices are on the SPI bus and might be in use.  And you could just make use of the SPI semaphore in your own code to ensure that there aren't any SPI conflicts.  Just make sure you have the semaphore before asserting chip select on your device.
Looking at the schematic at http://ftp1.digi.com/support/documentation/0900280_f.pdf

There is an ADC also connected to the SPI interface so using the semaphore would be a must.