Freeing up GPIO pins on microcontrollers

Hello,im pretty new im just wondering if my theory is a viable solution.

So to free up gpio pins multiplexing is the main method but,couldnt i just hook up one micro controller to another via UART (rx/tx pins) and have one give serial commands and the other take them?

A little more coding for simplicity and not having to learn to much more,is this viable?

Viable?
Sure.

Fast and flexible?
Uh-oh.

1 Like

Viable? Yes. Advisable? Given that you have to ask, no.

2 Likes

What you describe can be considered a multiplexer, connected to the main processor by a UART serial link.

1 Like

Lol fair enough

By not fast,you mean slow by human standards or computer standards?

Yeah i guess you are right just a more expensive solution

Mostly computer, but unless you're careful, it can be both.

1 Like

Roger that,all i needed to know thanks!

Consider an SPI or I2C port expander. Possibly easier and lower cost than another micro.

E.G. https://www.microchip.com/en-us/product/MCP23S17

Or even a simple shift register. £0.50 on eBay (have to buy 5)

1 Like

I2C is essentially a serial port optimized for such "Inter IC Communication" It uses the same wire count (2), but adds a protocol that allows multiple "client" chips to be addressed, so that you can add "many" I2C peripherals to a single main CPU. (and yeah, those peripherals COULD be another microcontroller running custom code.)

I2C also run a 100kHz or 400kHz or higher, making it faster than traditional UART links. (although more recently, UARTs have gone up in speed.)

1 Like

Roger that i prefer modules that support i2c its SPI that gives me problems with wiring and getting to work i prefer spi and uart all day

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.