XU4 - Usart Max Baud rate?

Moderators: mdrjr, odroid

XU4 - Usart Max Baud rate?

Unread postby KurtE » Sat Feb 06, 2016 6:06 am

I have been experimenting with an ODroid C1 talking to a PJRC Teensy 3.2 through a serial port instead of USB. Currently doing it with the Serial port set to 2mbs, probably can go higher.

But what I really want to use is the ODroid XU4. So I was wondering what is the maximum baud rate you can set for the USART that is on the expansion connector. So far I have not found a spec showing this.

Also the Teensy 3.2 (and the Arbotix Pro) are 3.3v devices, so I know I need to do voltage level conversion. I have seen some topics with conversion board schematics, like: viewtopic.php?f=53&t=4758&p

I can wire up my own, but I would be nice if I could simply use one of the commercial boards. My guess is that some of the boards are probably too slow for this, but maybe the TXB0104 board from Adafruit? I am assuming the old Sparkfun board with voltage divider for one direction could be used as they are using 10K/20K resistors, so 3.3v would convert to 2.2v, which I am assuming is too high for Odroid?

Thanks
Kurt
KurtE
 
Posts: 220
Joined: Wed Jun 19, 2013 9:39 am
languages_spoken: english

Re: XU4 - Usart Max Baud rate?

Unread postby mdrjr » Sat Feb 06, 2016 11:00 am

Voltage should be 1.8V +/- 5%

Consider using our shifter shield.
mdrjr
Site Admin
 
Posts: 11640
Joined: Fri Feb 22, 2013 11:34 pm
Location: Brazil
languages_spoken: english, portuguese
ODROIDs: -

Re: XU4 - Usart Max Baud rate?

Unread postby KurtE » Sat Feb 06, 2016 11:13 pm

Thanks mdrjr,

I do have one of your level shifters I can try out, but it is pretty large, so won't for example fit on the HROS1 robot. Might work with PhantomX, but not where I currently have Odroid installed. I believe the shifter is based on the TXS0108 chip, I do have some TXB0104/0108 adapters from Adafruit and Sparkfun that I will try out.

Any spec on what the valid baud rates are for the Usart?
KurtE
 
Posts: 220
Joined: Wed Jun 19, 2013 9:39 am
languages_spoken: english

Re: XU4 - Usart Max Baud rate?

Unread postby mdrjr » Sun Feb 07, 2016 12:45 am

What speed you need?
I don't know the speed limit of our UART. I personally never tested over 115200.
But it should be able to higher..
mdrjr
Site Admin
 
Posts: 11640
Joined: Fri Feb 22, 2013 11:34 pm
Location: Brazil
languages_spoken: english, portuguese
ODROIDs: -

Re: XU4 - Usart Max Baud rate?

Unread postby KurtE » Sun Feb 07, 2016 12:50 am

So far with the C1 talking to Teensy 3.2, I have tried 2mbs, which works. I may try higher as I believe the USART on Teensy can go to 3.375mbs, when I switch to testing with Arbotix Pro, I believe the maximum is 2.25mbs.
KurtE
 
Posts: 220
Joined: Wed Jun 19, 2013 9:39 am
languages_spoken: english

Re: XU4 - Usart Max Baud rate?

Unread postby odroid » Sun Feb 07, 2016 1:28 pm

The maximum baudrate on the XU4 UART is only 921600bps.
User avatar
odroid
Site Admin
 
Posts: 25293
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: XU4 - Usart Max Baud rate?

Unread postby KurtE » Mon Feb 08, 2016 12:59 am

odroid wrote:The maximum baudrate on the XU4 UART is only 921600bps.

Thanks, I am hoping you are wrong as would like at minimum 1mbs, maybe 2... or ...

Also I am somewhat hopeful,
Code: Select all
   memset(&newtio, 0, sizeof(newtio));
    // First try to set the baud rate directly.
   newtio.c_cflag      = B1000000|CS8|CLOCAL|CREAD;
   newtio.c_iflag      = IGNPAR;
   newtio.c_oflag      = 0;
   newtio.c_lflag      = 0;
   newtio.c_cc[VTIME]   = 0;   // time-out ? (TIME * 0.1?) 0 : disable
   newtio.c_cc[VMIN]   = 0;   // MIN ? read ? return ?? ?? ?? ?? ??

   tcflush(gSocket_fd, TCIFLUSH);
   
   if (tcsetattr(gSocket_fd, TCSANOW, &newtio) < 0) {
        printf("tcsetattr 1000000 failed try indirect %d\n\r", errno);

        // Try doing it indirect by setting to 38400 and
        // see if the USB driver supports setting non-standard
                // Try back at 38400 and setting attribute...
        newtio.c_cflag      = B38400|CS8|CLOCAL|CREAD;
        if (tcsetattr(gSocket_fd, TCSANOW, &newtio) < 0) {
            printf("tcsetattr failed %d\n\r", errno);
            goto DXL_HAL_OPEN_ERROR;
        }   
       
        // Get the settings...
        if (ioctl(gSocket_fd, TIOCGSERIAL, &serinfo) < 0) {
            printf("TIOCGSERIAL failed %d\n\r", errno);
            goto DXL_HAL_OPEN_ERROR;
        }
       
        serinfo.flags &= ~ASYNC_SPD_MASK;
        serinfo.flags |= ASYNC_SPD_CUST;
        serinfo.custom_divisor = serinfo.baud_base / baudrate;
           
        if(ioctl(gSocket_fd, TIOCSSERIAL, &serinfo) < 0) {
            printf("TIOCSSERIAL failed %d\n\r", errno);
            goto DXL_HAL_OPEN_ERROR;
        }   
    }

