I2C interrupt
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2006-07-04 5:01 AM
This discussion is locked. Please start a new topic to ask your question.
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2006-06-22 4:39 AM
Posted on June 22, 2006 at 13:39
hello,
i have an problem with my RX_TX_Interrupt. i am trying to write data toward an I2C slave. The procedure is the following: 1. i initialise my I2c with the ITE bit set 2. my task send a Start condition 3. the interrupt ITERR occurs 4. read SB bit and send the adress: if (I2C_FlagStatus ( desc->i2c, desc->access, I2C_SB)==SET){ // Envoi de l'adresse desc->adresse&=~0x01; desc->i2c->DR=(u8)desc->adresse; } 5. the 2nd ITERR interrupt occurs 6. read ENDAD bit , Clear and send the data if (I2C_FlagStatus ( desc->i2c,desc->access, I2C_ENDAD)==SET){ desc->write.numero_auto=2; I2C_FlagClear (desc->i2c, I2C_ENDAD); I2C_ByteSend(desc->i2c,desc->write.buffer[desc->write.pos]); } 7. the RX_TX interrupt occurs 8. read BTF bit and send the second data: if (desc->i2c->SR1 & 0x08) { desc->write.pos++; if (desc->write.pos ==(desc->write.len)){ desc->write.numero_auto = 3; } I2C_ByteSend(desc->i2c,desc->write.buffer[desc->write.pos]); indices++; } REPEAT step 7 and 8 if you have more data 9. the RX_TX interrupt occurs 10.the Stop condition is send if (desc->i2c->SR1 & 0x08) { I2C_STOPGenerate (desc->i2c, ENABLE); desc->write.numero_auto = 0; indices++; } the problem is: th 1st IT TX_RX occurs when the bit BTF is unset and after a litte delay the bit in the SR1 register is set. After the datasheet of STR712 the condition which permit to the interrupt to occur is when BTF an ITE are SET. Have you an explain about this operating? thanks LudoOptions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2006-07-04 5:01 AM
Posted on July 04, 2006 at 14:01
Thank you,
ludo78 is not here any more but I pursue their investigations. I will have a look to your project. Thanks, Ludo