Discussion in "Project Doubts" started by    scorcho    Dec 6, 2006.
Wed Dec 06 2006, 06:54 AM
Does anyone have any experience with I2C on a Toshiba TMP91CP/FY27? Or is I2C similar across various MCUs?

I'm trying to interface a master ASIC with my slave MCU. The ASIC actually expects a slave I2C EEPROM, so I'm trying to emulate the EEPROM with my MCU. Basically my I2C code consists of 2 parts:

initialize I2C
- setup ports
- setup MCU as slave receiver, 8bits, ACK generation
- setup slave address of MCU
- enable serial interrupt

I2C interrupt service routine
- check various status bits(master/slave?, receiver/transmitter?, arbitration lost?, slave address match?, general call match?, last received bit?)
- based on those status bits read or write to and from the serial buffer

Do these seem like the right steps? Currently my MCU is able to detect and ACK the device/word address that the ASIC is sending, but once it comes to actually sending the data to the ASIC, I get extremely weird and inexplicable problems, such as:

If I send the first byte anything other than a constant, my 2nd byte will be extended by 1 bit, i.e. the interrupt will occur 1 bit after the ACK. My MCU will then be put into receive mode for some reason. Therefore, buffer = 0x00 works but buffer = data doesn't(where data is a char variable)

Assuming I send the first byte as a constant and I get to the 2nd byte, if I set the buffer to anything at all, the MCU will be put into receive mode again. If I don't set the serial buffer at all, the SDA line will be high, hence the ASIC will receive all 0xFFs.

I also noticed that adding instructions in the ISR(even too many dummy nops) will cause the program behavior to differ.

Does this sound weird or what?!
Fri Dec 15 2006, 06:38 AM

my 2nd byte will be extended by 1 bit

This problem might be coz... you are using the same recieve routine which you wrote for recieving address. or it maybe coz of the clock function it generate interrup at the wrong time.

and regarding high of SDA line, try putting some NOPs so that the voltage settle on output pin.

and make sure your ASIC doesn't have a high speed. usually the emulated I2C work at a maximum of 60-70Kbps. so make sure you are not above that.

Get Social


Powered by e107 Forum System


Mon Apr 12 2021, 11:54 AM
Joe N
I have recently launched my own site, and I am looking to provide value for you for free, by giving away 26 professional level blog post templates (worth $297).
Mon Apr 12 2021, 09:24 AM
Hey, I think your site might be having browser compatibility issues. When I look at your website in Ie, it looks fine but when opening in Internet Explorer, it has some overlapping. I just wanted to give you a quick heads up! Other then that, very good blog! https://onanadiete.ru/alpha-numeric-reasoning-questions-and-answers-pdf.pdf alpha numeric reasoning questions and answers pdf alpha numeric reasoning questions and answers pdf



Thu Jun 25 2020, 03:46 PM
Mon Jun 22 2020, 03:03 PM
Tue Jun 16 2020, 05:10 PM
Sat Jun 13 2020, 09:43 PM
Thu May 21 2020, 12:44 PM
Thu May 21 2020, 01:28 AM
Wed May 20 2020, 07:05 PM
Wed May 20 2020, 11:52 AM


Guests: 93, Members: 0 ...

most ever online: 182184
(Members: , Guests: 182184) on 06 Aug 2010: 05:37 AM

Members: 38215
Newest member: Mirza123