the isr comes asap i must clean my code,it is longer your ISR looks not bad - but i think you get a problem, if the master send the addr and then a stop, you have no routine for this; i will check your isr ,, have seen the reply and have done reply fast.

@apollo0226where is your code?work in this and i am sure you will do it too, the important things is, opendrain and ack doing.now you have this in two difference ways.because i do step by step ( bit by bit ) in the debug code..i allways check in this debug version 0.1 each int fire for start, stop.. and i do this difference to switzerland.switzerland use a "while on the scl"i use interrupt on SDA and SCLthis is the difference.

@dkaufmanndo you have a master code too?can you create and select for master 10Khz example? ( not faster because debug prints in the isr ) and for address example 0x30master read one byte ( Last = 1 ) i build the slave and i give you then the value of read counter backthis means that we do the things like this:

a lot of comments . Thanks for your review. In which case it happens, that a stop comes from the master after sending the address? I will add a general interrupt on the STOP signal, too. So I can stop the whole communication independent of the state. Thus, I also had a version with SCL and SDA interrupt (without while loops). The problem was, that it was too slow for 100 kHz. This is why I changed my code to only Start interrupt and then stay in the ISR.Sorry, implementation of a master is not planned at the moment. (not needed in my project, and no time at the moment.) If I do later, I'll post it.

a lot of comments . Thanks for your review. In which case it happens, that a stop comes from the master after sending the address? I will add a general interrupt on the STOP signal, too. So I can stop the whole communication independent of the state. Thus, I also had a version with SCL and SDA interrupt (without while loops). The problem was, that it was too slow for 100 kHz. This is why I changed my code to only Start interrupt and then stay in the ISR.Sorry, implementation of a master is not planned at the moment. (not needed in my project, and no time at the moment.) If I do later, I'll post it.

have a nice one!

if the master break example the communication - you must "agieren" and "handle" this.so my "teaching steps" was bit for bit in cases...

yes you right, your doing is faster in this part, my doing with int on sda + scl makes the slave slower but exactly.and the prints do make isr slower too. so this is going well do 25 Khz with debug prints..if i delete the debug prints i can go on to 400 KHz with 160 MHz CPU

this was the v 0.1 so never push your last version you work on this only for teach / follow steps for understanding... ( Opendrain, ACK, Start, Stop ..)

the homework must be done by the user.i like your version.i like the mine too

I'm surprised that you manage to reach 400kHz with your method. When I implemented the interrupt driven version (with SCL and SDA interrupt), it already stopped to work with 100kHz. The interrupt latency was too high. From 100kHz I started to miss the next edge (from rising to the next falling edge on SCL). Do you have an idea why? (my ESP8266 runs with 80MHz which should be fast enough).

I'm surprised that you manage to reach 400kHz with your method. When I implemented the interrupt driven version (with SCL and SDA interrupt), it already stopped to work with 100kHz. The interrupt latency was too high. From 100kHz I started to miss the next edge (from rising to the next falling edge on SCL). Do you have an idea why? (my ESP8266 runs with 80MHz which should be fast enough).

Thanks for the help.

best regardsD.

Yes you are right!my fastest with this v 0.1 methode is 120..KHzin the others i use asm instruction because the gpio switch is very slow, and ( i think it was the ESP-04 for best result ) if you take difference ESP modules there can be time difference in switching ( capazitors on gpio=bad idea )

with 80MHz it is 12.5 nswith 160 MHz it is 6.5 ns ( had measuring on time this by 6.2 ns - see picture in this thread i started long time ago)just in time i maked a pause on this, in the past last year in spring, i wrote things here:http://www.mikrocontroller.net/topic/358654

Documentation

About Us

Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. We are the manufacturer of ESP8266EX.