How to configure DMA to receive variable length USART messages?
I had similar problem in one of my projects. I solved it by creating long enough buffer to store longest possible message and using DMA to transfer from USART. To detect end of message I used idle line detect interrupt which trigger when USART receiver stop receiving data.