Skip to main content
DWWelch
Associate III
May 24, 2024
Solved

MX_TouchGFX_Init configuring wrong I2C touchscreen pins on MCU

  • May 24, 2024
  • 1 reply
  • 1028 views

I am using a touch controller with TouchGFX on a custom board. It is using I2C1 on the MCU and is working fine with TouchGFX. However, when MX_TouchGFX_Init() runs it is reconfiguring pins on the MCU for I2C2 that I am using for other functions. I2C2 is not being used and I never enabled or configured it in CubeMX. HAL::initialize() in the following TouchGFX code is remapping the GPIO pins to I2C2:

 

void TouchGFXGeneratedHAL::initialize()

{

HAL::initialize();

registerEventListener(*(Application::getInstance()));

enableLCDControllerInterrupt();

enableInterrupts();

setFrameBufferStartAddresses((void*)frameBuf, (void*)(frameBuf + sizeof(frameBuf) / (sizeof(uint32_t) * 2)), (void*)0);

}

 

I am reconfiguring the pins back to GPIO after MX_TouchGFX_Init() runs, but would like to fix this in TouchGFX.

There is a reference to a touch controller driver in the TouchGFX HAL - touchController(touchCtrl), but

I can't find where TouchGFX is trying to use I2C2 when my touchscreen driver is using I2C1 and is working.

If anyone knows where the TouchGFX HAL touch controller I2C pins are defined please let me know.

 

Thanks,

Dan

Best answer by DWWelch

Hello All,

Just after posting this I found the definition for the touchscreen and corrected the values. All is working correctly now.

Dan

1 reply

DWWelch
DWWelchAuthorBest answer
Associate III
May 24, 2024

Hello All,

Just after posting this I found the definition for the touchscreen and corrected the values. All is working correctly now.

Dan