General Category > Discussion - EVE

How often and when read REG_TOUCH_TAG

(1/2) > >>

Rad:
Hi,

as in the subject:
is there any practical/theoretical redord/order when and how often REG_TOUCH_TAG can be read?

Once, testing some code I (mistakenly) read this reg every 1 millisecond and noticed that EVE started to crash. It took me a while to get it noticed that I do it too often.

Another point is about then this reg should be read:
can it be read anytime or rather once EVE finishes processing a freame buffer and REG_CMD_WRITE = REG_CMD_READ ?

sjasz:
In our code, REG_TOUCH_TAG is read 20ms after CMD_SWAP. It doesn't check REG_CMD_WRITE = REG_CMD_READ before it is read. I inherited this code so didn't verify the 20ms myself, but the person that did told me it needed to be there, and was a conservative amount of time to wait.

Our code alternates between drawing pages and reading REG_TOUCH_TAG as fast as possible, so only ever reads REG_TOUCH_TAG after drawing a page. It never reads REG_TOUCH_TAG two times in a row. 

Sorry, not as empirical as you may have liked, but it has been 100% stable for several years.

Rudolph:
My code usually checks for touch events every 5ms and that function does three reads now.
Reading REG_CMDB_SPACE to check if EVE is still busy from the display refresh or if there was a co-processor fault.
Reading REG_CMD_DL as a debug measure to get the size of the last generated display-list.
Reading REG_TOUCH_TAG.

I just did an experiment with a Teensy 4.1 under Arduino as this was wired up to the logic analyzer.
The SPI clock is 16MHz.
I moved out the function call to check for touch events that I placed in the loop() function to outside
the code that checks that 5ms passed.
And all that happens is that I can see with the logic analyzer that the SPI is flooded.
The REG_TOUCH_TAG is read every 12µs.

Now I commented out the reading of REG_CMD_DL which means that REG_TOUCH_TAG is read every 8µs.

Ok, I can get away with not reading REG_CMDB_SPACE since I have an internal flag for the DMA transfer of the display update.
And reading REG_TOUCH_TAG does not interfere with the co-processor.
Now the logic-analyzer traces shows reads of REG_TOUCH_TAG about every 3.6µs.

And the EVE3-50G module which has a BT815 and a GT911 is just fine.
No crash and the touch still works fine.

So no, there does not appear to be a limit on how often REG_TOUCH_TAG can be read.
My display update is every 20ms though, so it really does not help to read the register >5400 times in between. :-)

My main loop does this now, 5ms per step:
read read read display read read read display

And there probably would not be a noticeable difference if I changed that to >read / display< with 10ms steps.

Hmm, I wonder now how long touch events actually are, or rather how short these can get.
I went back to reading REG_TOUCH_TAG every 12µs and added a counter that is set to 1 on registering the touch of a button and gets increased as long as the button is touched.
And I can not get this time realiably below 3000.
Right now the number is 1142 which meant I managed to touch the button for only 13ms.
2161 - 28ms
976 - 12ms
2138
3298
4417
3275
3304
2156

Going back to 5ms timeslots I can not get the counter lower than 3.
And not trying to touch as fast as possible I get closer to 20.

So I guess it is ok to assume that the duration of touch events is at least 10ms.

KarolBob:
Hi there.
I've been recently testing the method with interrupt handling from the touch panel. Thanks to this, it's possible to practically not send anything to FT/BT81x for most of the time. When an interrupt occurs, only then do I read the TAG. Here's the interrupt configuration:

--- Code: ---void EVE_INT_config(void)
{
    EVE_memWrite8(REG_INT_EN,1);                // IRQ on
    EVE_memWrite8(REG_INT_MASK,EVE_INT_TAG);    // EVE_INT_TOUCH|
    EVE_memRead8(REG_INT_FLAGS);                // clear by read flag
}

--- End code ---

Then, in loop functions:

--- Code: ---if(is_set(FLAGS,_f_tp_irq))
        {
            CurrTag = EVE_memRead8(REG_TOUCH_TAG);
            RESET(FLAGS,_f_tp_irq);
... // the rest of the code
            // refresh the screen by set timDisp to 0
            timDisp = 0;
            EVE_memRead8(REG_INT_FLAGS); // skasuj flagi
            timer_screensaver = time_screensaver; // przeładuj timer wygaszacza ekranu
        }
        // prepare a new display list:
        if(!timDisp)
        {
            timDisp = 50;     
            // start new 'display list'
            start_new_screen();
...// etc
            finish_new_screen();
        }

--- End code ---
Also IRQ from pin change:

--- Code: ---ISR(INT7_vect)
{
    SET(FLAGS,_f_tp_irq);
}
--- End code ---

vdc:
Have anyone test with EVE4 1024x600 resolution display?

Current, I'm having Tiva with SPI at 16Mhz. What my display doing is load bitmap RGB565 (371x400) from flash to RAM_G, with 3 buttons. The total time it takes about 45ms. I'm not sure why it take that long to display one screen. The worst case can be more.

By that, I only can scan key every 100ms. My code doing is having a flag at 100ms. when flag is set, it scan and display. I can't find any better way to handle display and touch function.

I do feel like the cmd list I send from MCU to EVE4 is fast but the time for EVE4 display on screen is take so long that I can't do same as @Rudolph that scan key for every 5ms and display every 20ms.

I haven't try to use DMA or QSPI yet, but my setup is really simple and it take that long to display so I'm not sure using DMA/SQPI will improve the display time or not.

Navigation

[0] Message Index

[#] Next page

Go to full version