IOIO gives wrong data from UART

39 views
Skip to first unread message

Bobi Zrncev

unread,
Jan 21, 2017, 4:22:31 PM1/21/17
to ioio-users
Hi,

I am trying to connect IOIO to a GSM modem with UART. If I connect it to PC it gives the output "10 a1 02 00 00 5d 10 03" every 10 seconds. I managed to connect it to the IOIO but it gives the output "d7 d9 ff ff 45 df f9" every 10 seconds. What can be problem?

I connect to uart using: uart = ioio_.openUart(3, 4, 9600, Uart.Parity.NONE, Uart.StopBits.ONE);

public void loop() throws ConnectionLostException, InterruptedException {
    try {
        int availableBytes = in.available();

        if (availableBytes > 0) {
            try {
                Log.d("UART", "Received is " + in.read());
            }catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}

Best regards,
BZ

Ytai Ben-Tsvi

unread,
Jan 22, 2017, 12:27:17 AM1/22/17
to ioio-...@googlegroups.com
This smells like an electrical problem. What are the electrical specs of the modem? How exactly are you connecting it to the IOIO?

As an aside, your loop() doesn't block (i.e. spin-loops) whenever there is no data in the UART, which is a very bad practice (maxes out CPU, drains battery). You probably want to simply remove the "if" which would result on it blocking on the read() as much as needed.

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to ioio-...@googlegroups.com.
Visit this group at https://groups.google.com/group/ioio-users.
For more options, visit https://groups.google.com/d/optout.

Kevin Miller

unread,
Feb 1, 2017, 4:23:25 PM2/1/17
to ioio-users

Hi BZ,
What PC interface/software are you using to read the data and display the "d7 d9 ff ff 45 df f9" output? Is it consistent? If so, it looks to me to be a settings error - baud rate, stop bits, etc. Did you verify the PC interface/software with a known good UART? Does your Interface support 3.3V? Since you are sending 8 bytes but only 7 bytes are displayed, my money's on the baud rate.

Hope it helps,
Kevin
Reply all
Reply to author
Forward
0 new messages