I2C issue
Company  
ST Home | Microcontrollers

Index  »  ARM7 STR7  »  I2C issue
     
   I2C issue
 Moderated by :   »  AnisAS  -  coucou

Author
beginning argument    ( Replies received: 1 )
amoreno   Posted 28-04-2008 at 17:59   



Registered on :
11-02-2008

Messages : 36

 OFF-Line

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



 Profile   Quote  
coucou   Posted 04-06-2008 at 17:54   





Registered on :
10-03-2003

Messages : 202

 OFF-Line

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 STR71xFWLib V4.0 and I assume that will solve your issue



 Profile   Quote  
On Top

Search in the forums
 
Jump To