iMX233 + Arch Linux 3.10 + lighttpd + gpio + UART support ?

Started by Rolf L., February 12, 2014, 03:10:13 PM

Previous topic - Next topic

Rolf L.

Hi folks,

First of all: I'm no expert in Linux, Java and so on. I'm 70 years old, living in south west Germany and I have 50 years of experience in the development of electronics hardware.

Since some months I'm using an iMX233-OLinuXino-MAXI-board as a stand alone webserver running Arch Linux 3.10. and lighttpd. See also: https://wiki.archlinux.org/index.php/lighttpd

Additionally I still have installed mod_fastcgi, php, php-cgi and web-io with gpio, which allows access to the various interfaces of this nice board. An older description of the installation can be found here:
http://olimex.wordpress.com/2012/11/02/running-web-server-with-php-on-imx233-olinuxino-maxi-and-controlling-gpios-from-web/
For autostarting lighttpd I used systemd instead of the old rc.d. which is no longer supported by Arch Linux.

After some weeks with much software trouble (older versions of Arch Linux) all is running fine, but now I have the following problem:
I have connected a MAX3485 RS485 level converter on UEXT pin3 (TxD of UART) + pin4 (RxD opf UART). For transmit-receive switching of MAX3485-RE/DE-pin I use pin7 (MISO). Via this UART-port I would like to read and write text strings from and to several external devices via RS485.

Question:
Java in connection with lighttpd and gpio does not seem supporting the serial port and even not RS485.
Somebody has an idea how I could achieve this with html code and/or java sript?

Any response is welcome ;D

Kean

Rolf,

Can I suggest an easier solution?  Use an FTDI (e.g. FT232RL) chip to interface the MAX3485.  The FTDI chip has a TXDEN# output on CBUS2 pin (default) which can drive the MAX3485 driver enable pin.  When plugged into the Maxi, you will get a /dev/ttyUSB0 device which you can then open from any application.

Another option is to use something like a 555 timer to generate the TXDEN# signal for a fixed time, and triggered by the TXD pulses.

Either way, you then just need to be careful about using a half duplex protocol.

The problem with using a GPIO is that it must be controlled at a very low level, as there is no user-space (application software) way to quickly detect when the UART transmit buffer is actually empty, and I'm not sure it is implemented in the kernel driver for the iMX serial ports.

HTH,
Kean

Rolf L.

Hi Kean,

thank you very much for your fast answer.
The use of an USB-RS232-converter is a good idea, but requires additional hardware, what I really wanted to avoid. What surprises me: while there are lots of Olimex-modules for the UEXT-port but no software support for the use of the UART1 under Arch Linux and Java. Anyway, I've found no useful.

The principal problem with the programming of serial interfaces and RS485-ports is known to me. I have programmed various atmega-processors with the help of a bascom-compiler. Unfortunately I have no tools and too little knowledge to write a driver for the iMX233-UART1. I hope someone has already developed such a driver and puts it here for disposal.  :)

dave-at-axon

I've been looking at this myself when adding RS485 to the A20 via a custom interface board.

Maxim do an automatic TX enable device but it is 5V operation only. This is not an issue for me with the custom board as I can use the 5V from the GPIO connector and I then have level shifting to handle the 3.3 to 5V, but I was considering this for a UEXT module but the lack of 5V on that connector means it won't work.

It looks like the isolated UEXT RS485 module takes care of the TX enable so maybe that would be an option. A bit more expensive, but certainly easier than a custom design.