Support Forum

Share your projects and post your questions

Register   or   Sign In
The Forum

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

The ADC Pi is an Analogue to Digital converter for the Raspberry Pi

30/11/2017

Posted by:
ds

ds 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

andrew Avatar

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?

01/12/2017

Posted by:
ds

ds Avatar

Thanks for the reply.

No, there are no other I2C devices attached.



Any other ideas?

01/12/2017

Posted by:
andrew

andrew Avatar

Do you have a spare SD card you could install Raspbian Linux? 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.

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.

Home

Shop

Learn

Forum

FAQ

Contact

0 item

Your cart is empty

Please browse our shop to order from the wide range of Raspberry Pi boards and accessories.

Subtotal:£0.00
View Basket Continue to Checkout