cancel
Showing results for 
Search instead for 
Did you mean: 

AN4457 UART Emulation - use via CubeMx?

JR72
Associate

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!

2 REPLIES 2

@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) ?

AndrewNeil_0-1746613721577.png

 

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 ...

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

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.