The above code is in extract from one of my projects, where it tries to set the baud rate and the like for the serial object... I have code in it to hopefully work with FTDI (/dev/ttyUSB0) when talking to Arbotix-pro), or ACM (/dev/ttyACM0) for Teensy 3.2 or USB2AX, plus I have an override that first looks for /dev/ttyDXL which I use here to test.

So I tried it on my XU4, where I setup a link...
Before I ran program:
Code: Select all
odroid@odroid-XU4:~/Raspberry_pi/AX12_Test$ stty -F /dev/ttySAC0 -a
speed 9600 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;
werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff
-iuclc -ixany -imaxbel -iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke


After I ran it:
Code: Select all
speed 1000000 baud; rows 0; columns 0; line = 0;
intr = <undef>; quit = <undef>; erase = <undef>; kill = <undef>; eof = <undef>;
eol = <undef>; eol2 = <undef>; swtch = <undef>; start = <undef>; stop = <undef>;
susp = <undef>; rprnt = <undef>; werase = <undef>; lnext = <undef>;
flush = <undef>; min = 0; time = 0;
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread clocal -crtscts
-ignbrk -brkint ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff
-iuclc -ixany -imaxbel -iutf8
-opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
-isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop -echoprt
-echoctl -echoke


I edited my program (actually library code) and changed:
Code: Select all
newtio.c_cflag      = B1000000|CS8|CLOCAL|CREAD;

to:
Code: Select all
newtio.c_cflag      = B2000000|CS8|CLOCAL|CREAD;

And ran the program again:
Code: Select all
odroid@odroid-XU4:~/Raspberry_pi/AX12_Test$ stty -F /dev/ttyDXL -a
speed 2000000 baud; rows 0; columns 0; line = 0;
intr = <undef>; quit = <undef>; erase = <undef>; kill = <undef>; eof = <undef>;
eol = <undef>; eol2 = <undef>; swtch = <undef>; start = <undef>; stop = <undef>;
susp = <undef>; rprnt = <undef>; werase = <undef>; lnext = <undef>;
flush = <undef>; min = 0; time = 0;
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread clocal -crtscts
-ignbrk -brkint ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff
-iuclc -ixany -imaxbel -iutf8
-opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
-isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop -echoprt
-echoctl -echoke
odroid@odroid-XU4:~/Raspberry_pi/AX12_Test$ ls -l /dev/ttyDXL
lrwxrwxrwx 1 root root 12 Feb  7 07:32 /dev/ttyDXL -> /dev/ttySAC0


I have not yet actually tested the signals, by either trying to connect it to other board as I have not hooked up TTL Level translators or to Logic Analyzer as right now the pins are a bit hard to get to :lol:
HROS1-with-Odroid-XU4.jpg
(76.8 KiB) Downloaded 823 times
KurtE
 
Posts: 220
Joined: Wed Jun 19, 2013 9:39 am
languages_spoken: english

Re: XU4 - Usart Max Baud rate?

Unread postby odroid » Tue Feb 09, 2016 9:47 am

Nice humanoid robot. :o

Please check the real baud-rate with an oscilloscope at 1Mbps or 2Mbps on the ttySAC0.
User avatar
odroid
Site Admin
 
Posts: 25293
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: XU4 - Usart Max Baud rate?

Unread postby KurtE » Wed Feb 10, 2016 2:01 am

Thanks, Robot is Trossen Robotics HR-OS1.

So far I am not having luck getting any signal out of the usart... Maybe my jumper wires are on the wrong pins:
DSC03901.jpg
(40.63 KiB) Downloaded 797 times


May need to pull robot apart and/or wait until I order 2nd XU4 (doing trade in with AmericanDroid right now...) Also maybe wrong /dev/tty* device? Or maybe my older Saleae 16 Logic Analyzer is not working at the 1.8v level, although I believe I have it configured for it...

