2025-05-07 3:18 AM - last edited on 2025-05-07 4:07 AM by Andrew Neil
Split from old (2020), abandoned thread: https://community.st.com/t5/stm32cubemx-mcus/uart-emulation-an4457-is-it-possible-to-use-it-via-cubemx/td-p/310812 for better visibility - and to enable marking a solution...
Hi,
I have the same problem, trying to reverse engineer the AN4457 example for an H7xx MCU using with STM32CubeIDE. Currently my problem is that I need to "#define HAL_UART_EMUL_MODULE_ENABLED " in stm32h7xx_hal_conf.h, but there is not "USER CODE" field, so the define gets overwritten each time I change the IOC file.
I guess the proper approach would be to select the UART_EMUL module in the device configuration tool of the GUI, but I do not know how to make it visible there ...
Did anyone implement this example using an IDE? It would be really helpful for the CubeIDE users.
Thanks!
2025-05-07 3:29 AM - edited 2025-05-07 4:13 AM
@JR72 wrote:Currently my problem is that I need to "#define HAL_UART_EMUL_MODULE_ENABLED " in stm32h7xx_hal_conf.h, but there is not "USER CODE" field, so the define gets overwritten each time I change the IOC file.
You could just add it as a Defined Symbol in the Project Properties (Settings) ?
PS:
The above is from right-clicking the Project, and choosing 'Properties'.
You can also get to the Define Symbols setting by right-clicking an individual file, or a folder. I've not tried it myself, but I think that should let you apply it to just an individual file, or just a folder ...
2025-05-08 3:40 AM
Thanks for the workaround, that is a good idea. However, I found that the #define only triggers an #include in the stm32h7xx_hal_conf.h file to activate the module. Since I do not understand how to correctly integrate additional code (i.e. the STSW-STM32156 firmware package) as a module, I decided to give up on this and just implement a user-code solution along the lines of AN4457. A firmware package for the IDE toolchain would nonetheless be great to have.