GithubHelp home page GithubHelp logo

Comments (21)

C47D avatar C47D commented on June 11, 2024

Hi @ndunello,

About the change on .pin_bit_mask i think this is better:

diff --git a/components/lvgl_esp32_drivers/lvgl_touch/xpt2046.c b/components/lvgl_esp32_drivers/lvgl_touch/xpt2046.c

index 6425030..2c1901b 100644
--- a/components/lvgl_esp32_drivers/lvgl_touch/xpt2046.c
+++ b/components/lvgl_esp32_drivers/lvgl_touch/xpt2046.c
@@ -52,7 +52,7 @@ uint8_t avg_last;
 void xpt2046_init(void)
 {
    gpio_config_t irq_config = {
-       .pin_bit_mask = 1UL << XPT2046_IRQ,
+       .pin_bit_mask = BIT64(XPT2046_IRQ),
        .mode = GPIO_MODE_INPUT,
        .pull_up_en = GPIO_PULLUP_DISABLE,
        .pull_down_en = GPIO_PULLDOWN_DISABLE,

Thanks for the report, I will try to replicate it later today, were you using 30cc022?. What SPI were you using?

What do you mean by the touch doesn't work? Does the touch is not calibrated? You touch the screen but it doesn't do anything?

Regards

from lv_port_esp32.

ndunello avatar ndunello commented on June 11, 2024

Hi @C47D,
I use HSPI_HOST.
About "30cc022", forgive me, but I can't answer. how do i get it?
Yesterday I downloaded master "zip" file from the repository.

Regards

from lv_port_esp32.

C47D avatar C47D commented on June 11, 2024

About "30cc022", forgive me, but I can't answer. how do i get it?
Yesterday I downloaded master "zip" file from the repository.

30cc022 is the commit you're working on, if you downloaded master zip file then yes, you're using 30cc022 :), please let me test it later today and see why the touch controller isn't working.

from lv_port_esp32.

C47D avatar C47D commented on June 11, 2024

I found a problem in xpt2046_init function in xpt2046.c file.
I modified
.pin_bit_mask = 1UL << XPT2046_IRQ,
to
.pin_bit_mask = 1ULL << XPT2046_IRQ,

This issue is solved with 5dfc897.

I wired up the ILI9341 based display I have at hand and couldn´t make the IRQ pin signal of the touch sensor go low when I touch the screen, it only worked once and then I couldn't get it working again, do you also have this issue? Is it a known problem?

from lv_port_esp32.

bzgec avatar bzgec commented on June 11, 2024

I wired up the ILI9341 based display I have at hand and couldn´t make the IRQ pin signal of the touch sensor go low when I touch the screen, it only worked once and then I couldn't get it working again, do you also have this issue? Is it a known problem?

Same here.
In my case it only works in this sequence:

  • board must be disconnected for few seconds (around 30s)
  • connect the board to computer (do not touch display)
  • flash new program to the board (even if there are no changes)
  • everything works well

But if you reset the board or disconnect the power and than reconnect it again it works only for one click.

from lv_port_esp32.

C47D avatar C47D commented on June 11, 2024

Hi,

I will try your sequence, yesterday I ended up searching the problem on arduino forums and found nothing related, do you think this is an issue with the touch controller or maybe we're configuring wrong the IRQ pin on the esp32 side?

from lv_port_esp32.

bzgec avatar bzgec commented on June 11, 2024

Commit 0de169d works fine for me (i am not testing on shared SPI).
I am still trying to figure out what could be the cause of the problem.

from lv_port_esp32.

C47D avatar C47D commented on June 11, 2024

I can try bisecting until find the faulty commit.

This lines aren't commented out on 0de169d
https://github.com/littlevgl/lv_port_esp32/blob/5dfc897a3769380869014d132dc3b62f064ab4f2/components/lvgl_esp32_drivers/lvgl_tft/disp_spi.c#L135-L136

from lv_port_esp32.

bzgec avatar bzgec commented on June 11, 2024

I think I found the solution with the help of logic analyzer. The problem was in tp_spi.c file. SPI configuration was set to full duplex mode and the attempt to set it to SPI_DEVICE_HALFDUPLEX in spi_transaction_t instead in spi_device_interface_config_t.
The two functions i changed.

void tp_spi_add_device(spi_host_device_t host)
{
	spi_device_interface_config_t devcfg={
#if CONFIG_LVGL_TOUCH_CONTROLLER == TOUCH_CONTROLLER_STMPE610
		.clock_speed_hz=1*1000*1000,           //Clock out at 1 MHz
		.mode=1,                               //SPI mode 1
#else
		.clock_speed_hz=2*1000*1000,           //Clock out at 2 MHz
		.mode=0,                               //SPI mode 0
#endif
		.spics_io_num=TP_SPI_CS,               //CS pin
		.queue_size=1,
		.pre_cb=NULL,
		.post_cb=NULL,
        .command_bits = 8,
        .address_bits = 0,
        .dummy_bits = 0,
        .flags = SPI_DEVICE_HALFDUPLEX | SPI_DEVICE_NO_DUMMY,
	};
	
	//Attach the Touch controller to the SPI bus
	tp_spi_add_device_config(host, &devcfg);
}

and

void tp_spi_read_reg(uint8_t reg, uint8_t* data, uint8_t byte_count)
{
	spi_transaction_t t;
	// spi_transaction_ext_t et;
	
	memset(&t, 0, sizeof(t));
	    
	// Read - send first byte as command
	t.length = byte_count * 8 + sizeof(reg);
	t.rxlength = byte_count * 8;
	t.cmd = reg;
	t.rx_buffer = data;
	t.flags = 0;
	esp_err_t ret = spi_device_transmit(spi, &t);
	assert(ret == ESP_OK);
}

I noticed that tp_spi_write_reg() function also has this error.

from lv_port_esp32.

C47D avatar C47D commented on June 11, 2024

@bzgec I've added your modifications to this branch https://github.com/littlevgl/lv_port_esp32/tree/fix_70 could you test it? I didn't had time to solve the IRQ pin working only once.

from lv_port_esp32.

bzgec avatar bzgec commented on June 11, 2024

I was too fast and made a mistake.

t.length = byte_count * 8 + sizeof(reg);
should be changed to
t.length = (byte_count + sizeof(reg)) * 8;

from lv_port_esp32.

ndunello avatar ndunello commented on June 11, 2024

I just tried https://github.com/littlevgl/lv_port_esp32/tree/fix_70 and I can see the print of the coordinates on the console.
Now, if i touch on "Write", "List" and "Chart" tab nothing is happening. Its coordinates are (approximately in the center):
"Write": x = 104, y = 191
"List": x = 73, y = 188
"Chart": x = 45, y = 190
did I make any mistakes in the configuration?
The touch display I use is this

from lv_port_esp32.

bzgec avatar bzgec commented on June 11, 2024

I created the pull request to fix this:

I was too fast and made a mistake.
t.length = byte_count * 8 + sizeof(reg);
should be changed to
t.length = (byte_count + sizeof(reg)) * 8;

On branch fix_70, it is working ok for me, but i did not test for shared SPI.

from lv_port_esp32.

bzgec avatar bzgec commented on June 11, 2024

"Write": x = 104, y = 191
"List": x = 73, y = 188
"Chart": x = 45, y = 190
did I make any mistakes in the configuration?

I guess that you need to change Touchpanel Configuration.
Here is my configuration (note that i have 3.2 inch display):
TouchpanelConfiguration_XPT2046

from lv_port_esp32.

ndunello avatar ndunello commented on June 11, 2024

OK, works "almost" well.
the last problem is in partial display, as in the figure.
2 8_240x320
Display Configuration is
2 8_240x320_TFT
Touch Configurazion is
2 8_240x320_Touch
@bzgec what resolution does your 3.2 inch display have?

from lv_port_esp32.

pratikmokashi avatar pratikmokashi commented on June 11, 2024

@ndunello You have wrong configuration in the display
correct setting :-
(320) TFT display width in pixels.
(240) TFT display height in pixels.

from lv_port_esp32.

ndunello avatar ndunello commented on June 11, 2024

thank @pratikmokashi, you are perfectly right!
Now everything works fine
Thank you all

from lv_port_esp32.

C47D avatar C47D commented on June 11, 2024

@bzgec can you test it with shared SPI buses?

@ndunello great, is the touch working properly? Are you still using the same pinout as your first post?

from lv_port_esp32.

ndunello avatar ndunello commented on June 11, 2024

@C47D:

  • yes, touch working properly!
  • yes, I use same pinout as my first post (SHARED_SPI_BUS)

from lv_port_esp32.

pratikmokashi avatar pratikmokashi commented on June 11, 2024

@ndunello can you help me how to use the touch with this display?
And all the setting you used for it work.
It would be great if you can add the pins you configured

from lv_port_esp32.

C47D avatar C47D commented on June 11, 2024

@bzgec @pratikmokashi @ndunello thanks everyone for the help to close this issue :)

@pratikmokashi the pins used are listed on the first message of the issue

from lv_port_esp32.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.