2023-08-16 11:17 AM - edited 2023-08-16 11:35 AM
I have used an XTP2046 Library with the STM32H750 Board (Bare metal HAL Without RTOS) Is working and and producing Correct results.
But When i use a sample TOUCHGFX Project and only read the XPT2046 Value then I get into following problems
Debugger shows that MCU Ran into Infinite Loop when I pause the debugger and now serial data is send or recieved from the STM32H7
It Stuck here.------|
/**
* @brief This is the code that gets called when the processor receives an
* unexpected interrupt. This simply enters an infinite loop, preserving
* the system state for examination by a debugger.
* @PAram None
* @retval None
*/
.section .text.Default_Handler,"ax",%progbits
Default_Handler:
Infinite_Loop:
b Infinite_Loop
.size Default_Handler, .-Default_Handler
And My Code In main.c Looks like this (Exactly same as in Barebone STM32H750b-DK Setup where it is working perfectly fine.
#include "XPT2046.h"
uint16_t X_AXIS,Y_AXIS;
void HAL_GPIO_EXTI_Callback ( uint16_t GPIO_Pin)
{
if (GPIO_Pin == T_PEN_Pin)
{
if (XPT2046_TouchPressed())
{
uint16_t x = 0 , y = 0 ;
if (XPT2046_TouchGetCoordinates( & x, & y))
{
X_AXIS=x;
Y_AXIS=y;
}
}
}
}
2023-08-16 12:45 PM
If it's stuck in Default_Handler, that typically means you don't have an interrupt handler defined for the interrupt that was triggered. CubeMX generates this code for you in the stm32*_it.c file.
You can look at VECTACTIVE bits in SCB->ICSR to determine the interrupt it's in.
2023-09-26 03:37 AM - edited 2023-09-26 03:39 AM
@TDK wrote:If it's stuck in Default_Handler, that typically means you don't have an interrupt handler defined for the interrupt that was triggered. CubeMX generates this code for you in the stm32*_it.c file.
You can look at VECTACTIVE bits in SCB->ICSR to determine the interrupt it's in.
Got the system up and running but there are some problems with the driver or interface.
In debugger, the XPT2036 is firing as specified but when the system is running the touch responds after various clicks.
I am not using interrupt here as shown below-
void STM32TouchController::init()
{
/**
* Initialize touch controller and driver
*
*/
}
bool STM32TouchController::sampleTouch(int32_t& x, int32_t& y)
{
if (XPT2046_TouchPressed())
{
uint16_t a= 0 , b = 0 ;
if (XPT2046_TouchGetCoordinates( & a, & b))
{
x=a;
y=b;
}
return true;
}
return false;
}
2023-10-23 07:42 AM
Everything is working fine but there is always delay and lag when pressed.