RS232 Communication (Android)


#1

I need to communicate with an external RS-232 device. I will be working with Android on the Dragonboard 410c.

(1) What is the general hardware connection approach?
I thought I might be able to use the built-in UART with a MAX3232 based board to level-shift from DragonBoard -> 5V RS-232 like these:


https://www.sparkfun.com/products/11189q
I don’t believe these products will work at the 1.8V voltage level of the DragonBoard though. Would it make more sense to use a USB<->RS-232 dongle? Would there be driver problems getting that to work with Android? Any alternate approach?

(2) UART in Android
What is the general software approach to sending/receiving serial messages in Android? Does anyone have sample code?

Thanks!


#2
  1. Your second link is broken because you added an extra ‘q’. You’re correct. Neither of those will work by themselves. You need a level shifter for 1.8V to a higher voltage. Or a better RS232 converter.

  2. Read the Peripherals Programming Guide. You use shell commands like echo 0x45 > /dev/ttyHS0. Good luck changing the baud rate–that’s not documented yet.


#3

Hi HannaBanana: I just went through the same exercise this week, so I happen to know the answer for the hardware half of your problem. You are correct the MAX232 boards need a 5V level signal, so you first need to shift the 1.8V signal up to 5V levels. I used this board https://www.sparkfun.com/products/11955 . My system only needed data going from the 410c to the device, so I have only tested the level shifter in the Tx direction, although I have no reason to believe that the Rx won’t work. Once you get the IOs from the 410c up to 5V levels you can then drive the MAX232 board.

The other half of your problem is getting the uart0 port enabled. On Linux this required some changes to the kernel and the device tree to enable the port (I think this should have been the default in the released kernel, but it isn’t). I tried building the new kernel on the 410c but for some reason it can’t start the GPU. When I built the kernel on a x86 Linux box it worked.

I am not sure if uart0 is enabled in Android or not. I’ll leave the remained of the software part of your challenge to someone more with more knowledge than myself.


#4

As long as your RS232 device does not require any connections besides RX and TX, you can go via the uart. Otherwise, USB-to-RS232 connectors are your friend.


#5

Thanks @all, does anyone know anything about Android compatibility of USB-to-RS232 connectors? Any advantage of FTDI chip vs Prolific for compatibility?

Examples:




#6

Both brands are equal. Both supported by the kernel, but neither is enabled. You will have to build the modules or rebuild the kernel. I read something about android userspace drivers but have no experience with them.