General area when it fits no where else

Moderator: Mmiscool

User avatar
By viscomjim
#36451 I've never used an arduino before, but I am digging as much as I can for answers to this. I found this information about initializing the pins for the wire library on the esp-01. Could this be something to check.

"Wire library currently supports master mode up to approximately 450KHz. Before using I2C, pins for SDA and SCL need to be set by calling Wire.begin(int sda, int scl), i.e. Wire.begin(0, 2) on ESP-01, else they default to pins 4(SDA) and 5(SCL)."

I also found this in the arduino forum...
by IGRR
By default, I2C is set up to use GPIO4 and GPIO5. If you want to use GPIO0 and GPIO2, you need to add
Wire.pins(0, 2);

Also, could you add the option to set the clock speed. I think just having the ability to set it to 100khz or 400khz would be good. Arduino code for that is Wire.setClock(100000);.

I am going to try and flash the arduino firmware and try my simple test for the display to see if it works under this environment. Might take a while as I never used this platform before. Never too old to learn a new trick... I think.

Thanks.
User avatar
By viscomjim
#36626 I am wondering if no one else is using i2c with this BASIC port. If anybody has had success with implementing ANYTHING i2c other than the DS3231 from Matherp, can you please shed a little light? I don't want "FREE" code, I just want to see how you got this to work.

ANYONE?????

After doing a bit of time consuming research, I can see that my last post being completely without response, it seems what I have been chasing is being implemented. It would have saved a huge amount of time if someone took 1 minute to say, hey you are chasing the wrong tail, or something like that. Anyway, I won't give up. Just waiting on my LA to make comparisons on a working and non working situation. I hope to be able to contribute to this effort eventually, as I really like the effort, but... getting somewhat discouraged with the lack of response. Even something is better than nothing....

Thanks...
User avatar
By Mmiscool
#36629 Sorry about the lack of response. I personally don't have a lot of experience with i2c and don't really know where to start.

Because the arduino function are implemented as pas threw if it will work in arduino land it should work in basic land.

Possibly try like the following. There might be some thing I am missing from the implementation. If so it needs to be added.

Code: Select allmemclear

i2c.begin(112)
i2c.write(33)    ‘HEX 21
i2c.write(129)  ’HEX 81
i2c.write(239)  ‘HEX EF

i2c.write(0)
i2c.write(6)

i2c.write(2)
i2c.write(90)

i2c.write(6)
i2c.write(79)

i2c.write(8)
i2c.write(102)
i2c.end()
end
User avatar
By viscomjim
#36811 Well, after waiting a week to get my logic analyzer, its finally here. I hooked it up first to the micromite circuit with the display to see what the I2C data looked like with the display working. All is as expected... using the code first posted here in this thread.

I then hooked it up to the esp with the same display, not working and checked the I2C output. Here is the code used.

Code: Select allmemclear

address = 112  'HEX 70

i2c.begin(address)
i2c.write(33)    ‘HEX 21
i2c.write(129)  ’HEX 81
i2c.write(239)  ‘HEX EF
i2c.end()

delay 10

i2c.begin(address)  ’FIRST DIGIT
i2c.write(0)
i2c.write(6)
i2c.end()
delay 10

i2c.begin(address)  ‘SECOND DIGIT
i2c.write(2)
i2c.write(90)
i2c.end()
delay 10

i2c.begin(address)  ’THRID DIGIT
i2c.write(6)
i2c.write(79)
i2c.end()
delay 10

i2c.begin(address)  ‘FORTH DIGIT
i2c.write(8)
i2c.write(102)
i2c.end()
delay 10

end


So basically, its supposed to send 3 bytes to set up the display and then sends a display byte to each of the four digits. So a total of 5 I2C.begins. The LA shows "setup write to 0x70 + NAK" five times and that is all. No writes at all are output. Running the code that Mike posted just before this one, does one "setup write to 0x70 + NAK" as there is only one i2c.begin in that code. So apparently the i2c.write is not working correctly. Again, I did verify this working using the uMite and can see on the LA the setup write to 0x70 and the data bytes exactly as in the program.

So it looks like the i2c.write is not working as there are no data bytes being sent.

Is there anything else I can test to see what is going on? Do you have any other code examples I could try? Does anyone else have I2c working correctly? It seems that the i2c.read is working as Matherp has been able to read the time values from the DS3231. I do see there is one write in the code but it is a zero and maybe a fluke that it is working when reading.

Please, any help would be greatly appreciated.