About Us Knowledge Base Community Forum Electronics Toolbox FAQ Shipping & Delivery

Community Forum

Share your projects and post your questions

Search
Register or Sign In
Forum

ADC Pi Plus - WIndows 10 IoT Core - Unexpected number of bytes was transferred. Expected: '. Actual: '.

1066 Views - Created 30/11/2017

30/11/2017

Posted by:
ds

Users Avatar

Hi,

hope somebody can help.
I am running the sample application from https://github.com/abelectronicsuk/ABElectronics_Win10IOT_Libraries 
on  3 inputs, I have set up three different voltages between 0 and 5V.
When running the sample, I am getting the follow exception:

Unexpected number of bytes was transferred. Expected: '. Actual: '.
   at Windows.Devices.I2c.I2cDevice.WriteRead(Byte[] writeBuffer, Byte[] readBuffer)
   at ABElectronics_Win10IOT_Libraries.ABE_Helpers.ReadI2CBlockData(I2cDevice bus, Byte register, Byte bytesToReturn)
   at ABElectronics_Win10IOT_Libraries.ADCPi.ReadRaw(Byte channel)
   at ABElectronics_Win10IOT_Libraries.ADCPi.ReadVoltage(Byte channel)
   at RaspiIOTHubTest1.MainPage.<ReadADC>d__32.MoveNext()
Exception thrown: 'System.Runtime.InteropServices.COMException' in ABElectronics_Win10IOT_Libraries.dll
WinRT information: Unexpected number of bytes was transferred. Expected: '. Actual: '.
Exception thrown: 'System.Runtime.InteropServices.COMException' in ABElectronics_Win10IOT_Libraries.dll
System.Runtime.InteropServices.COMException (0x8007045D): The request could not be performed because of an I/O device error.

For testing, I am catching the exception and continue. The exceptions are thrown very often and only in a few calls I am getting some data from the ReadRaw method.

Another issue is that the voltages are not correctly (measured? and) displayed in the UI.
I see sometimes voltages in ports I do not use. E. g. I see 4.x V on attached port 1, later I see the same voltage on port 5 (that has no voltage attached).

Any ideas?

 

30/11/2017

Posted by:
andrew

Users Avatar

Location:
United Kingdom

Users Twitter  Users Website  

Hi

I have just tested the demo application with an ADC Pi on the latest version of Windows 10 IOT and I could not replicate the errors you are receiving. 

Normally an I2C device error means the code is having trouble communicating with the ADC Pi.  Do you have any other I2C devices connected to the Raspberry Pi which could be blocking access to the I2C bus?

AB Electronics UK Tech Support

01/12/2017

Posted by:
ds

Users Avatar

Thanks for the reply. 

No, there are no other I2C devices attached.

 

Any other ideas?

01/12/2017

Posted by:
andrew

Users Avatar

Location:
United Kingdom

Users Twitter  Users Website  

Do you have a spare SD card you could install Raspbian Linux on?  If you could test the ADC Pi under linux using our Python library then that would allow you to narrow down whether the problem is with the ADC Pi or Windows 10.

AB Electronics UK Tech Support

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.