almindor / mipidsi

MIPI Display Serial Interface unified driver
MIT License
108 stars 46 forks source link

Initializing the ili9341 affects the touch #86

Closed yanshay closed 3 months ago

yanshay commented 7 months ago

I experience a very strange behavior with my board, maybe you can assist troubleshooting: I'm using a board esp32-2432s028r that use ili9341 for display and xpt2064 for touch.

Normally, the touch is pretty accurate, meaning if I don't make a move of the pen on the display the data comes pretty consistent between samples. Once I initialize the Ili9341 with mipidsi , the x data of the touch becomes very very noisy. It still reflects changes along the x axis, but it is very jumpy (so instead of a delta of less than 12 between samples it is over 100 between samples)

I thought it may have to do with me using SPIInterfaceNoCS and not using the cs pin, even though the board use different SPI buses for each of the devices. So I tried to use the cs with SPIInterface::new but then I faced with an issue with rust where it complains:

    |
118 |         let di_cs= io.pins.gpio15.into_push_pull_output();
    |             ----- move occurs because `di_cs` has type `GpioPin<Output<esp32_hal::gpio::PushPull>, 15>`, which does not implement the `Copy` trait
...
127 |             di_cs,
    |             ----- value moved here
...
134 |         let di = SPIInterface::new(di_spi, di_dc, di_cs);
    |                                                   ^^^^^ value used here after move

Even though my code for cs and dc is the same and I didn't see any difference between cs and dc in SPIInterface code.

almindor commented 3 months ago

Sorry this issue somehow crept through the cracks. Is this still relevant? It seems odd that you'd get issues with two separate SPI buses.

Are they completely exclusive? e.g. each bus has separate pins all around?

yanshay commented 3 months ago

It seems like the display generates noise for the touch. I had to implement filtering no the touch to take out most of the bad samples. Anyway, I'll close this.