Also was not sure if potentially the IO pin MUX needs to change to work with Usart? But I think the gpio command may imply it is OK?
Code: Select all
odroid@odroid-XU4:~/wiringPi$ gpio readall
 +------+-----+----------+------ Model ODROID-XU3/4 ------+----------+-----+------+
 | GPIO | wPi |   Name   | Mode | V | Physical | V | Mode |   Name   | wPi | GPIO |
 +------+-----+----------+------+---+----++----+---+------+----------+-----+------+
 |      |     |     3.3v |      |   |  1 || 2  |   |      | 5v       |     |      |
 |  209 |   8 | I2C1.SDA | ALT5 | 1 |  3 || 4  |   |      | 5V       |     |      |
 |  210 |   9 | I2C1.SCL | ALT5 | 1 |  5 || 6  |   |      | 0v       |     |      |
 |   18 |   7 | GPIO. 18 |   IN | 0 |  7 || 8  | 1 | ALT5 | UART0.TX | 15  |  172 |
 |      |     |       0v |      |   |  9 || 10 | 0 | ALT5 | UART0.RX | 16  |  171 |
 |  174 |   0 | GPIO.174 | ALT5 | 1 | 11 || 12 | 0 | ALT5 | GPIO.173 | 1   |  173 |
 |   21 |   2 | GPIO. 21 |   IN | 0 | 13 || 14 |   |      | 0v       |     |      |
 |   22 |   3 | GPIO. 22 |   IN | 0 | 15 || 16 | 0 | IN   | GPIO. 19 | 4   |  19  |
 |      |     |     3.3v |      |   | 17 || 18 | 0 | IN   | GPIO. 23 | 5   |  23  |
 |  192 |  12 |     MOSI | ALT5 | 1 | 19 || 20 |   |      | 0v       |     |      |
 |  191 |  13 |     MISO | ALT5 | 1 | 21 || 22 | 0 | IN   | GPIO. 24 | 6   |  24  |
 |  189 |  14 |     SCLK | ALT5 | 0 | 23 || 24 | 0 | IN   | CE0      | 10  |  190 |
 |      |     |       0v |      |   | 25 || 26 | 0 | IN   | GPIO.190 | 11  |  25  |
 |  187 |  30 | I2C5.SDA | ALT5 | 1 | 27 || 28 | 1 | ALT5 | I2C5.SCL | 31  |  188 |
 |   28 |  21 | GPIO. 28 |   IN | 0 | 29 || 30 |   |      | 0v       |     |      |
 |   30 |  22 | GPIO. 30 |   IN | 0 | 31 || 32 | 0 | IN   | GPIO. 29 | 26  |  29  |
 |   31 |  23 | GPIO. 31 |   IN | 0 | 33 || 34 |   |      | 0v       |     |      |
 |      |     | POWER ON | ALT5 | 0 | 35 || 36 | 0 | IN   | GPIO. 33 | 27  |  33  |
 |      |     |    AIN.0 | ALT5 | 0 | 37 || 38 | 0 | ALT5 | 1v8      |     |      |
 |      |     |       0v |      |   | 39 || 40 | 0 | ALT5 | AIN.3    |     |      |
 +------+-----+----------+------+---+----++----+---+------+----------+-----+------+

Running Ubuntu 15.04 and have done sudo apt-get update as well as upgrade...

Will get back to this later today or hopefully.
KurtE
 
Posts: 220
Joined: Wed Jun 19, 2013 9:39 am
languages_spoken: english

Re: XU4 - Usart Max Baud rate?

Unread postby KurtE » Wed Feb 10, 2016 4:23 am

Quick update:
I pulled two legs off of my Trossen PhantomX hexapod and pulled out the XU3-lite, updated my code on it, plus used the Adafruit jumpers to connect to the small pins (like I did on XU4), hooked up LA to it (again the older 16) and then ran my code, this time it is showing stuff being output over the USART. Here is 1mbs.
LA-XU3l-Usart1mbs.jpg
(25.19 KiB) Downloaded 792 times


Then hacked the init code to see about 2mbs...
LA-XU3l-Usart2mbs.jpg
(22.09 KiB) Downloaded 792 times


So for the heck of it I tried 3mbs (could maybe work with my Teensy 3.2, but not Arbotix Pro, whose max baud is 2.25)
LA-XU3l-Usart3mbs.jpg
(27.61 KiB) Downloaded 792 times


I assume that XU3-lite and Xu4 should be compatible with each other here?

Next up may be to see what this does through a ttl level converter to 3.3v and see if it will talk to arbotix Pro. (starting at 1mbs)

Note: Xu4 is running ubuntu 14.04

Kurt
KurtE
 
Posts: 220
Joined: Wed Jun 19, 2013 9:39 am
languages_spoken: english

Re: XU4 - Usart Max Baud rate?

Unread postby odroid » Thu Feb 11, 2016 9:29 am

Thank you for the measurement.
1~2Mbps seems to be working well. :o

Yes, XU3-lite and XU4 are compatible.
User avatar
odroid
Site Admin
 
Posts: 25293
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID


Return to Hardware and peripherals

Who is online

Users browsing this forum: No registered users and 3 guests