Username:     
Password:     
             

Projects
TestI2C1 1.1
 
I2C extension management

Code size:16 Ko Author:yrt
Source files included:yes Version:1.1
Use circleOS:yes (circleOSversion) Creation date:2009-09-14 08:42:45
Hardware modification:no Modification date:2011-05-13 10:21:13
Based on the STM32 Primer:Primer2
   
Downloads:2312 Views:26466
   
Vote:
Average ratings:0/5 (0 rates)

Download:    TestI2C1-1.1.zip (192 KB)

Description:

Description :

This is the little application test that uses the I2C1 on the extension Primer connector.
We implemented the "M24C08_EEPROM" example from the ST Library as a CircleOS application.

It shows how to use peripheral which pins are shared with FSMC.

Explanations :

The I2C1 on the extension card does not run because of sharing PB7 (I2C1_SDA) with the FSMC (FSMC_NADV) used  for the LCD management.

So, the only solution is to temporarily unvalidate the FSMC before calling I2C functions.
This can be done by this function, followed by a delay :
    RCC_AHBPeriphClockCmd(RCC_AHBPeriph_FSMC, DISABLE);
    for(i=0; i<1000; i++);

Then call
    RCC_AHBPeriphClockCmd(RCC_AHBPeriph_FSMC, ENABLE);
and the LCD will run again.

This fixes the START generation, but sometimes the program still stalls. So, we also must  disable temporarily the TIM2 interrrupts (MEMS), with the instruction :
   TIM_Cmd( TIM2, DISABLE );

Versions :

1.1 Compiled with new ST library version 3.x and CircleOS version 4.x

1.0 First release