Hello Renesas Community,
I'm currently integrating the CTSU module into an existing project on the RA6M1 MCU. I followed the standard steps using QE Touch, and placed R_TOUCH_Open(&g_qe_touch_ctrl, &g_qe_touch_cfg); at the beginning of qe_touch_main() to ensure CTSU is initialized first.
R_TOUCH_Open(&g_qe_touch_ctrl, &g_qe_touch_cfg);
qe_touch_main()
However, after flashing the program, execution never reaches the if (FSP_SUCCESS == err) block or the timer initialization (R_AGT_Open). When I pause the debugger, the program is stuck in the following line inside the CTSU correction measurement function:
if (FSP_SUCCESS == err)
R_AGT_Open
while (p_instance_ctrl->state != CTSU_STATE_SCANNED)
(Screenshot attached: green highlight in r_ctsu.c)(First Screenshot)
r_ctsu.c
It seems that the system is getting stuck waiting for CTSU to complete scanning, but this scan never finishes, preventing the program from proceeding beyond initialization.
R_TOUCH_Open() is the first API being called.
R_TOUCH_Open()
System never reaches timer startup or even QE Touch ScanStart.
ScanStart
No visible error, just infinite wait on CTSU scan completion.
This only occurs after integrating CTSU into my full project. It works fine in standalone CTSU testing.
Is there any known condition where the CTSU never exits the scanning state?
Could a clock misconfiguration or pin conflict prevent the scan from completing?
Is this possibly due to timer or interrupt conflicts before R_TOUCH_Open()?
e² studio version: 2025-01 (25.1.0)
FSP version: 5.2.0
Please let me know if there are specific CTSU timing, ELC, or interrupt configurations I should double-check.
Thank you!
Hello.
What is the return value of RM_TOUCH_Open ?
If it returns with FSP_ERR_INVALID_ARGUMENT there is probably an error in your configuration parameters which means something went wrong during the process you followed.
For more info I will need to have a look into your project.
I confirmed that the return statement was indeed executed and, for better clarity, I added test code inside the false condition block to verify it wasn't being triggered — which it wasn’t. So, the condition passed successfully, but the controller did not proceed to execute the code that follows. Why is this happening, and how can I fix it?
return
false
You said that the code does not reach until R_AGT_Open. This can only happen when RM_Touch_Open does not return with FSP_SUCCESS. What is the return value of RM_Touch_Open ?