Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

I2C and UART on the same pins of uC

Status
Not open for further replies.

nickagian

Member
Hi,

i want to ask a quick question. You can find attached the schematic of what I want to implement. I have a uC (EM250, it is a zigbee module actually), which has only two serial ports. Port P1 will be configured as SPI (for flash memory, pressure sensor etc.), whereas port P2 will be either I2C or UART. Not at the same time of course. And the different configuration will be controlled by the firmware. UART is needed to communicate with a UART-To-USB chip (FTDI) for sending data to the PC. I2C is needed to access a temperature sensor. When I take measurements, the I2C will be active. When I want to send data to the PC, the UART will be active.

I intend to use an analogue switch (as seen in figure) to either select the FTDI or the sensor for communication. Will this implementation work? I'm afraid that the I2C bus will have problems. Something else that I have thought, is to use buffers and to isolate from the two lines to the uC the device that is not needed.

Thanks!
Nick
 

Attachments

  • uart+i2c.jpg
    uart+i2c.jpg
    47.6 KB · Views: 199
Hi Nigel, thanks for your reply.
-> Why are you saying that it is a "hard work" to do this?
-> You mean that I should implement an I2C master in software and use it on two GPIOs different from those of the P2 port and keep port P2 only for UART, right?
 
Hi Nigel, thanks for your reply.
-> Why are you saying that it is a "hard work" to do this?
-> You mean that I should implement an I2C master in software and use it on two GPIOs different from those of the P2 port and keep port P2 only for UART, right?

Either that, or keep the I2C in hardware, and use two other pins for a software UART - whichever you find is best.

You're using a micro-controller, you don't throw extra hardware at it just to resolve a simple software issue.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top