This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Internal I2C initiation

Hi..
Can you please help me with initiating the inbuilt I2C in ARM7.
Manual says 2 things :
1) After start condition is sent, SI is reset and the STAT register is set to 0x08. Then "Interrupt service routine will LOAD I2CDAT (data register) with Slave address(from I2CADR register) and data direction bit(WRITE -0)".
2) I2CADR (slave address register) is LOAD with address ONLY in Slave Mode.

Now if i want to use the Internal I2C in Master Mode:
1. Transmit Mode to sent Slave address and data direction.
2. Receive Mode to receive data from the application.

" should we give the Slave address to I2CADR so that the I2C Load the Slave Address directly to data register I2CDAT after start condition. In this case How will the I2C load the Data Direction bit (How will it know if we want to use it as Tx or Rx) as the status register I2CSTAT will be 0x08 in both Tx and Rx Modes." (or)
" should we give the slave address and data direction bit(R/W) to data register I2CDAT directly after start condition is sent. "
...
How to Initiate the Internal I2C in ARM7 to acquire data from an external ADC(PCF 8591) which is connected to a variable resister(as an application)?

Plz Help me in this regard.

Thank You very much
kris

  • There is no inbuilt I2C in ARM7!

    ARM7 is just the processor "core"; I2C is provided as a peripheral by the particular manufacturer of the specific chip.

    For specific details of any I2C implementation in a particular chip, study the manufacuter's documentation for that particular chip (or family of chips).

    This has nothing to do with Keil - Keil do not make the chips!

  • Hi..

    Thank You very much for the reply.

    The processor i am using is : ARM7TDMI-S : LPC2148(NxP)
    This comes with 2 internal I2C blocks and my question is the same.

    Can you plz. help me through this.

    Thank You very much
    kris

  • I haven't looked at lpc2148. the following applies to lpc210x but they should be the same / similar:

    since you are in master mode (send or receive), i2cadr isn't used: the master mode uses i2cdat to send / receive.

    the output direction is done by the i2c controller directly.

  • So have you studied the manufacuter's documentation for that particular chip (or family of chips)?

    Have you studied the other supporting materials on the manufacuter's website - application notes, examples, tutorials, etc?

    Have you looked at the examples on this website?

    etc,...

  • I thought of writing it in my way, so I have read I2C in the LPC2148 Manual, and PCF8591 manual and read details of I2C protocol, But did not look into the examples.
    Yes, May be some working examples may give some insight. Thank You.
    I will try that.

  • That is my doubt. How will the I2C know what we want to do (Read/Write), as we are not giving any details regarding the same till that point.

    I think after start and Ack. we have to fill the data register with slave address and the write bit. As the slave address is only 7 bits. 7 + 1 makes a byte.

    Thank You.