How to deal with unknown length of the UART receive in Interrupt mode even after using Interrupt for each byte?
I am working on a embedded board using STM32H743ZI MCU. My test App ABC on windows PC send commands to the MCU over USB. STM32 MCU after receiving this
command as input, sends a part of it to the chip XYZ presnt on the same board using UART. Now chip XYZ is supposed to return some reply bytes which are unknown in length
and depend on the command being sent by the App ABC on the PC. I am using Interrupt mode for UART communication between STM32 MCU and chip XYZ, and since
the length of the response is unknown for UART so I have modified the HAL to use custom UART code where there comes an interrupt on each byte received and it is working fine.
My use case is: the response received from chip XYZ has to be sent back to the App ABC in PC by MCU as it is. So to be precise my question is how do I know
that chip XYZ has sent all the response bytes and now MCU can send those response bytes to the PC App , as the legth of the response is unknown and there is no fixed time limit also.
Is there any other way to do read write over UART using HAL (or otherwise) when length of the response is unknown.