-
Notifications
You must be signed in to change notification settings - Fork 1k
Problem with STM32H743VIT6 and XPT2046 Touchpad #1380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @pacman1945 Maybe related to #1294 but it seems SPI clock is 2 MHZ anyway you could give a try to the workaround.
Edit: other examples failed too (without irq pin)? |
Thank you so much for the help. I've tested the #1294 suggestion, but it didn't help. I've also tried to disable ICACHE & DCACHE, the problem still persisted. I've located a simply sketch using SPI to directly communicates with the XPT2046 touchpad without using any specific touchpad library, it also exhibits the same SPI corruption problem. BTW, this sketch doesn't use IRQ pin. |
Ok thank you. |
It would also be quite helpful if you can capure the SPI traffic using a logic analyzer, if you have any. |
Sorry, I don't have access to a logic analyzer. Below is a simple sketch that I downloaded.
When running the above sketch on a STM32F407VET6, below is part of the output. The results are normal.
When running the same sketch on a STM32H743VIT6, below is part of the output. The fields X & Y are corrupted. If you look at bit 12 of X & Y, they're always on (0x1XXX). These are impossible values as they shouldn't be larger than 0xFFF.
|
I've just replaced the hardware SPI with a Software SPI library (SoftSPI from the below github repo). The STM32H7 is now working properly with XPT2046 touchpad using SoftSPI. |
Hi @pacman1945 One note about the T_IRQ, it uses the EXTI line so pay attention to not use a GPIO pin number used by another pins. Moreover some EXTI IRQn are grouped so if you used PA5, PA6 and PA7 for SPI you should not use an IRQ pin Px5 to Px9 as they are all linked to the same EXTI9_5_IRQn . Here the list of grouped IRQn line: Arduino_Core_STM32/libraries/SrcWrapper/src/stm32/interrupt.cpp Lines 90 to 105 in 6555870
|
I've tested with your updated generic_clock.c. Unfortunately, same problem still occurred with the new HSI clock setting. In order to avoid the IRQ issue that you mentioned, all my testings were now done without using T_IRQ pin. |
Fixes stm32duino#1380 Signed-off-by: Frederic Pillon <[email protected]>
Fixes stm32duino#1380 Signed-off-by: Frederic Pillon <[email protected]>
Hi @pacman1945 Anyway, H7 runs too quickly and so value read is not correct as the XPT does not have time to made the conversion. z = z1 + 4095;
+ delayMicroseconds(2);
int16_t z2 = _pspi->transfer16(0x91 /* X */) >> 3; The delay allows to get the correct conversion result. |
Describe the bug
When using STM32H743VIT6 (or STM32H750VBT6) with XPT2046 touchpad via PaulStoffregen's XPT2046_Touchscreen library, SPI data will be corrupted. Everything worked if I replaced the STM32H7 board with a STM32F407VET6.
To Reproduce
Desktop (please complete the following information):
Board (please complete the following information):
Tried both of the below boards and have the same problem.
https://www.aliexpress.com/item/4000295397211.html?spm=a2g0o.productlist.0.0.637d1d300fFQ5d&algo_pvid=b237e656-d04b-422e-84af-8be8ed4042d9&algo_expid=b237e656-d04b-422e-84af-8be8ed4042d9-34&btsid=0bb0624116200479098028721ef47f&ws_ab_test=searchweb0_0,searchweb201602_,searchweb201603_
https://www.aliexpress.com/item/1005001683272407.html?spm=a2g0o.productlist.0.0.637d1d300fFQ5d&algo_pvid=b237e656-d04b-422e-84af-8be8ed4042d9&algo_expid=b237e656-d04b-422e-84af-8be8ed4042d9-0&btsid=0bb0624116200479098028721ef47f&ws_ab_test=searchweb0_0,searchweb201602_,searchweb201603_
The text was updated successfully, but these errors were encountered: