When I've done this in the past, I used a STM32H7A3 which has character match functionality built in to the UART DMA hardware. Luckily, all my devices end their messages with a LF. All I have to do is program the LF character into the character match register, request a DMA transfer with more bytes than I ever expect to receive and I get an interrupt when the LF shows up regardless of how many bytes I requested. All the interrupt handler does is stuff the LF terminated message and a timestamp into...
When I've done this in the past, I used a STM32H7A3 which has character match functionality built in to the UART DMA hardware. Luckily, all my devices end their messages with a LF. All I have to do is program the LF character into the character match register, request a DMA transfer with more bytes than I ever expect to receive and I get an interrupt when the LF shows up regardless of how many bytes I requested. All the interrupt handler does is stuff the LF terminated message and a timestamp into...