OpenWrt Forum Archive

Topic: Add external UART (RS232) port to free GPIOs

The content of this topic has been archived on 31 Mar 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hello!

Anybody can tell me if it's possible to solder some external UART chip to GPIOs for adding support additional RS232 port to device?

Thanks!

-Alex

If you've got one of the router types that are supported by the MMC-card hack, it should be possible to use the SSI-code from brainslayer's MMC-kernel module. You'd have to find an UART with SSI (a microcontroller with SSI and UART would be OK), and you'd have to write quite some code for a rather unique hardware modification...

Timo Beil wrote:

If you've got one of the router types that are supported by the MMC-card hack, it should be possible to use the SSI-code from brainslayer's MMC-kernel module. You'd have to find an UART with SSI (a microcontroller with SSI and UART would be OK), and you'd have to write quite some code for a rather unique hardware modification...

Hmm... I thought that MMC driver uses SPI mode for acces.
Yes, my device has 11 free GPIOs and I'm already finished SD/MMC driver port for it.
Now, I'd like to add additional UART port and use for it minimum GPIOs.

It will be great if you'd tell me some types and manufacturers of UART microcontrollers.

Thanks!

-Alex

You'll find tools for AVR controllers here: http://winavr.sourceforge.net/links.html

The uart device you selected looks good - especially because it behaves like a 16550. If you can get it, it would save you the effort of programming a micro controller.

/T

I have never used and programm microcontrollers, so I'd like to make maximum simple UART mod and use for it minimum GPIOs.

It looks like Exar ST16C1551 needs to use too much GPIOs for work... sad

Maybe it's possible to make more simple UART through GPIOs?

Thanks!

-Alex

The problem is that you need a fixed time base for sending or receiving UART data (there is no clock signal, so the CPU has to poll a port pin or toggle a port pin in fixed time intervals). With so called "bit banging" UART code for microcontrollers /without/ UART on chip, the CPU often can't do anything else while performing UART transfers. You might find a solution for the time base problem by using a timer interrupt. However, attaching a micro controller with SPI and UART would be a more obvious solution.

So, if I'll use microcontroller with SSI (SPI) and UART can I connect it with minimal number of GPIOs?
And how much GPIOs it's minimum needed?

Also I'd like to ask you if it's possible to add USB host support using some of USB host controllers on GPIOs?

Thanks!

-Alex

?????? Alex,

you'd need 4 GPIO pins (SI, SO, SCK and /CS). The first 3 pins are can be used as a bus. The /CS signal  also can be created by using a de-multiplexer (e.g. 3 pins can be used to select 1 out of 7 devices).
http://www.atmel.com/dyn/resources/prod … oc2455.pdf shows an example.

A question from my side: which router hardware are you using? How did you identify the available GPIO pins?
Due to some incomprehensible policy of broadcom, I don't have neither the schematics of the broadcom reference design nor the data sheet of a member of the BCM47xx family...

?? ????????
/T

Timo Beil wrote:

?????? Alex,

you'd need 4 GPIO pins (SI, SO, SCK and /CS). The first 3 pins are can be used as a bus. The /CS signal  also can be created by using a de-multiplexer (e.g. 3 pins can be used to select 1 out of 7 devices).
http://www.atmel.com/dyn/resources/prod … oc2455.pdf shows an example.

Good example, thanks!
It looks like I can use the same 3 GPIOs, which are shares with SD/MMC, for additional 6 devices. Isn't it?

A question from my side: which router hardware are you using? How did you identify the available GPIO pins?
Due to some incomprehensible policy of broadcom, I don't have neither the schematics of the broadcom reference design nor the data sheet of a member of the BCM47xx family...

?? ????????
/T

I've use D-Link DWL-G700AP based on Realtek RTL8186 MIPS R3000 SoC.

As I'm already said,- I've port SD/MMC driver for rtl8186 and you can see how I have work with GPIOs: http://rtl8186.sourceforge.net/SD_driver/mmc.tar.gz

PS: Do you speak Russian? wink

Right, you can use the SI/SO/SK you already use for the MMC to connect more devices, as long as you always finish a transfer to one device, before you select the next device. Using a general SPI layer that manages access to several devices looks like a good option. The possibility to connect devices like microcontrollers, a CAN-interface, or even a USB-controller sounds interesting.

The choice of a demultiplexer isn't difficult (like http://pdf1.alldatasheet.com/datasheet- … HC138.html ). Because speed isn't important, even a good old standard CMOS multiplexer will do  ( http://www.alldatasheet.com/datasheet-p … 4051B.html , you'd need additional pull-up resistors).

-----
No, unfortunately I don't speak Russian (I can read the script and know a few basic words)

Heh... may be it isn't difficult for you, but as I'm already said,- I have never programm microcontrollers and haven't used multiplexers/demultiplexers with SPI...

If you can provide some schematic,- it will really great for me!

Thanks!

-Alex

Well... programming micro-controllers goes from trivial to complex. If you've never worked with µCs before, you'll need some time to get used to it (rich peripherals but generally limited resources, and no operating system). There is a lot of information on the page I pointed to above - but I think that it is is off-topic here.  I suggest you start with the datasheet of the ATmega8, and look for application notes on the Atmel web site. You can contact me through PM if you need more information to get started.

/T

The discussion might have continued from here.