4
\$\begingroup\$

I have a STM32L MCU connected to M24LR64E, an I2C EEPROM. Previously i had this setup working but then i changed some things (layout, firmware) and somehow i screwed the I2C and it is not working now.

I'm using it with the I2C_DutyCycle_2 mode at 100khz, 4.7k pull-up on both SDA and SCL lines. Everything on the board is working at 3.3v. Below is a shot of both SCL/SDA lines on my scope, sadly i don't have a logic analizer to play with.

Shot of the start of the I2C data

Most of the I2C shots that i've found on Google seems very 'nice' with square-like rise/fall signals, and mine looks very different.

Any suggestions? Does the attached image looks good for a I2C bus?

Thanks, a lot.

\$\endgroup\$
  • 2
    \$\begingroup\$ Looks like there is certainly an issue. How long are the bus traces now? Is there any series resistance or shunt capacitance on the bus? Are you sure you are using 4.7k resistors? (have you measured them?) Does the issue remain when you disconnect the EEPROM? Can you post a zoomed in (shorter timescale) capture of a couple of clock cycles please? \$\endgroup\$ – Oli Glaser Apr 24 '13 at 1:12
  • \$\begingroup\$ The bus traces are one cm long, a bit shorter than they were before. The bus start on the MCU pin, goes to the pullup resistor and finish on the EEPROM pin. Resistors are 1210 SMD and the bus width is 0.2mm. Yes, i measured them off-circuit. I'm going to desolder the eeprom now and test the signals, thanks. I'll get the zoomed shots too. Thanks a lot. \$\endgroup\$ – kR105 Apr 24 '13 at 1:32
  • \$\begingroup\$ Here is a capture of the start, i36.tinypic.com/2hg6cmo.jpg. Exact same capture as on the main post but with a shorter timescale. \$\endgroup\$ – kR105 Apr 24 '13 at 1:46
  • \$\begingroup\$ Two more captures with the EEPROM desoldered from the board: i37.tinypic.com/2hycpwg.jpg i36.tinypic.com/ay7pde.jpg \$\endgroup\$ – kR105 Apr 24 '13 at 2:34
  • \$\begingroup\$ Okay, thanks. From those shots it looks like there is a rogue glitch in each cycle, at least on the clock line. With a 1cm bus length unless there is something really wrong there should be no issue at 100kHz, and the rise/fall times look okay, so I think the firmware needs to be looked at closely. Can you post the relevant bits - the I2C setup code and the send/receive routines please? Ideally the code before and after it stopped working. Anything else you think may be worth adding also (e.g. did you change the main/peripheral clock frequency?) \$\endgroup\$ – Oli Glaser Apr 24 '13 at 2:51
2
\$\begingroup\$

Fixed. Thanks to Oli Glaser i fixed the clock config routine and the scope captures looks very good now, but the main issue (MCU not reading the EEPROM) persisted. After hours and hours of debug, trial/error, datasheets, erratas, forums, etc i found that somehow i changed the SLAVE DEVICE ADDRESS on my code so the EEPROM was not answering because i was not calling it properly!

To any future reader, the 7-bit device address for this device should be 0x53 or 1010011b (Don't forget the proper left shifting and set the read/write bit to get the full byte).

Thanks for all the help and as expected, i learned A LOT from this issue!

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.