onetransistor / arduino-libraries

Arduino compatible libraries
GNU General Public License v3.0
7 stars 5 forks source link

SX8646 with ESP8266 #1

Open Regdr opened 10 months ago

Regdr commented 10 months ago

Hello, I have your same display panel, but when I compile just the example for the touch (here on github) and upload to the ESP8266, it keeps rebooting, is there a way to make it working on ESP8266? I thank you much for giving me and other people the possibility to give new life to hardware that was forgotten for years

onetransistor commented 9 months ago

Hi! I will look into this, I guess there is an issue with the way I enabled interrupt for touch panel.

Regdr commented 9 months ago

Thank you sooo much @onetransistor, the problem it stops if I disable keypad.begin();

onetransistor commented 9 months ago

But have you been able to use the keypad after all?

Regdr commented 9 months ago

Hello, after that the keypad doesn't work, the Led don't react to the touch

Jan3726 commented 9 months ago

Hello. I found your guide from OpenWrt, I had this Hardware too, waiting for some firmware is a waste of time, so I decided to recycle the front panel and I found your website, I was able to make the TFT work, now I wrote all the code and ended the TFT side, now I would like to make the touch work, but I have the same problem like @Regdr, I tried to compile only the code to test the Touch on ESP32 and tried also on ESP8285 and ESP8266 but all of them give the same problem, the touch seem to be reconized because the leds react to the touch, but I do not see answer on serialprintln() because is restarting, I tried to compile using all GPIO on all 3 ESP, but always the same result.

I have too, to make compliments to your guide and all projects on your site.

onetransistor commented 9 months ago

Yes @Jan3726, there is a problem with the way I implemented the interrupt in library.

Jan3726 commented 9 months ago

Hello, I tried to fix it, but arduino for me is not that simple, I hope there is a possibility to be fixed.

Thank's @onetransistor and Happy Xmas

onetransistor commented 9 months ago

Happy Holidays @Jan3726. Finally, it was just a small thing I missed.

Open SX8646.cpp file, find the interrupt function and add ICACHE_RAM_ATTR like this:

Change this:

void handleInterrupt(void) {
    pThis->handleInterruptInClass();
}

To this:

ICACHE_RAM_ATTR void handleInterrupt(void) {
    pThis->handleInterruptInClass();
}

This is ESP only and will probably not compile on other Arduinos. Let me know if it helps so I can update the library.

Jan3726 commented 9 months ago

Thanks it looks like is working on ESP8285, later I'll try on ESP32 and ESP8266, I'll write after the tests.

Thanks @onetransistor

Jan3726 commented 9 months ago

Hello, on ESP32 is not working still rebooting I tried also to change with IRAM_ATTR but no way to make it work, the display is connected with ES32 because of stability and more free GPIO, If i do no connect the INTB pin it does not reboot

Samu84 commented 9 months ago

Hello. I am reading all your projects from some months (they look really interesting and explained really well), unfortunately I am using ESP32 too and same hardware, I have also the other type of LCD and Keypad from SHG1500. I have to say that other version of keypad I think is working too, because is using same hardware SX8646 , only difference that is not connected to the frontpanel but on the mainboard, instead the LCD is using FPGA xilinx.

However going back to the subject, I have the same hardware, but, like @Jan3726 I am using ESP32 so I have the same Problem, I am just thinking, is not because the CPU is faster than STM32, ESP8266, ESP8285, and ESP32 is executing the function too fast and is not synchronized with INTB? I have only ESP32-WROOM-32 also because I think ESP8266 would not be able to support more than 20pages. I was able to connect ESP32 arduino with SHG1500 TFT to Home Assistant using Json and WebHook, is so usefull, just missing the keypad :(

PS: really good way to recycle hardware forgotten for YEARS, really good SITE , I was able to recycle another display (SC75823), a lot of thanks to @onetransistor, Good Holidays to everyone

onetransistor commented 9 months ago

I tested on ESP8266 (WeMos D1 mini) only the keypad and it worked. Give me a little time and I will make some tests with ESP32. SX8646 uses I2C so it shouldn't matter with what development board is interfaced.

I want to add the option of polling in the library so it wouldn't depend on board specific interrupts. I'm not very good with C++ programming either so this may take some time.

Yes @Samu84 , I also had a second device with older hardware revision, using FPGA for LCD, yet the same SX8646 for keypad (even though it was plugged into the front panel).

Samu84 commented 9 months ago

Thanks @onetransistor, I noticed that the mode FALLING, RISING. etc... are reacting differently on ESP32, again thank you, I tried hours to follow many forum but no way to make it work, I am still beginner with arduino :(

onetransistor commented 8 months ago

Happy New Year!

I began to dig deeper into this issue (actually more issues):

Please check the new library for ESP32: SX8646_ESP32. It has been successfully tested on Wemos Lolin32 (an older dev board, but this is what I had available). This was my test setup (I only did the SX8646 part, display remained off):

sx8645_esp32

Hope this works for you too. Let me know!

Samu84 commented 8 months ago

HAPPY NEW YEAR!!!! Thanks @onetransistor the fix is not rebooting the ESP32, but I have a weird behaviour, I just copy the code you made for ESP32 and the library, is compiling correctly and the ESP is booting correctly, on the serial monitor I do not see texts when I touch the keypad, but if I disconnect the 3.3v pin and reconnect is starting to work, I added pull-up resistor 10k and used GPIO5 too, and other pins to test, I do not understand why this reaction, also because the chip should be the same like your, just the board is different.

IMG20240101011144

I'll try to test better soon, Thank you @onetransistor , I'll let you know

I forgot, I connected SDA to GPIO21, SCL to GPIO22 and INTB to GPIO05, then tried INTB on other pins

Samu84 commented 8 months ago

I made some more tests, the GPIO5 is reacting on serial monitor if i disconnect and reconnect the pin and then touch the pad, the GPIO32,33,34and35 do not react at all, the other pins more or less react like the GPIO5, some GPIO react only if I disconnect the 3.3v and reconnect. I ve tested also with display, I was using GPIO5 for CS and I moved to GPIO4, so now the keypad is on GPIO5, only problem is that I need to connect and reconnect the pin, then is working, the display is working normally

onetransistor commented 8 months ago

Please check the pull-up resistor. I had the same issue after I fixed the code and didn't know I have to use a pull-up. Maybe try with other values (anything between 1k to 10k).

Both of us have ESP32-WROOM-32 modules. It should work.

Samu84 commented 8 months ago

Hello Thanks for the advice, I was not at home and I didn't have time to test, tomorrow I'll test and I will let you know, thanks again

Samu84 commented 8 months ago

Hello @onetransistor, I just tried now, I had difficult to find the correct resistor so I decided to use a variable resistor, but what I do not understand is that I need to use a 60ohm resistor, between a 3,3 and INTB, I wait to connect definitely the touch, I wait your opinion

Samu84 commented 8 months ago

Hello I am back, at the end I was able to make it work without PULL_UP, I dont know why, but I try to modify the .cpp and now also resetting the ESP32, the touch is working: // enable interrupt interruptFlag = true; attachInterrupt(digitalPinToInterrupt(_INTB), handleInterrupt, FALLING); //attachInterrupt(_INTB, SX8646::handleInterrupt, CHANGE); } I tried your .cpp but when was restarting the multimeter was measuring 3.3V between 3,3V and gpio05, when I use the PULL_UP and I disconnect the resistor was going down to 0V (always between the 3,3v and gpio05), when is 0V is working, instead with this modification, is 3.3v in the beginning then automatically it goes down to 0V and start to work (without PULL_UP)