Announcement

Collapse
No announcement yet.

I2C doesn't seem to be working

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • I2C doesn't seem to be working

    I'm currently using a DS1307 RTC on the I2C bus of my 4Duino. It has been working. I connected it up this morning and doesn't appear to be working now. Is there a way to test if the I2C is working correctly on the 4Duino-24 board? If the SCL and SDA lines get switched, can that damage the board or the RTC or will it just not work if the wires get flipped?

  • #2
    there wont be damage if the wires are reversed, it wont work though obviously. did you put any pullups on the i2c lines?

    note the 4duino uses the arduino leonardo processor and has same pinout. sda/scl are on digital pins 2 and 3 (not analog)

    Comment


    • #3
      I did not use any pullups on the i2c lines. It was working for weeks without any. I am connecting to the pins labeled SDA and SCL pins and that was working.

      Comment


      • #4
        Hi,

        If it is a RTC module on a board there is a good chance it has pullups already so it may be alright as it is. It might say in the datasheet for the module if pullups are on the board. If not it will have to have pullups attached on the SDA SCL,

        Has there been any change in the code since the last time it was working ?

        Best regards

        Paul

        Comment


        • #5
          I was able to get it to wok again. I had to reset the time on the RTC. All seems to be good again. Thanks for the help

          Comment


          • #6
            I am starting a project which requires the I2C lins, and noticed that there is a error in the 4Duino-24 data sheet. The description of the lines for SDA and SCL seems to be swapped if they are compared to the picture.

            Click image for larger version

Name:	4Duino SDA - SCL.JPG
Views:	2
Size:	347.4 KB
ID:	58381
            Attached Files

            Comment


            • #7
              I'm having problems changing from a uLCD-43D to a Gen4-uLCD-43D-S8-SB. I fell into the trap of continuing to use PA12/13 which is no longer allowed, so I swapped to PA7/6 which I have used before:

              I2C1_open(I2C_SLOW, PA12, PA13) -> I2C1_open(I2C_SLOW, PA7, PA6)

              However I just cannot figure out why I cannot get it to work. The SCL signal is active (wired to SCL on the target, seen on a 'scope) but the SDA line seems to be stuck HI (pulled up). The code is the same as I have been using for a year! If there are any issues I can't see anything on this forum. I guess I will have to start from scratch with a new test program and slog it out trying other pins etc etc....

              Comment


              • #8
                DOH! I was using PA6 for something else, the later definitions overwrote the I2C setting.... NOTE to myself be very wary when changing the hardware!

                Comment


                • #9
                  Hello,

                  Thank you for letting us know, You are not the only one, countless times I have done that.

                  Best regards

                  Paul

                  Comment


                  • #10
                    Hi again
                    I am porting my programs to Gen4-uLCD-43D-SB and again I have a question about using PA12/13 for I2C. According to the Datasheet (V1.5) if I use the non-touch version it appears to be possible to use PA12/13 for I2C, see page 10, the warning on page 9 on PA12/13 states that it should be possible to use these pins for the D version.I have tried to make I2C1 work with PA12/13 and I can see SCL with a 'scope but SDA seems stuck HI. Would someone confirm whether I2C will work or not? Maybe I am missing something and I should keep trying or just use other pins (which work OK)?
                    Bryan

                    Comment


                    • #11
                      Hello Bryan,

                      Yes, this should work for you. PA12 which is GPIO13 on the PA and PA13 which is GPIO14 on the PA should work with I2C and you are correct in saying that the datasheet states PA12 and PA13 as ok to use with I2C.

                      I hope this helps

                      Best regards

                      Paul

                      Comment


                      • #12
                        Hello Paul

                        I just tested the use of Pa12/13 for I2C on the non touch D version again a bit more carefully with some better test leads - yes it does work!

                        Can you point me at more information on the details of the reserved GPIO15/PA14 and GPIO16/PA15 'special' I2C use at 400kHz/1Mhz ? This could be of use for me where the I2C signals have to travel over a short cable, so the slew rate limiting could be useful...
                        Best
                        Bryan

                        Comment


                        • #13
                          Hi Bryan,

                          The only information we have is on page 11 in the datasheet http://www.4dsystems.com.au/productp...heet_R_1_5.pdf but bascilally it is just a matter of setting the speed in the I2C open command and the slew rate control should be handled automatically.

                          Best regards

                          Paul

                          Comment


                          • #14
                            Hi Paul
                            I thought as much so I made some more tests. I was able to use either PA12/13 OR PA14/15 (at 400kHz). At 250kHz the rise-time on the SCL line was about 2uS, at 400kHz the voltage at the peak is only about 3V and just placing my finger on the SCL line would cause errors, at 250kHz I could not force errors that way. So I cannot risk using I2C at 400kHz for my current hardware - an Adafruit product at present, but maybe a bespoke pcb at some point at 3.3V without any 5V level shifting so probably with a faster rise-time. I will need to read up about slew-rates when I have more direct control over the loading. I suppose I could simply add a pull-up resistor on the next pcb version. It was a long time ago when I last implemented an I2C design so I'm not sure if it is O/C driven or push/pull.

                            Thanks anyway
                            Bryan

                            Comment


                            • #15
                              i2c was meant to be in-circuit not wired up, 400khz is never guarenteed, even in noisy environments alot of people go below 100khz for reliability

                              Comment

                              Working...
                              X