Android Question IOIO Stream has been closed

rosippc64a

Active Member
Licensed User
Longtime User
Hi Guys,
I read a lof of articles about this problem, but there wasn't answer what would be good for me.
I use a diy ioio with a serially connected rfid reader. I use a home made b4a (b4x.com) program. Te rfid reader reads 13bytes in each 5 seconds, repeatedly.
When I use this with android 4.2, and ADB (usb debugger on), IOIO 1.4 and IOIOib, it works fine. When I use it with android 4.4 or 5.01 (both tested), IOIO 2.05 lib, open accessory, usb debugger off, then after 10-20 readings the same program hangs with 'Stream has benn closed'. I verified, the rfid reader reads further and sends its signal, but the stream is closed... I don't close this stream anywhere, and I can't figure out what is the reason of this error. The ioio firmware is the latest of course.
I don't thought somebody will say which row of source program is faulty, just a question if someone met such a problem: it is a hardware or software issue ?
best regards
Steve
 

ecastelli201

Member
Licensed User
Longtime User
Thread is closed with success. I made a my own library (thanks Kolbe) where these streams is situated in this, not in b4a program. From this there is no such an error.
Hi,
I have your same problem with UART, but not only: also toggling LED ON/OFF with a timer, after a "number" of cycles the execution stops showing an "EBADF (bad file number) write" error.
I tried slowing the timer, making a service, but results are near the same.
I think there is a timing problem (not a memory or buffersize problem) anywhere in the lib.
How did you solve ?
Thank you,
enrico
 
Upvote 0

rosippc64a

Active Member
Licensed User
Longtime User
Hi,
in the original approach the streams was manage in the b4a level. There had to declare and manage them. Im my solution this is in my java library and I did such a methods what do their task in it.
Since then I have no problem with it.
Steven
 
Upvote 0

ecastelli201

Member
Licensed User
Longtime User
Hi,
in the original approach the streams was manage in the b4a level. There had to declare and manage them. Im my solution this is in my java library and I did such a methods what do their task in it.
Since then I have no problem with it.
Steven
I am working with AndroidStudio to do your same work, but is my first time with Java and my head is burning. I succeed in TX and RX with UART, in Input and output with digital pins, but I have to convert my work in a Lib.
May you help me ?
enrico
 
Upvote 0

rosippc64a

Active Member
Licensed User
Longtime User
Hi Enrico,
yes I can help you. This lib was also my first work, I felt the same. But: I work with eclipse because for me the android studio is much more complicated and I read here more help about eclipse than AS. What kind of help do you need? I can give you my whole source code too, if you would.
Steven
 
Upvote 0

ecastelli201

Member
Licensed User
Longtime User
Hi Enrico,
yes I can help you. This lib was also my first work, I felt the same. But: I work with eclipse because for me the android studio is much more complicated and I read here more help about eclipse than AS. What kind of help do you need? I can give you my whole source code too, if you would.
Steven
Thank You,
I have also eclipse and if you want to send me your working code I will study it.
enrico
 
Upvote 0

rosippc64a

Active Member
Licensed User
Longtime User
Hi Enrico,
here is my source. this isn't a zip, I had to rename my .java file to upload
Steven
 

Attachments

  • MyIOIO.zip
    22.2 KB · Views: 218
Upvote 0

ecastelli201

Member
Licensed User
Longtime User
Thank You !
Now I download and study.
OK for Accessory and debug.
Hi Steven,
hardly I succeeded in importing your code in Eclipse (I never used it since yesterday) and generating a .Jar and .xml file.
Then I put these 2 files into Library folder of B4A and I wrote a two lines code in B4A after flagging the new library:

Dim IOIO as myIOIO
and
IOIO connect("IOIOconn")

Compilation OK, installation on device OK.
Running the app, device shows: "unfortunately B4AExample has stopped"
Error is caused by "connect": if I only instantiate the libray, nothing happens.
Have I to write something in Manifest and/or to place files somewhere in the project ?

Thank you again,
enrico
 
Upvote 0

rosippc64a

Active Member
Licensed User
Longtime User
Hi Enrico,
this source was only to study. There is missing a big part from this, the ioio lib part what I copy from official ioio lib. I don't know what size of attachment I can upload, but if you send an email to here: rostasc3 at gmail dot com, I will send the whole eclipse project.
Steven
 
Upvote 0

ecastelli201

Member
Licensed User
Longtime User
Hi Enrico,
this source was only to study. There is missing a big part from this, the ioio lib part what I copy from official ioio lib. I don't know what size of attachment I can upload, but if you send an email to here: rostasc3 at gmail dot com, I will send the whole eclipse project.
Steven
OOOhhh,
finally I have a working lib: now UART reads and writes without any problem: I shorted RX and TX pins and with a 100 ms timer I send a string with "SHOTS" count.
Now shots are about 50000 and it continues to work.
Than I made two new methtods: to set and reset a digital output and to read a digital input. (during UART activity)
No problem.
Thank you again, Steven.
enrico
 
Upvote 0

lecoeur

New Member
Licensed User
Longtime User
Hi Enrico,
this source was only to study. There is missing a big part from this, the ioio lib part what I copy from official ioio lib. I don't know what size of attachment I can upload, but if you send an email to here: rostasc3 at gmail dot com, I will send the whole eclipse project.
Steven
dear All i have th esame problem, is it possible to send me the new library . Many thanks by advance
Jean-Marc My email :[email protected]
 
Upvote 0
Top