Hi everybody,
I want to interface the LPC2378 Olimex board with IAR IDE Tool with 24LC512. I
downloaded the example code this group's download section. But I
didn't understand
m24xxwrite(....., char *buf,....) function. Where shall i use my variable to
write in the 24LC512 EEPROM? Please can anyone help me?
Thanks in advance.
Kursad Gol
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it
now.
LPC2378 and 24LC512
Started by ●May 3, 2008
Reply by ●May 3, 20082008-05-03
> -----Original Message-----
> From: l...
> [mailto:l...]On Behalf
> Of K|r~ad" "Gvl
> Sent: Saturday, May 03, 2008 5:25 PM
> To: l...
> Subject: [lpc2000] LPC2378 and 24LC512
> Hi everybody,
>
> I want to interface the LPC2378 Olimex board with IAR IDE
> Tool with 24LC512. I downloaded the example code this group's
> download section. But I didn't understand
> m24xxwrite(....., char *buf,....) function. Where shall i
> use my variable to write in the 24LC512 EEPROM? Please can
> anyone help me?
>
> Thanks in advance.
>
> Kursad Gol
>
>
Likely you pass a pointer to the variable as the buf parameter.
Mike
> From: l...
> [mailto:l...]On Behalf
> Of K|r~ad" "Gvl
> Sent: Saturday, May 03, 2008 5:25 PM
> To: l...
> Subject: [lpc2000] LPC2378 and 24LC512
> Hi everybody,
>
> I want to interface the LPC2378 Olimex board with IAR IDE
> Tool with 24LC512. I downloaded the example code this group's
> download section. But I didn't understand
> m24xxwrite(....., char *buf,....) function. Where shall i
> use my variable to write in the 24LC512 EEPROM? Please can
> anyone help me?
>
> Thanks in advance.
>
> Kursad Gol
>
>
Likely you pass a pointer to the variable as the buf parameter.
Mike
Reply by ●May 4, 20082008-05-04
Thank you very much indeed Mike. But please please please can you give an
example code? Also the code can be not including error options. Only only write
and read char data to 24LC512. It can be not detailed code. Thanks in advance.
Please help me Mike or group members?
Kursad Gol
Michael Anton wrote:
> -----Original Message-----
> From: l...
> [mailto:l...]On Behalf
> Of K|r~ad" "Gvl
> Sent: Saturday, May 03, 2008 5:25 PM
> To: l...
> Subject: [lpc2000] LPC2378 and 24LC512
> Hi everybody,
>
> I want to interface the LPC2378 Olimex board with IAR IDE
> Tool with 24LC512. I downloaded the example code this group's
> download section. But I didn't understand
> m24xxwrite(....., char *buf,....) function. Where shall i
> use my variable to write in the 24LC512 EEPROM? Please can
> anyone help me?
>
> Thanks in advance.
>
> Kursad Gol
Likely you pass a pointer to the variable as the buf parameter.
Mike
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.
Kursad Gol
Michael Anton wrote:
> -----Original Message-----
> From: l...
> [mailto:l...]On Behalf
> Of K|r~ad" "Gvl
> Sent: Saturday, May 03, 2008 5:25 PM
> To: l...
> Subject: [lpc2000] LPC2378 and 24LC512
> Hi everybody,
>
> I want to interface the LPC2378 Olimex board with IAR IDE
> Tool with 24LC512. I downloaded the example code this group's
> download section. But I didn't understand
> m24xxwrite(....., char *buf,....) function. Where shall i
> use my variable to write in the 24LC512 EEPROM? Please can
> anyone help me?
>
> Thanks in advance.
>
> Kursad Gol
Likely you pass a pointer to the variable as the buf parameter.
Mike
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.
Reply by ●May 8, 20082008-05-08
Hi everybody,
I want to interface the LPC2378 Olimex board with IAR IDE Tool with 24LC512. I downloaded the example code this group's download section. But I didn't understand
m24xxwrite(....., char *buf,....) function. Where shall i use my variable to write in the 24LC512 EEPROM? Please can anyone help me? Can you give an example code please?
Thanks in advance.
Kursad Gol
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.
I want to interface the LPC2378 Olimex board with IAR IDE Tool with 24LC512. I downloaded the example code this group's download section. But I didn't understand
m24xxwrite(....., char *buf,....) function. Where shall i use my variable to write in the 24LC512 EEPROM? Please can anyone help me? Can you give an example code please?
Thanks in advance.
Kursad Gol
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.
Reply by ●May 8, 20082008-05-08
Hi,
I have not written any code for LPC series (in fact for any ARM mcu's )
but as a c programmer and as i can see from the function decleration,
the parameter buf should point out to your variable that stores the data
to be written into 24LC512 Eeprom.
If the specified function decleration is as is, then first parameter
should be Eeprom device address, if omitted the one which is default
will be used and it is probably 1010000xb ) and the third one should be
the length of the buffer, if omitted then it will be calculated from the
buffer itself, probably via finding the null character int the buffer.
I hope this helps
FIRAT KOCAK
Cheers,
Kad G wrote:
>
> Hi everybody,
>
> I want to interface the LPC2378 Olimex board with IAR IDE Tool with
> 24LC512. I downloaded the example code this group's download section.
> But I didn't understand
> m24xxwrite(....., char *buf,....) function. Where shall i use my
> variable to write in the 24LC512 EEPROM? Please can anyone help me?
> Can you give an example code please?
>
> Thanks in advance.
>
> Kursad Gol
>
> ---------------------------------
> Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try
> it now.
>
>
>
>
I have not written any code for LPC series (in fact for any ARM mcu's )
but as a c programmer and as i can see from the function decleration,
the parameter buf should point out to your variable that stores the data
to be written into 24LC512 Eeprom.
If the specified function decleration is as is, then first parameter
should be Eeprom device address, if omitted the one which is default
will be used and it is probably 1010000xb ) and the third one should be
the length of the buffer, if omitted then it will be calculated from the
buffer itself, probably via finding the null character int the buffer.
I hope this helps
FIRAT KOCAK
Cheers,
Kad G wrote:
>
> Hi everybody,
>
> I want to interface the LPC2378 Olimex board with IAR IDE Tool with
> 24LC512. I downloaded the example code this group's download section.
> But I didn't understand
> m24xxwrite(....., char *buf,....) function. Where shall i use my
> variable to write in the 24LC512 EEPROM? Please can anyone help me?
> Can you give an example code please?
>
> Thanks in advance.
>
> Kursad Gol
>
> ---------------------------------
> Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try
> it now.
>
>
>
>
Reply by ●May 8, 20082008-05-08
--- In l..., "Kad" "G" wrote:
>
> Hi everybody,
>
> I want to interface the LPC2378 Olimex board with IAR IDE Tool with
24LC512. I downloaded the example code this group's download section.
But I didn't understand
> m24xxwrite(....., char *buf,....) function. Where shall i use my
variable to write in the 24LC512 EEPROM? Please can anyone help me?
Can you give an example code please?
>
> Thanks in advance.
>
> Kursad Gol
>
>
> ---------------------------------
> Be a better friend, newshound, and know-it-all with Yahoo! Mobile.
Try it now.
>
>
>
How about defining you variable as:
unsigned char MyVariable;
Using your abbreviated prototype (because you didn't provide a link to
the real code):
m24xxwrite(..., &MyVariable, ...);
The missing parameters are probably important and one of them should
specify that you are only writing a single byte while another probably
specifies the address.
Richard
>
> Hi everybody,
>
> I want to interface the LPC2378 Olimex board with IAR IDE Tool with
24LC512. I downloaded the example code this group's download section.
But I didn't understand
> m24xxwrite(....., char *buf,....) function. Where shall i use my
variable to write in the 24LC512 EEPROM? Please can anyone help me?
Can you give an example code please?
>
> Thanks in advance.
>
> Kursad Gol
>
>
> ---------------------------------
> Be a better friend, newshound, and know-it-all with Yahoo! Mobile.
Try it now.
>
>
>
How about defining you variable as:
unsigned char MyVariable;
Using your abbreviated prototype (because you didn't provide a link to
the real code):
m24xxwrite(..., &MyVariable, ...);
The missing parameters are probably important and one of them should
specify that you are only writing a single byte while another probably
specifies the address.
Richard
Reply by ●May 8, 20082008-05-08
Thank you all friends. My code is below here. I think there is a wrong thing at
----------------------> I2C0CONCLR_bit.STAC = 1; <--------------------------------- this line. Because when i debug the lpc2378 with IAR J Link, before this line the I2C0STAT register's value is (0x08). But after this line the debugger set out I2C0STAT register to (0xF8). So i know that from the LPC2378's datasheet the I2C0STAT register's status (0xF8) is reflecting a bus fault. What can be the problem? I pulled up either SCL0 (P0.28) and SDA0 (P0.27) pins to 3.3 VDD with 4.7K resistors. If shall i pull up the SCL0 and SDA0 pins to 5 V with 4.7K? Please help me friends. I will pray for all of you.
Note: Below code is a part of the code which is standing on this group's download section name of I2C_lib.zip, creator *ytremil*. It was for LPC21XX. I turned it compatible to LPC2378.
Thanks in advance again.
Kursad Gol
static int i2c_lpc_ctrl(int ctrl)
{
int chk;
//-- Set START
I2C0CONCLR = 0xFF; // Clear all bits
I2C0CONSET_bit.I2EN = 1;
I2C0CONSET_bit.STA = 1;
//I2C_FLAG_I2EN | I2C_FLAG_STA;
printf("SI_1.DUR:%d\r", I2C0CONSET_bit.SI);
Dly100us((void*)12000);
while(!(I2C0CONSET_bit.SI)); //-- End wr POINT
//-- Set ADDRESS
I2C0DAT = ctrl;
printf("I2C0DAT:%d\r", ctrl);
Dly100us((void*)12000);
----------------------> I2C0CONCLR_bit.STAC = 1; <---------------------------------
I2C0CONCLR_bit.SIC = 1;
//I2C_FLAG_STA | I2C_FLAG_SI; //-- Clear START & SI
if(ctrl & 1) //-- RD
chk = 0x40; //-- 40H - SLA+R has been transmitted; ACK has been received
else
chk = 0x18; //-- 18H - SLA+W has been transmitted; ACK has been received
printf("SI_2.DUR:%d\r", I2C0CONSET_bit.SI);
Dly100us((void*)12000);
while(!I2C0CONSET_bit.SI); //-- End CTRL
// ??? BURASI NE OLACAK ??? //
printf("CHK:%d\r", chk);
Dly100us((void*)12000);
if(I2C0STAT != chk)
{
printf("I2C0STAT:%d\r", I2C0STAT);
Dly100us((void*)12000);
i2c_lpc_stop();
return I2C_ERR_NO_RESPONSE;
}
printf("I2C0STAT:%d\r", I2C0STAT);
Dly100us((void*)12000);
return I2C_NO_ERR;
}
rtstofer wrote:
--- In l..., "Kad" "G" wrote:
>
> Hi everybody,
>
> I want to interface the LPC2378 Olimex board with IAR IDE Tool with
24LC512. I downloaded the example code this group's download section.
But I didn't understand
> m24xxwrite(....., char *buf,....) function. Where shall i use my
variable to write in the 24LC512 EEPROM? Please can anyone help me?
Can you give an example code please?
>
> Thanks in advance.
>
> Kursad Gol
>
>
> ---------------------------------
> Be a better friend, newshound, and know-it-all with Yahoo! Mobile.
Try it now.
>
>
>
How about defining you variable as:
unsigned char MyVariable;
Using your abbreviated prototype (because you didn't provide a link to
the real code):
m24xxwrite(..., &MyVariable, ...);
The missing parameters are probably important and one of them should
specify that you are only writing a single byte while another probably
specifies the address.
Richard
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.
----------------------> I2C0CONCLR_bit.STAC = 1; <--------------------------------- this line. Because when i debug the lpc2378 with IAR J Link, before this line the I2C0STAT register's value is (0x08). But after this line the debugger set out I2C0STAT register to (0xF8). So i know that from the LPC2378's datasheet the I2C0STAT register's status (0xF8) is reflecting a bus fault. What can be the problem? I pulled up either SCL0 (P0.28) and SDA0 (P0.27) pins to 3.3 VDD with 4.7K resistors. If shall i pull up the SCL0 and SDA0 pins to 5 V with 4.7K? Please help me friends. I will pray for all of you.
Note: Below code is a part of the code which is standing on this group's download section name of I2C_lib.zip, creator *ytremil*. It was for LPC21XX. I turned it compatible to LPC2378.
Thanks in advance again.
Kursad Gol
static int i2c_lpc_ctrl(int ctrl)
{
int chk;
//-- Set START
I2C0CONCLR = 0xFF; // Clear all bits
I2C0CONSET_bit.I2EN = 1;
I2C0CONSET_bit.STA = 1;
//I2C_FLAG_I2EN | I2C_FLAG_STA;
printf("SI_1.DUR:%d\r", I2C0CONSET_bit.SI);
Dly100us((void*)12000);
while(!(I2C0CONSET_bit.SI)); //-- End wr POINT
//-- Set ADDRESS
I2C0DAT = ctrl;
printf("I2C0DAT:%d\r", ctrl);
Dly100us((void*)12000);
----------------------> I2C0CONCLR_bit.STAC = 1; <---------------------------------
I2C0CONCLR_bit.SIC = 1;
//I2C_FLAG_STA | I2C_FLAG_SI; //-- Clear START & SI
if(ctrl & 1) //-- RD
chk = 0x40; //-- 40H - SLA+R has been transmitted; ACK has been received
else
chk = 0x18; //-- 18H - SLA+W has been transmitted; ACK has been received
printf("SI_2.DUR:%d\r", I2C0CONSET_bit.SI);
Dly100us((void*)12000);
while(!I2C0CONSET_bit.SI); //-- End CTRL
// ??? BURASI NE OLACAK ??? //
printf("CHK:%d\r", chk);
Dly100us((void*)12000);
if(I2C0STAT != chk)
{
printf("I2C0STAT:%d\r", I2C0STAT);
Dly100us((void*)12000);
i2c_lpc_stop();
return I2C_ERR_NO_RESPONSE;
}
printf("I2C0STAT:%d\r", I2C0STAT);
Dly100us((void*)12000);
return I2C_NO_ERR;
}
rtstofer wrote:
--- In l..., "Kad" "G" wrote:
>
> Hi everybody,
>
> I want to interface the LPC2378 Olimex board with IAR IDE Tool with
24LC512. I downloaded the example code this group's download section.
But I didn't understand
> m24xxwrite(....., char *buf,....) function. Where shall i use my
variable to write in the 24LC512 EEPROM? Please can anyone help me?
Can you give an example code please?
>
> Thanks in advance.
>
> Kursad Gol
>
>
> ---------------------------------
> Be a better friend, newshound, and know-it-all with Yahoo! Mobile.
Try it now.
>
>
>
How about defining you variable as:
unsigned char MyVariable;
Using your abbreviated prototype (because you didn't provide a link to
the real code):
m24xxwrite(..., &MyVariable, ...);
The missing parameters are probably important and one of them should
specify that you are only writing a single byte while another probably
specifies the address.
Richard
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.