Search code examples
androidarduinousbusb-otgbaud-rate

Is it possible to achieve USB baud rate bigger than 115200 baud on Android?


I am building an Android app that communicates via USB OTG with an Arduino Nano. I'm trying to send data from the Arduino to my phone. My app uses this library. At baud rates <= 115200 Baud it works properly, but if I set the rate for example 230400 Baud, the UsbSerialPort throws an IOException, saying that "Baud rate 230400 currently not supported". However, between the Arduino and the computer, baud rates works up to 2 MBaud with the same Arduino sketch. My question is: Is there any way to reach higher baud rate than 115200 Baud?


Solution

  • Yes you can achieve USB baud rate bigger than 115200, these are the supported values:

                case 300:
                    baudrate=0x2710;
                    break;
                case 600:
                    baudrate=0x1388;
                    break;
                case 1200:
                    baudrate=0x09C4;
                    break;
                case 2400:
                    baudrate=0x0271;
                    break;
                case 4800:
                    baudrate=0x4138;
                    break;
                case 9600:
                    baudrate=0x4138;
                    break;
                case 19200:
                    baudrate=0x809C;
                    break;
                case 38400:
                    baudrate=0xC04E;
                    break;
                case 57600:
                    baudrate=0x0034;
                    break;
                case 115200:
                    baudrate=0x001A;
                    break;
                case 460800:
                    baudrate=0x4006;
                    break;
                case 921600: