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
you should write the I2c protocol handler yourself or download the code linked to in one of the many Philips appnotes. Erik
Thanks I was just wondering if it was possible Matt
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.
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
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?
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.
'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!
"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...?!
"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
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
"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... ;-)
And the ACK-Flag ? How can you test this ? per software ? seperate 9 clock ? Not really !