2024-12-18 02:38 AM
For my project, an error message must display on the screen when there's a I2C related communication error. To simulate an I2C error, I pulled out the resistor that is connected between SDA and VCC(for good working of I2C communication, a resistor between VCC and SDA is necessary).
When I2C error communication occurs, I2C error callback is called, a lot of things are apparently deactivated such as systick timer etc, using of a delay halts the code(since tick value doesn't increase). The MCU can't enter presenter and view of touchgfx anymore.
What can be done so that TouchGFX works again, so that I can display the needed error message on the screen)?
2024-12-18 02:45 AM
@FLuba.1 wrote:When I2C error communication occurs, I2C error callback is called, a lot of things are apparently deactivated such as systick timer etc, using of a delay halts the code(since tick value doesn't increase).
So don't do that, then!
Presumably, this is just a default, generic error handler?
@FLuba.1 wrote:What can be done so that TouchGFX works again, so that I can display the needed error message on the screen)?
You need to adapt the error handler to suit your particular requirements - so that it doesn't kill your system!
2024-12-18 04:24 AM
Thank you for your answer.
"You need to adapt the error handler to suit your particular requirements - so that it doesn't kill your system!"
This is what i try to do. But i don't know what i have to re-init(re-activate) or don't know what is deactivated by the MCU/software. I have my own error handler, that the mcu enters after the I2C error callback function, the mcu don't halt, it keeps running(LED blinks by use of for-loop as delay).
I have tried using the functions: HAL_I2C_MspDeInit(), MX_TouchGFX_Init() and SystemClock_Config() to re-activate the Touchgfx, but it doesn't help. What else can i do?
"So don't do that, then!"
I don't think that calling of I2c error callback function is the cause of deactivating MCU hardwares. But i will try without error callback function.
2024-12-18 04:43 AM
@FLuba.1 wrote:don't know what is deactivated by the MCU/software. .
Nothing is "deactivated" of its own accord - only the things that you specifically deactivate in your error handling.
An I2C failure shouldn't stop SysTick working.
And, of course, anything which continues to rely on the I2C working is not going to work until you've fixed the I2C error.
Some stuff here on recovering from I2C errors:
@FLuba.1 wrote:
The MCU can't enter presenter and view of touchgfx anymore.
So you need to determine what, exactly, prevents it ...
2024-12-18 05:02 AM
Your link seems to have some good information. I will try what is told in your link. Thanks.
2024-12-18 05:14 AM
Note that the information there is just about clearing the STM32's I2C state.
It won't help if the external fault persists - eg, you removed the pullup.
2024-12-18 07:54 AM
@Andrew Neil wrote:you need to determine what, exactly, prevents it ...
eg, are you using a touch display which relies upon I2C for the touch operation?
Clearly, that cannot work when the I2C is not working