2008-06-04 05:24 AM
2008-04-28 05:29 AM
Hi,
Trying my first I2C communication with AMR I have a problem. Please have a look to my code: (based in IAR examples) I2C_Init (I2C0); I2C_FCLKConfig (I2C0); I2C_OnOffConfig (I2C0, ENABLE); I2C_SpeedConfig (I2C0, 100000); I2C_AcknowledgeConfig (I2C0, ENABLE); EIC_IRQConfig(DISABLE); I2C_STARTGenerate(I2C0, ENABLE); while (I2C_FlagStatus (I2C0, DIRECT, I2C_SB)==RESET); I2C_AddressSend (I2C0,0xDE, I2C_Mode7, I2C_TX); while (I2C_FlagStatus (I2C0, DIRECT, I2C_ENDAD)==RESET); I2C_FlagClear (I2C0, I2C_ENDAD); I2C_ByteSend (I2C0, 0x07); while (I2C_FlagStatus (I2C0, DIRECT, I2C_BTF )==RESET); I2C_STARTGenerate (I2C0, ENABLE); while (I2C_FlagStatus (I2C0, DIRECT, I2C_SB)==RESET); I2C_AddressSend (I2C0, 0xDF, I2C_Mode7, I2C_RX); while (I2C_FlagStatus (I2C0, DIRECT, I2C_ENDAD)==RESET); I2C_FlagClear (I2C0, I2C_ENDAD); while (I2C_FlagStatus (I2C0, DIRECT, I2C_BTF )==RESET); valor=I2C_ByteReceive (I2C0); I2C_STOPGenerate (I2C0, ENABLE); Having a look to signals on oscilloscope, transmission seems correct but STOP generation is not executed correctly (but program continue, don’t stop there) Also, if I execute again the program without un-plug the board, nothing related with I2C is working correctly (even not START condition). SCL signal is always held up. BTW, my slave is an ISL1209 (RTC) and I worked with this IC before with my old Microchip PICs without any problem. I appreciate your help, I’m newbie with ARMs. Thanks Regards. ALFA. null2008-06-04 05:24 AM
Dear Amoreno,
looking to the code, it is using an olddriver of I2C on STR710. The I2C driver has been updated and looking to IAR examples are not up to date and still using an old version of STR71xFWLib. I advice you to download the latest V4.0 and I assume that will solve your issue ;)