2025-01-27 02:27 PM
Hi,
If I understand right USART1 is used in STM32H747I-DISCO board for VCOM. I could not find any example for my board. I would like to want for an 8-byte host command using:
HAL_UART_Receive_IT(&huart1, hostCommand.buffer, 8);
Once a command is received then I process it, I create the answer and wait for the next command. So simple.
Noe: on CN13 pin 13 I see the command from my PC on scope, but the HAL_UART_RECEIVE_IT() never receives anything.
Can sombody send me a short example?
Thanks,
Louie
Solved! Go to Solution.
2025-01-28 08:17 AM
Okay I did not know that. This is why I originally asked for an example app. I will try it using your way.
Thanks,
Louis
2025-01-28 08:39 AM
The examples in CubeIDE/CubeMX would illustrate that.
2025-01-28 08:54 AM
void USART1_IRQHandler(void) // gets called per byte/interrupt
{
HAL_UART_IRQHandler(&huart1); // calls into HAL, it works the buffering and calls your call-back when complete
}
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *UartHandle) // call from HAL_UART_IRQHandler
{
// Do something with the filled buffer
..
HAL_UART_Receive_IT(&huart1, hostCommand.buffer, 8); // initate again (returns immediately)
}
void HAL_UART_ErrorCallback(UART_HandleTypeDef *UartHandle)
{
Error_Handler(); // or manage failure
}
main()
{
..
HAL_UART_Receive_IT(&huart1, hostCommand.buffer, 8); // start (returns immediately)
while(1);
}
2025-01-28 09:01 AM
However I noticed the followings:
- TouchGFX Created the project in C:\TouchGFXProjects\RCTDigitalClock folder which is out of my default workspace (C:\Users\[UserName]\STM32CubeIDE\workspace_1.17.0\RCTDigitalClock .
- TouchGFX Created a `STM32CubeIDE` folder with CM4 and CM7 folders.
- TouchGFX Created a `STM32H747I-DISCO.ioc` file. Why not RCTDigitalClock.ioc?
STM32F429I-DISCO & TouchGFX Setup
When I enabled the USART1 then STM32CubeMX automatically created PB7 as Rx pin. This is the bug or issue or whatever you call it. This was teste at least 20 times.
This is not a bug. I get the same results when enabling USART1 from a TGFX project. Now this could be because the IOC file was generated by TGFX, not by STM32CubeIDE. As I said before, you can override and select the available Rx pins for USART1.
But, if you start a new board project in STM32CubeIDE/CubeMX, and not a TGFX project, it gives you an option to initialize default configurations. When you enable default configurations, then PA9 and PA10 are selected for USART1.
2025-01-28 09:20 AM
@Andrew Neil wrote:The examples in CubeIDE/CubeMX would illustrate that.
Apparently not for that exact board:
2025-01-29 01:00 AM
Thanks Tesla DeLorean, this is what I really asked for.
Louis
2025-01-29 01:01 AM
Thanks for the demo.
Louis