/var/www/restricted/ssh/stm32/www/stm32circle/ STM CircleOS forum / 'I2C1' undeclared (first use in this function)

Username:     
Password:     
             

Forum

# 1   2009-01-25 12:17:14 'I2C1' undeclared (first use in this function)

windkum
New member
Registered: 2009-01-24
Posts: 4

'I2C1' undeclared (first use in this function)

Init code for external JP2 for I2C1, this error was encountered

void I2C1_Configuration(void)
{
    I2C_InitTypeDef  I2C_InitStructure;

    /* I2C1 ENABLE */
    I2C_Cmd(I2C1, ENABLE);
    /* Enable I2C1 event interrupt */
    I2C_ITConfig(I2C2, I2C_IT_EVT | I2C_IT_BUF , ENABLE);
    /* I2C1 Init */
    I2C_InitStructure.I2C_Mode = I2C_Mode_I2C;
    I2C_InitStructure.I2C_DutyCycle = I2C_DutyCycle_2;
    I2C_InitStructure.I2C_OwnAddress1 = 0x30;
    I2C_InitStructure.I2C_Ack = I2C_Ack_Enable;
    I2C_InitStructure.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit;
//    I2C_InitStructure.I2C_ClockSpeed =ClockSpeed ;
    I2C_Init(I2C2, &I2C_InitStructure);
}

'I2C1' undeclared (first use in this function)

I2C_Cmd(I2C1, ENABLE);  => I2C1 is not undeclared.

could you help me this err?

Offline

 

# 2   2009-01-25 12:24:32 'I2C1' undeclared (first use in this function)

sjoerd
Member
From: Stad aan het Haringvliet
Registered: 2008-09-04
Posts: 65

Re: 'I2C1' undeclared (first use in this function)

Perhaps I2C1 is disabled in stm32f10x_conf.h in your project


I guess you mean I2C1 here: I2C_ITConfig(I2C2, I2C_IT_EVT | I2C_IT_BUF , ENABLE);
and here: I2C_Init(I2C2, &I2C_InitStructure);

Last edited by sjoerd (2009-01-25 12:24:46)

Offline

 

# 3   2009-01-25 23:37:23 'I2C1' undeclared (first use in this function)

windkum
New member
Registered: 2009-01-24
Posts: 4

Re: 'I2C1' undeclared (first use in this function)

yes your comment seems right.
As i checked in  "stm32f10x_conf.h"
define for I2c1 was remarked. => //#define _I2C1

i modified it => #define _I2C1.

but after modification still same err was happen...

Offline

 

# 4   2009-01-26 04:46:00 'I2C1' undeclared (first use in this function)

sjoerd
Member
From: Stad aan het Haringvliet
Registered: 2008-09-04
Posts: 65

Re: 'I2C1' undeclared (first use in this function)

Hmm.. strange. When I create a new project, copy/paste your code, change I2C2 to I2C1, and enable it it stm32f10x.conf.h it compiles ok.

Try a 'clean project'..

Offline

 

# 5   2009-01-26 07:42:21 'I2C1' undeclared (first use in this function)

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

Re: 'I2C1' undeclared (first use in this function)

Check for multiple stm32f10x_conf.h files..

Offline

 

# 6   2009-01-26 10:00:47 'I2C1' undeclared (first use in this function)

windkum
New member
Registered: 2009-01-24
Posts: 4

Re: 'I2C1' undeclared (first use in this function)

Thanks a lot for your comment.. but still i have a problem..

i tried 2 thing.
1. creat project  "stm32-primer-project" in raisonance. and paste my code. suly primerOS was re-builted.
=> I2c1 is not decleared
2. Clean Project.
=> I2c1 is not decleared

...... so I'd like to check 2 point.

1. Primer2 OS is CircleOS that download from wabsite or same as it?

2. this modificatioin is right for enable I2c1 in stm32f10x_conf.h ?
//#define _I2C1
=> #define _I2C1.

Offline

 

# 7   2009-01-27 00:34:17 'I2C1' undeclared (first use in this function)

windkum
New member
Registered: 2009-01-24
Posts: 4

Re: 'I2C1' undeclared (first use in this function)

I solve this..

thanks for your recommend..

I confusing directory of stm32f10x_conf.h.. ^^;

Offline

 

Board footer