Loading...
 

Zephyr project on STM32

   Zephyr Workbench, a VSCode extension to manage Zephyr on STM32.
It enables users to easily create, develop, and debug Zephyr applications.
Main features:
  • Install host dependencies.
  • Import toolchain and SDK.
  • Create, configure, build and manage apps.
  • Debug STM32.
You can directly download it from the VSCode marketplace
For more details, visit the Zephyr Workbench

System Workbench for STM32


HAL UART HAL_UART_Receive Timeout

Hi,
I’m using a CubeMX generation for STM32F746BETx which contains 2 serial ports. These 2 serial ports are both connected to a putty terminal. (The behaviour is the same for STM32F769I-DISCO and STM32F746G-DISCO.)

I can transmit messages from both and I can also receive messages on one UART. But as soon as I’m receiving characters on both UARTS in the main loop both receive functions return timeout and no character is delivered any more.

This is my code within main:

while (1)
{
uint8_t aTxBuffer150 = “W123456789”;
uint8_t aTxBuffer750 = “X1Y2Z”;
HAL_UART_Receive(&huart1, (uint8_t *)aTxBuffer1, 50, 50);
HAL_UART_Transmit(&huart1, (uint8_t*)aTxBuffer1, 50, 0xFFFF);
HAL_UART_Receive(&huart7, (uint8_t *)aTxBuffer7, 50, 50);
HAL_UART_Transmit(&huart7, (uint8_t*)aTxBuffer7, 50, 0xFFFF);
}

When I insert something like
__HAL_UART_CLEAR_IT(&huart1, UART_CLEAR_NEF | UART_CLEAR_OREF | UART_FLAG_RXNE | UART_FLAG_ORE);
for each UART before calling Receive, the Receive functions do not return timeout all the time, but the receive methods loose a lot of characters of the received messages.

Something that tripped me up in the past is the hardware TX/RX connection and voltage levels.

Check that RX pins goes to TX pins (do not get confused with DB9 serial connections).

Do ensure that you are not pushing real RSR232 signals to the ARM pins, they will pop’n’fry.

I suggest a “loopback” connection first, TX to RX on same UART. Just to get going.

Since send and receive are working perfectly as long as I use only one port the cabling should be okay.

My apologies.I missed this:
“I’m using a CubeMX generation for STM32F746BETx which contains 2 serial ports. These 2 serial ports are both connected to a putty terminal. (The behaviour is the same for STM32F769I-DISCO and STM32F746G-DISCO.)

I can transmit messages from both and I can also receive messages on one UART. But as soon as I’m receiving characters on both UARTS in the main loop both receive functions return timeout and no character is delivered any more.”

Try to change the interrupt of the one port lower than the other. Keep in mind, it is one CPU.

Hello hardwareguyvw,
sorry, I didn’t see your second post.

How can I influence the interrupt?

I do not see any explicit interrupt setting, nor in CubeMX neither in the generated code.

When in the config tab, click on the UARTs and check their NVIC tabs.

Or, on the “System” block, check what is under the “NVIC” button.

In there, the “Preemption Priority” is basically the same as interrupt priority.


 

Newest Forum Posts

  1. reservation car service Seattle by Jamesprede, 2025-05-01 10:06
  2. Last day: drone bonus by Danielrug, 2025-04-19 16:55
  3. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-25 07:37
  4. SPI on Nucleo_STMH533RE by royjamil, 2025-03-23 11:31
  5. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-23 09:33
  6. Configuring DMA for ADC in SW? by sam.hodgson, 2025-03-04 12:58
  7. Insightful Perspectives on This Subject by davidsycle, 2025-03-04 05:45
  8. Build a project in "release" mode by info@creosrl.it, 2025-02-20 18:12
  9. Build a project in "release" mode by info@creosrl.it, 2025-02-20 17:05
  10. Build a project in "release" mode by tang, 2025-02-20 10:36

Last-Modified Blogs