Discussion Forum

Interfacing 8051 UART to I2C slave

Next Thread | Thread List | Previous Thread Start a Thread | Settings

DetailsMessage
Read-Only
Author
Matt S
Posted
26-Feb-2003 05:08 GMT
Toolset
C51
New! Interfacing 8051 UART to I2C slave
Does anyone have any ideas on interfacing the standard 8051 UART in mode 0 to interface to an I2C slave? I was thinking of writing the address of the slave, then shifting the acknowledge back in immediatley after. Any feedback would be appreciated.

Matt
Read-Only
Author
erik malund
Posted
26-Feb-2003 14:01 GMT
Toolset
C51
New! RE: Interfacing 8051 UART to I2C slave
You can not drive IIC with an UART.

Erik
Read-Only
Author
Geert Vancompernolle
Posted
26-Feb-2003 18:00 GMT
Toolset
C51
New! RE: Interfacing 8051 UART to I2C slave
The only way you can have I2c communication, is when you yourself are manipulating some pins of some port (eg. P1.6 and P1.7). I suggest not to use pins that have already a double functionality (like for instance P3.0 and P3.1, which can be used for UART communication too).
Unless your device has a hardware I2c controller on board, you should write the I2c protocol yourself (which isn't that difficult).
Read-Only
Author
erik malund
Posted
26-Feb-2003 18:10 GMT
Toolset
C51
New! RE: Interfacing 8051 UART to I2C slave
you should write the I2c protocol handler yourself
or download the code linked to in one of the many Philips appnotes.

Erik
Read-Only
Author
Matt Stoll
Posted
26-Feb-2003 21:21 GMT
Toolset
C51
New! RE: Interfacing 8051 UART to I2C slave
Thanks

I was just wondering if it was possible

Matt
Read-Only
Author
Drew Davis
Posted
27-Feb-2003 00:52 GMT
Toolset
C51
New! RE: Interfacing 8051 UART to I2C slave

One problem with using the UART is that I2C bus is synchronous; you have a clock for every data bit to tell you when the bit is valid. A UART is asynchronous (hence the 'A'); there's no extra clock line, and you time from the edge of the start bit, hoping that the transmit and receive clocks are close enough that you don't wander "out of the bit" and sample the wrong value. Those start and stop bits would themselves be a problem, since they shouldn't appear in an I2C transfer.

Another problem is that the I2C data line is bidirectional. You read and write with the same data line. A UART has separate transmit and receive pins, and you'd run into interesting problems with who drives the line at what time.

Both interfaces are serial, but they're not really much alike.

Read-Only
Author
Mingyong Zhou
Posted
18-Aug-2004 03:09 GMT
Toolset
C51
New! RE: Interfacing 8051 UART to I2C slave
We have one project which needs the communication between UART (serial port) and I2c using 8051. Any tools , software in the market one can purchase?

Sound like the translation bewteen UART and I2C is not that easy from this technical forum discussion.

Any suggestion will be appreciated.

zhou.ming.yong@philips.com
tel: +65 6 882 3085
Read-Only
Author
Russell Bull
Posted
18-Aug-2004 04:52 GMT
Toolset
C51
New! RE: Interfacing 8051 UART to I2C slave
It is all too easy to get confused with this discussion. The initial thrust of this discussion was coonecting the serial port to the I2C device - and for the abovementioned reasons it will not work. Now, if you want to received commands and data via the serial port (uart) then send them to an I2C device, that is possible and fairly easy. There is plenty of code around detailing how to ise the uart and implementing an I2C master, all you need to do is come up with a method of connecting the two via software. Obviously this can depend of what sort of I2C devices you wish to talk to. If it is a I2C real time clock chip, you would want to read and write the time, if it is a eeprom, then you want to read and write bytes. What do you want to do?
Read-Only
Author
Mingyong Zhou
Posted
19-Aug-2004 03:08 GMT
Toolset
C51
New! Interfacing 8051 UART to I2C with I2C as master
I would appreciate if anybody can provide software C samples to use I2C as master to communicate and control UART, because of the time deadline.

Any reference to website or resources appreciated.
Read-Only
Author
Russell Bull
Posted
19-Aug-2004 03:22 GMT
Toolset
C51
New! RE: Interfacing 8051 UART to I2C with I2C as master
'I2C master to communicate and control uart' I think you need to explain exactly what you want to do. As mentioned previously, you don't connect I2C to uart!

If you want a uart with an I2C interface, Maxim have a device that does this. You would use this device when you want to add more serial ports to your microcontroller via the I2C . Is this what you want to do?

Gong Xi Fat Choi!
Read-Only
Author
Andy Neil
Posted
19-Aug-2004 07:17 GMT
Toolset
C51
New! RE: Interfacing 8051 UART to I2C with I2C as master
"I would appreciate if anybody can provide software C samples to use I2C ..."

I note that you gave your e-mail address as: zhou.ming.yong@philips.com

Surely someone at Philips should have access to all the I2C support one could ever wish for...?!
Read-Only
Author
erik malund
Posted
19-Aug-2004 13:40 GMT
Toolset
C51
New! RE: Interfacing 8051 UART to I2C with I2C as master
"I would appreciate if anybody can provide software C samples to use I2C ..."

I note that you gave your e-mail address as: zhou.ming.yong@philips.com


Is'nt it amazing. Software for IIC is in several appnotes at the Philips website
http://www.semiconductors.philips.com/products/all_appnotes/

Erik
Read-Only
Author
Oleg Sergeev
Posted
20-Aug-2004 06:52 GMT
Toolset
C51
New! RE: Interfacing 8051 UART to I2C slave
hi,

A UART is asynchronous (hence the 'A'); there's no extra clock line,

Not always. Read some more about UART mode 0 (shift register mode). In this mode, UART provides separate data line and clock line.

A UART has separate transmit and receive pins, and you'd run into interesting problems with who drives the line at what time

Again - not always. In mode 0 UART provides bidirectional line RX for both receive and transmit. Line TX is used for clock out only.

Regards,
Oleg
Read-Only
Author
Andy Neil
Posted
20-Aug-2004 07:01 GMT
Toolset
C51
New! RE: Interfacing 8051 UART to I2C slave
"Not always. Read some more about UART mode 0 (shift register mode). In this mode, UART provides separate data line and clock line."

To be pedantic, we could say that the 8051's Serial Interface is not acting as a UART in this mode... ;-)
Read-Only
Author
Michael Baldischweiler
Posted
21-Aug-2004 16:26 GMT
Toolset
C51
New! RE: Interfacing 8051 UART to I2C slave
And the ACK-Flag ? How can you test this ? per software ? seperate 9 clock ?
Not really !
Read-Only
Author
Desmond Yeo
Posted
7-Oct-2005 08:43 GMT
Toolset
C51
New! RE: Interfacing 8051 UART to I2C slave
there is a Philips IC that bridge UART to I2C. Pls send me your e-mail address.
Read-Only
Author
Andrew Neil
Posted
7-Oct-2005 23:02 GMT
Toolset
C51
New! Async to I2C "bridge"
"there is a Philips IC that bridge UART to I2C."

Maxim also do such things - as has already been mentioned!
Most likely there are others, too.

Of course, you could easily implement such a thing with just about any microcontroller - whether you use dedicated hardware UART and I2C peripherals, or implement either or both in software ("bit-banging")...

Next Thread | Thread List | Previous Thread Start a Thread | Settings