Post Go back to editing

TWI/I2C 21489 C code example

Hi,

I'm trying to develop a link between the ADSP 21489 and ADT7411. I have to use the I2C protocol. Could someone point me to a C code example demonstrating an I2C transaction for the ADSP 21489.


Thanks!

Parents
  • Hi Jeyanthi,

    Thanks for your post. After posting my question, I looked around the Analog Devices Forum and found some examples in assembly (posted by Analog Devices Engineers) and started the work in C. I also came across the example that you attached. That example was posted by someone else in another post thread since the examples provided by Analog Devices were only available in Assembly. The attached example is a good example of TWI Master, however I have a couple of questions for you.

    1. Inside the TWI_Transmit_Data_Polling function, it is sending N bytes (in this case 10). Would that really work? Don't we need to send 1 byte in each transmission and for each transmission repeat the sequence of events by resending the slave address before the data?

    2. In the same TWI_Transmit_Data_Polling, wouldn't we need to restart (TWIRSTART) ? Is this in the Master_TWI_Init taking care of that when init is called ?

    // Enable the master control register

    *pTWIMCTL = (N << 6) ;

    *pTWIMCTL |= TWIMEN;

    Thank You!

    Deco

Reply
  • Hi Jeyanthi,

    Thanks for your post. After posting my question, I looked around the Analog Devices Forum and found some examples in assembly (posted by Analog Devices Engineers) and started the work in C. I also came across the example that you attached. That example was posted by someone else in another post thread since the examples provided by Analog Devices were only available in Assembly. The attached example is a good example of TWI Master, however I have a couple of questions for you.

    1. Inside the TWI_Transmit_Data_Polling function, it is sending N bytes (in this case 10). Would that really work? Don't we need to send 1 byte in each transmission and for each transmission repeat the sequence of events by resending the slave address before the data?

    2. In the same TWI_Transmit_Data_Polling, wouldn't we need to restart (TWIRSTART) ? Is this in the Master_TWI_Init taking care of that when init is called ?

    // Enable the master control register

    *pTWIMCTL = (N << 6) ;

    *pTWIMCTL |= TWIMEN;

    Thank You!

    Deco

Children