I am running a loop that is constantly reading from an I2C sensor. However after a long while I notice the system hangs. When I pause the code I see it is hanging just after going into LPM0. I have included a screenshot of the situation below.
I ran three tests and found that the number of cycles differs significantly.
Test 1 - 836 cycles
Test 2 - 1892 cycles
Test 3 - 1002 cycles
One cycle is counted when the sensor has data to be read but, the sensor is polled between each full data read to see if data is available. There are approximately 44 reads per cycle and therefore 88 times the uC goes into LPM0 (once per write and once per read).
Any help in resolving this issue would be very much appreciated.
Make sure that the sleep mode that you have enabled can wake up after entering sleep mode. Also what wakes up the micro from sleep. Sounds like you are polling the value and are not interrupting the value.
In reply to daniel johnson2:
The code I am using is based on TI's example code for Master Tx/Rx with an I2C device, if I remember correctly the example numbers are 8 and 10. I have not gone back to the basic code and tried letting it run for 2+ hours but I can maybe try that over the weekend.
Either Way seeing as it is a TI demo I would assume that the code should work 100%.
I am now not able to run the code at all as it always hangs at the low power section and does not wake up. I am starting to wonder if somehow the CC3100 code is interfering. Any help would be very much appreciated.
All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.
TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs andembedded processors, along with software, tools and the industry’s largest sales/support staff.