cancel
Showing results for 
Search instead for 
Did you mean: 

I2C issue

amoreno
Associate II
Posted on June 04, 2008 at 14:24

I2C issue

2 REPLIES 2
amoreno
Associate II
Posted on April 28, 2008 at 14:29

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.

null

kaouther
Associate II
Posted on June 04, 2008 at 14:24

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

http://www.st.com/mcu/familiesdocs-86.html#Firmware

V4.0 and I assume that will solve your issue ;-)