You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have come across a similar issue to #16 when using I2C via the GPIO socket implementation over a slow wireless network. I did not observe the problem when running the same code locally on the Pi via the loopback interface.
I observed that any payload was intermittently ignored when requesting multiple bytes over I2C and would be delivered as preamble prior to the next requested packet.
For example, the request for 25 bytes, made over a slow network returns zero bytes:
The problem appears to stem from PiGpioPacket#decode assuming that all the data for the packet, including the payload, is already available from the socket stream.
I have been able to solve this in a local build of pi4j which, rather than assuming all the bytes currently available, depending on the command (e.g. I2CRI, I2CRD) takes packets p3 value as a hint for the content length to expect.
This works for my I2C use cases. I don't have an SPI or serial project on the go at the moment, so have not been able to validate those cases.
The text was updated successfully, but these errors were encountered:
I have come across a similar issue to #16 when using I2C via the GPIO socket implementation over a slow wireless network. I did not observe the problem when running the same code locally on the Pi via the loopback interface.
I observed that any payload was intermittently ignored when requesting multiple bytes over I2C and would be delivered as preamble prior to the next requested packet.
For example, the request for 25 bytes, made over a slow network returns zero bytes:
... the subsequent request then returns the payload:
On the other hand, the same request made via sockets when using the loopback interface returns the data as expected:
The problem appears to stem from PiGpioPacket#decode assuming that all the data for the packet, including the payload, is already available from the socket stream.
I have been able to solve this in a local build of pi4j which, rather than assuming all the bytes currently available, depending on the command (e.g. I2CRI, I2CRD) takes packets p3 value as a hint for the content length to expect.
This works for my I2C use cases. I don't have an SPI or serial project on the go at the moment, so have not been able to validate those cases.
The text was updated successfully, but these errors were encountered: