cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Adventurer
Adventurer
397 Views
Registered: ‎09-21-2019

EEPROM application using GPIO

Hey all,

I want to read and write in eeprom using microblaze .For that i have taken GPIO as IO port .and write a code into microblaze.

When i am going to  run it.it neither write nor read. I used ILA and in that always getting SDA and SCL high.

How to do it using GPIO .

0 Kudos
Reply
7 Replies
Highlighted
Teacher
Teacher
383 Views
Registered: ‎07-09-2009

Do I understand you have a I2C EEPROM ?

did you remember to add the pull up resistors on the I2C lines ?

Out with oscilloscope and probe the real lines,

I'm guessing your "bit banging" the I2C ,
This is not your problem, but will be.
I2C was originally "designed" for a nice symmetrical clock,
yes later i2C added pulse stretching, but its implementation i devices is , in my experience , patchy,

Most all , certainly all the ones I have seen, do not bit bang I2C , but use a I2C master, and the processor talks to that in the FPGA much like it would to a UART.

There are plenty of I2C cores around, many for free,

for example
https://www.xilinx.com/products/intellectual-property/axi_iic.html
<== If this was helpful, please feel free to give Kudos, and close if it answers your question ==>
0 Kudos
Reply
Highlighted
Adventurer
Adventurer
370 Views
Registered: ‎09-21-2019

Thanks for reply

Yeah I am using I2C EEPROM.

I have checked in schamatic ..pull up resistors  are there on I2C line.

When i am probing on osilloscope then on scl pin i am getting the pulse but SDA line is always high.

0 Kudos
Reply
Highlighted
Teacher
Teacher
345 Views
Registered: ‎07-09-2009

with SDA always high, you are not getting a start ./ stop on the I2C.
<== If this was helpful, please feel free to give Kudos, and close if it answers your question ==>
0 Kudos
Reply
Highlighted
Adventurer
Adventurer
321 Views
Registered: ‎09-21-2019

Hey,

Thanks for reply.

Yes i am not getting the start condition as i have called the write_start function but then i am not getting anything on SDA pin but on scl it becomes low  .

void EEPROM_WriteStart_Condition(void)
{
MAKE_CLK_PIN_HIGH()                               // make CLK pin high
Configure_Pin(SDA,OP_PIN);                       // This function will configure SDA pin as OP pin
MAKE_SDA_PIN_HIGH()                             // make SDA pin high
Delay_uSec(3);                                             // This function will introduce 3 microsecond delay
MAKE_SDA_PIN_LOW()                            // make SDA pin LOW
Delay_uSec(3);                                          // This function will introduce 3 microsecond delay
MAKE_CLK_PIN_LOW()                           // make CLK pin LOW
return;                                                       // go back to caling function
}

0 Kudos
Reply
Highlighted
Teacher
Teacher
301 Views
Registered: ‎07-09-2009

If it simulates OK, then you have a board problem,

But that code , with things like delay_uSec(3) looks terrible, how are you going to garuntee the delay in a processor ?
<== If this was helpful, please feel free to give Kudos, and close if it answers your question ==>
0 Kudos
Reply
Highlighted
Adventurer
Adventurer
296 Views
Registered: ‎09-21-2019

@drjohnsmith Thanks for reply..

Suggest me instead of delay what i can use?

0 Kudos
Reply
Highlighted
Teacher
Teacher
273 Views
Registered: ‎07-09-2009

Use a I2C block that handles the I2C for you ,
and looks like a UART to the processor.
<== If this was helpful, please feel free to give Kudos, and close if it answers your question ==>
0 Kudos
Reply