Support Forum

Share your projects and post your questions

Register   or   Sign In
The Forum

Clock Stretch Error

1821 Views - Created 24/07/2018

24/07/2018

Posted by:
ssnow

ssnow Avatar

I've been using the ADC Differential Pi on a Raspberry Pi 3 running Windows IOT for some time now but randomly I'll get an error of "WinRT information: The transfer could not be performed due to a clock stretch timeout. Make sure the clock line is not being held low by a slave device."

I don't have the best understanding of I2C and how it all works, but after doing some research it seems there is a hardware bug that causes this issue between the Rapsberry Pi and I2C devices that attempt clock stretching... I believe one of the fixes mentioned is to disable clock stretching on the device or increase the timeout? Is there a way to do this on the ADC Differential Pi?

Thanks!

24/07/2018

Posted by:
andrew

andrew Avatar

Location:
United Kingdom

andrew Twitter  andrew Website  

As far as I know, the MCP3424 ADC that we use on the ADC Differential Pi does not use clock stretching. I couldn't find any mention of clock stretching in the datasheet for the ADC and it does not have any configuration options for enabling or disabling stretching.

Do you have a spare Raspberry Pi you could use to test the ADC Differential Pi to make sure it is not a problem with the I2C bus? It may also be worth making sure that your Window IoT is fully updated as there was a problem with one of the preview releases last year that caused the I2C to fail on the Raspberry Pi.

25/07/2018

Posted by:
ssnow

ssnow Avatar

Andrew,

Thank you for the quick response! I guess we can rule out clock stretching as the cause of the problem. I have multiple RaspberryPis equiped with ADC Differential Pis. Some work continuously but others seem to just stop communicating at random. The Windows IOT Demo Application can't even communicate with the board. So far it's happened on multiple versions of Win IOT Core, even the latest update that was pushed a few days ago. Usually our fix is to just replace it with a new Differential board and everything starts working again so this leads me to believe the Pi and Win IOT are functioning properly.

Could something be getting "stuck" or "frozen" on the Differential board itself that would cause it not to communicate? I've been monitoring the voltage coming off of our sensors and into the Differential board and I haven't seen anything above 60 mV. Any help is appreciated!

Thanks!

25/07/2018

Posted by:
andrew

andrew Avatar

Location:
United Kingdom

andrew Twitter  andrew Website  

The ADC shouldn't stop responding unless it gets a large voltage surge on one of the inputs but that would have to be more than 5V to go beyond the maximum input limits.

The ADC Differential Pi class has a timeout variable which keeps checking the ADC to see if a sample is ready and it could be possible that for some reason the ADC is not reading a sample before the timeout occurs which may be causing the program to hang.

In the ABElectronics_Win10IOT_Libraries folder, there is an ADCDifferentialPi.cs file which contains the class and methods for the ADC Differential Pi. On line 252 is the timeout variable.


var timeout = 10000;


You could try increasing the timeout value and recompiling the dll to see if that has any effect on the stability of your program.

One way to work out if it is a software or hardware issue would be to set up a separate SD card with Raspbian Linux and try using one of the readvoltage demo in our Python library to see if that can read from the ADC Differential Pi without failing.

25/07/2018

Posted by:
ssnow

ssnow Avatar

Tried increasing the timeout but no success. I will setup an SD card with Raspbian as a tester. In the meantime I had a thought, is it okay if the Differential board sees voltage while the Pi is off? In our setup, sometimes the sensors are energized and sending a signal before the Pi has had time to power on.

Thanks!

25/07/2018

Posted by:
andrew

andrew Avatar

Location:
United Kingdom

andrew Twitter  andrew Website  

According to the datasheet for the MCP3424 the input voltage shouldn't exceed the VDD power pin voltage so it could be possible that the sensor signals are causing problems if the Raspberry Pi is not powered. Is it possible to add some sort of switching on the inputs so the sensor can not send a voltage to the ADC unless it is powered?

27/07/2018

Posted by:
ssnow

ssnow Avatar

Andrew,

Thank you so much for pointing this out. I would guess this is likely the cause of board failures. Currently reconfiguring the project so that sensors can only be powered when the Pi is powered.

Sign in to post your reply

Note: documents in Portable Document Format (PDF) require Adobe Acrobat Reader 5.0 or higher to view.
Download Adobe Acrobat Reader or other PDF reading software for your computer or mobile device.