Internal ESP timing and I2C

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Morsk
Normal user
Posts: 1
Joined: 30 May 2018, 12:39

Internal ESP timing and I2C

#1 Post by Morsk » 24 Jun 2018, 21:36

I am trying to read data from a scanning led display. I build some hardware that latches scanned data based on a three bit address given by three ESP gpio lines. The latched data is than read by a PCF8584 via I2C. In principle this works, but I like it to update faster and therefore try to understand the underlying internal ESPeasy timing.
When I define 6 tasks/devices for 6 PCF8574 lines I see that the ESP is reading the PCF 6 times with very short interval and (with no rules active) repeats this every second. It seems that the standard refresh is 1 sec, which means I need 6 seconds for my display. However as soon as I start to add rule code to switch the address lines, the 1 sec increases and the reading of the I2C gets weird. See picture.
Image

This is the timing part of the rules I use:
On Rules#Timer=1 do
timerSet,1,1
Event,SetScan2 // Set gpio's
TaskValueSet,11,1,[VarSet2#Scan]+1
If [VarSet2#Scan]>6 // 0..6 (er geen groep 7)
Taskvalueset,11,1,0
Endif
endon

- The SetScan2 event sets the address lines based on the value of VarSet2#Scan (being dummy device 11, variable 1). So the delay is just 1 second, but the progress is per 2 or 3 seconds (see picture). Why is that?
- The reliability of the data latched and then read by the PCF depends on the delay between the A0 edges and the I2C reading. This is always approx 70ms (even if I add a delay between timerSet,1,1 and Event,SetScan2). How is this timing organized?

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests