I'm working on firmware for an STM32F103 which is communicating over RS232 at 115200 baud with a motor controller. The motor controller (a Copley Xenus XTL) operates on a "speak when spoken to" protocol. I'm using the ASCII programming interface in the linked documents. The STM32 always be sending the same command ("g r0x18") to poll a register, and the motor controller replies with a variable number (~4-10 bytes) of characters terminated by a carriage return ("v 12345", where the number of digits is variable). I have code to parse the response and pull a numeric value out of it. Once the response is parsed, the register poll command should be transmitted to the motor controller again. The STM32 is also reading an ADC channel over DMA in circular mode in the background.
I'd like to implement this using the DMA controller to make everything as non-blocking as possible, but I'm a bit confused as to which interrupts I should be using and when they fire. Without using the DMA controller, the parsing code currently resides in the USART RXNE interrupt. Suppose I transmit command and the motor controller starts to reply. I believe the RXNE interrupt fires for each received byte, but what about the DMA transfer complete interrupt? Is there even any functional difference in this case between using the DMA TC interrupt and the USART RXNE interrupt?
the parsing code currently resides in the USART RXNE interrupt
A better way would be to only use the RX interrupt to put the current byte in a circular buffer. In the main loop then check if the buffer contains a complete message and parse that message. \$\endgroup\$