/var/www/restricted/ssh/stm32/www/stm32circle/ STM CircleOS forum / I2C support

Username:     
Password:     
             

Forum

# 1   2008-05-21 22:40:28 I2C support

armaniake
Member
From: USA, Texas
Registered: 2007-08-22
Posts: 38

I2C support

Hi,

I'm trying to add I2C support. For this I need to enable the clock for instance. With a 32K limited platform, what is the best approach?

I cannot recompile and debug the whole circleOS due to size limitation and debug wish. So, I cannot just change the scheduler.c function RCC_Configuration() for instance.

Then, I was thinking doing all the config I need in Application.c.

so, I would have in:

scheduler.c (original file)

RCC_APB1PeriphClockCmd( RCC_APB1Periph_TIM2, ENABLE );



And in Application.c (extract), I would have:

      /* I2C2 CLOCK  -----------------------------------------------------*/

RCC_APB1PeriphClockCmd( RCC_APB1Periph_I2C2, ENABLE );

      /* I2C2 GPIO HW config -----------------------------------------------------*/
      /* Configure I2C2 pins: SCL and SDA */
      GPIO_InitTypeDef  GPIO_InitStructureI2C2;
      GPIO_InitStructureI2C2.GPIO_Pin   = GPIO_Pin_10| GPIO_Pin_11;
      GPIO_InitStructureI2C2.GPIO_Speed = GPIO_Speed_50MHz;
      GPIO_InitStructureI2C2.GPIO_Mode  = GPIO_Mode_AF_OD;
      GPIO_Init(GPIOB, &GPIO_InitStructureI2C2);   


I wanted to check with you if this was a good way to add the changes?


Thank you very much,

Offline

 

# 2   2008-05-22 07:06:11 I2C support

Francis
Administrator
From: France-Grenoble
Registered: 2007-07-09
Posts: 890

Re: I2C support

Modifying the clock configuration can be done at the application level. The best would be:

1.  to keep 'unchanged' CircleOS in order to keep your application compatible with other applications.
2. to save and restore the original settings (i.e. the original clock configuration) in your application.

Offline

 

# 3   2008-05-22 23:05:43 I2C support

armaniake
Member
From: USA, Texas
Registered: 2007-08-22
Posts: 38

Re: I2C support

It makes sense.

Thanks

Offline

 

Board footer