I would probe both UART channels with an independent source (either
different UARTs on the IOIO on different threads, or logic analyzer or
USB-serial cable, etc.) and verify that the protocol is correct.
Also, it is possible that some of your timeouts are overly aggressive, so
at least until you get everything working and know what to expect I would
make them very liberal.

On Thu, Mar 26, 2015 at 11:55 AM, Marouane M <marouan...@gmail.com> wrote:

> Hi,
>
> I'm trying to get an image from ucamII using a ioio UART connection.
>
> here is the doc of the ucamII:
> http://www.robotshop.com/media/files/pdf/datasheet-ucam-ii.pdf
>
> What I'm tying todo is Presented in section 7.4 page 16/22 of the pdf
> but I want to Get a JPEG picture with 640*480
>
> In the UARTController.java you have the code that i use like presented
> here after:
>
> The problem is that I always have the message:
> UART Read PICTACK OK
> UART Read TimeoutException
> UART Read Get Image Size FAILED
>
> I do not know if i should read differently:
> for exemple wait some bytes to start the read like I do in waitReference.
> or should i set the baudrate and not use the automatic detection.
>
> If you have a proposition I will try it.
>
> THANKS IN Advance
> ==============================================
>
> // this is just For Logging
>    class CamController extends UARTController {
>         @Override
>         public void log(String msg) {
>             final String theMsg = msg;
>             runOnUiThread(new Runnable() {
>                 @Override
>                 public void run() {
>                     textLogger_.append(theMsg);
>                     scrollTextLogger_.fullScroll(ScrollView.FOCUS_DOWN);
>                 }
>             });
>         }
>     }
>
>
> // at setup
>             camIoioRxPIN30 = 30;
>             camIoioTxPIN29 = 29;
>             Integer baud = 115200; // 115200; // after that try: ucamII
> autodetect 921600 or set 3686400;
>             CamController camCom = new CamController();
>             camCom.connect(ioio_, camIoioRxPIN30, camIoioTxPIN29, baud);
>             boolean syncOK = camCom.camSYNC();
>             if (syncOK) {
>                 boolean initOK = camCom.camINITJPEG();
>                 if (initOK) {
>                     boolean setPKGSizeOK = camCom.camSetPKGSize();
>                     if (setPKGSizeOK) {
>                         final byte[] data = camCom.camGetFrame();
>                         if (data.length != 0) {
>                             this.logOnUI("GET FRAME OK\n");
>                             runOnUiThread(new Runnable() {
>                                 @Override
>                                 public void run() {
>                                     // VideoView
>                                     //Bitmap bitmap =
> BitmapFactory.decodeByteArray(data, 0, dataSize);
>
> //videoViewCam_.setImageBitmap(bitmap);
>                                     
> //textLogger_.append("bitmap.getByteCount()
> => " + bitmap.getByteCount() + "\n");
>                                     //textLogger_.append("bitmap.getHeight()
> => " + bitmap.getHeight() + "\n");
>                                     //textLogger_.append("bitmap.getWidth()
> => " + bitmap.getWidth() + "\n");
>                                     textLogger_.append("data.length => " +
> data.length + "\n");
>                                 }
>                             });
>                         }
>
>
>                     }
>                 }
>             }
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "ioio-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ioio-users+unsubscr...@googlegroups.com.
> To post to this group, send email to ioio-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/ioio-users.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"ioio-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ioio-users+unsubscr...@googlegroups.com.
To post to this group, send email to ioio-users@googlegroups.com.
Visit this group at http://groups.google.com/group/ioio-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to