Page 1 of 1

I2C doesn't compile with 24FJ256GA110 and DA110

Posted: Thu Nov 17, 2011 4:18 pm
by Mathy
Hello,

An other bug with this chip family :

Flowcode1.c: In function 'FCD_I2C_Master0_MI2C_Init':
Flowcode1.c:1214: error: 'I2CCONbits' undeclared (first use in this function)
Flowcode1.c:1214: error: (Each undeclared identifier is reported only once
Flowcode1.c:1214: error: for each function it appears in.)
Flowcode1.c:1224: error: 'I2CBRG' undeclared (first use in this function)
Flowcode1.c: In function 'FCD_I2C_Master0_MI2C_Start':
Flowcode1.c:1310: error: 'I2CCONbits' undeclared (first use in this function)
Flowcode1.c: In function 'FCD_I2C_Master0_MI2C_Restart':
Flowcode1.c:1348: error: 'I2CCONbits' undeclared (first use in this function)
Flowcode1.c: In function 'FCD_I2C_Master0_MI2C_Stop':
Flowcode1.c:1392: error: 'I2CCONbits' undeclared (first use in this function)
Flowcode1.c: In function 'FCD_I2C_Master0_MI2C_Transmit_Byte':
Flowcode1.c:1437: error: 'I2CTRN' undeclared (first use in this function)
Flowcode1.c:1438: error: 'I2CSTATbits' undeclared (first use in this function)
Flowcode1.c: In function 'FCD_I2C_Master0_MI2C_Receive_Byte':
Flowcode1.c:1511: error: 'I2CCONbits' undeclared (first use in this function)
Flowcode1.c:1518: error: 'I2CRCV' undeclared (first use in this function)

Error returned from [pic30-gcc.exe]

Can you solve this quickly? Impossible to make something with this Flowcode release...

Re: I2C doesn't compile with 24FJ256GA110 and DA110

Posted: Thu Nov 17, 2011 4:59 pm
by Benj
Hello,

I'm guessing here but this could help. Go into the project options, enable supplementary code and then click edit supplementary code.

Where you have undeclared errors try defining them as this.

#define I2CCONbits I2C1CONbits

Re: I2C doesn't compile with 24FJ256GA110 and DA110

Posted: Thu Nov 17, 2011 5:21 pm
by Steve
Sorry that we've not address your problem(s) before - things are pretty busy here as we gear up to the release of Flowcode V5.

Ben and I have looked at this and a temporary solution is to right-click the I2C component and select "Custom Code". In the window, select {Defines] and edit the code. At the bottom, comment-out the following lines:

Code: Select all

/*
#ifndef I2C1CON
	#define I2C1RCV			I2CRCV
	#define I2C1TRN			I2CTRN
	#define I2C1BRG			I2CBRG
	#define I2C1CON			I2CCON
	#define I2C1STAT		I2CSTAT
	#define I2C1ADD			I2CADD
	#define I2C1RCVbits		I2CRCVbits
	#define I2C1TRNbits		I2CTRNbits
	#define I2C1BRGbits		I2CBRGbits
	#define I2C1CONbits		I2CCONbits
	#define I2C1STATbits	I2CSTATbits
	#define I2C1ADDbits		I2CADDbits
#endif
*/
This allows the file to compile. A similar technique may help solve some of your other issues.

Re: I2C doesn't compile with 24FJ256GA110 and DA110

Posted: Thu Nov 17, 2011 5:34 pm
by Mathy
Hello,
Sorry I annoying but I tear my hair for several days!

Your tips works, I tried a similar thing by directly changing your I2C component C file.

Now it compiles and I can watch the SDA and SCL line on my screen but if I connect this line to my other card, the µC stop running.
Maybe a hard probleme but if I try with the same pin with the I2C software, no problem. Do you have any idea ?

Thank you both ;-)

Re: I2C doesn't compile with 24FJ256GA110 and DA110

Posted: Thu Nov 17, 2011 6:28 pm
by Mathy
Reducing my pull up resistors from 4.7K to 2.7K solve the problem !

Thank you again.

Re: I2C doesn't compile with 24FJ256GA110 and DA110

Posted: Fri Nov 18, 2011 11:22 am
by Benj
Thanks for letting us know Mathy, Glad its working ok for you now.