I have been working with the IOIO board to expose a UART interface to an FPGA in which I exchange ASCII and non-ASCII messages/data between the host and client. I have this interface working just fine on the PC using RXTX and a UART-to-USB converter, but when I move to Android and swap out the UART-to-USB for the IOIO, I run in to some problems.So far I have been able to successfully read and write, with high reliability, all the "ASCII only" messages via the IOIO (where both the data I am reading and writing are all printable characters), but when I move to reading non-ASCII data, issues seem to crop up.
Originally the interface was setup such that I send (from the Android / Java side) a few printable characters and I received back 4096 bytes. I was seeing incomplete data with the 4096 message size, so I started to decrease the size of the return messages thinking I was trying to read back too much data for the IOIO to handle at once. As I decreased the number of bytes sent from the FPGA host to the Android client, I always saw less bytes than were being sent.
Also, if I had the host drop down to sending only 16 bytes, I would never read back a single byte on the Android side. I also tried decreasing my baud rate from 115200 down to 9600 and still saw the same issues. It seems that when these dropouts occur, at some point directly or soon after, I stop being able to receive any more data (so recovery from the drop out is next to impossible). I did at one point increase ioio.lib.impl.Constants.BUFFER_SIZE from 1024 to 8192 which seemed increase the amount of data I could read back, but still I would always read back less than I expected.Has anyone come across a similar issue to this before?Since this does not seem to be related to the amount of data I am sending from the host to the client, my only thought is that somehow the data I am transmitting from the host is getting interpreted by the IOIO board as a control character used by the connection implementation. Does this sound possible at all?
Also not sure if this is relevant or not, but the host I am using, since it is connected to an FPGA, can be expected to be working very very near actual line speed. Not sure if somehow if the host works right at line speed, if this could result in bytes getting missed if the clock on the IOIO is not spot on as well.
For reference, I tried this on a Nexus One, Motorola XT720, and a Samsung Galaxy Tab with all the same outcome. Much of the debug I collected for this was via logcat running on the Android device that I monitored via SSH over wifi (so I was able to see the sequence of everything as it was going on).
Thanks for any help,Brandon Wuest
--
You received this message because you are subscribed to the Google Groups "ioio-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/ioio-users/-/vsSAZWRTvzQJ.
To post to this group, send email to ioio-...@googlegroups.com.
To unsubscribe from this group, send email to ioio-users+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ioio-users?hl=en.
I have been working with the IOIO board to expose a UART interface to an FPGA in which I exchange ASCII and non-ASCII messages/data between the host and client. I have this interface working just fine on the PC using RXTX and a UART-to-USB converter, but when I move to Android and swap out the UART-to-USB for the IOIO, I run in to some problems.So far I have been able to successfully read and write, with high reliability, all the "ASCII only" messages via the IOIO (where both the data I am reading and writing are all printable characters), but when I move to reading non-ASCII data, issues seem to crop up.I really can't imagine what can be different between ASCII and non-ASCII. There's nowhere in the code where some characters are treated differently than others. Can this be related to your code in some way? How do you print the data? Are you aware that the byte type in Java is signed?
Originally the interface was setup such that I send (from the Android / Java side) a few printable characters and I received back 4096 bytes. I was seeing incomplete data with the 4096 message size, so I started to decrease the size of the return messages thinking I was trying to read back too much data for the IOIO to handle at once. As I decreased the number of bytes sent from the FPGA host to the Android client, I always saw less bytes than were being sent.With a loopback I sent megabytes on data as fast as possible without loss. There should not be any problem, and particularly in low baud rates. Does your code that does the reading read fast enough (i.e. have a dedicated thread that does a tight read() loop)?
Also, if I had the host drop down to sending only 16 bytes, I would never read back a single byte on the Android side. I also tried decreasing my baud rate from 115200 down to 9600 and still saw the same issues. It seems that when these dropouts occur, at some point directly or soon after, I stop being able to receive any more data (so recovery from the drop out is next to impossible). I did at one point increase ioio.lib.impl.Constants.BUFFER_SIZE from 1024 to 8192 which seemed increase the amount of data I could read back, but still I would always read back less than I expected.Has anyone come across a similar issue to this before?Since this does not seem to be related to the amount of data I am sending from the host to the client, my only thought is that somehow the data I am transmitting from the host is getting interpreted by the IOIO board as a control character used by the connection implementation. Does this sound possible at all?Not intentionally at least. Maybe there's a nasty bug hidden somewhere. Did you verify the stop bit and parity settings? Is it possible that the FPGA outputs open-drain and you haven't used a pull-up on your RX? (sorry, just shooting in the dark here with some possible causes for corruption - the IOIO currently silently discards frame-error bytes).
Also not sure if this is relevant or not, but the host I am using, since it is connected to an FPGA, can be expected to be working very very near actual line speed. Not sure if somehow if the host works right at line speed, if this could result in bytes getting missed if the clock on the IOIO is not spot on as well.There should be some permissible slack there.For reference, I tried this on a Nexus One, Motorola XT720, and a Samsung Galaxy Tab with all the same outcome. Much of the debug I collected for this was via logcat running on the Android device that I monitored via SSH over wifi (so I was able to see the sequence of everything as it was going on).That sounds really interesting! Do you need to root the device for running sshd? Do you need to install it yourself, or does it come with the stock OS?
Can you try to reproduce your problem with a loopback, and then sends a simple-as-possible program that reproduces it? I can then have a look.
Nope. No such thing.
Can you check your IOIO against the USB-uart to eliminate the possibility of FPGA weirdness?