Showing results for 
Search instead for 
Did you mean: 



Hello im working on a project where im modifying data on STM32 and transmiting it via UART on my other hardware(ESP32).

Im having troubles, my best guess is at sending data thought UART. Because of the delays in my code I've implemented DMA which would resolve that issue. The trouble im facing is, when i let the code run without breakpoints the data received looks like that:


It looks like the buffer im transmiting is getting sent over multiple times until its completed? That in fact delays my whole process, as you can see it takes 0.6s for 1 data to be transmitted. However if I manually break and start code the data is transmited completely in one step.

I want to know, if that has been issue resolved in the past, or is it possible that im receiving this data in the wrong way?


We have no idea what does the picture you've shown us mean, nor what code are you using.




i am also using an ESP (8266) , connected to SPI (at 24Mbit, with DMA) and UART (115k, 8n1) to H743 , no problem.

I receiving on H7 most time, in INT mode, because never now, what and when is coming...

How you doing this ? format of transmission ? speed ? 

If you feel a post has answered your question, please click "Accept as Solution".

Im sorry for the confusion.

The output represents putty data read from serial COM3 port. If you are interested in the reading part the code is from ESP32:


HardwareSerial MySerial(2);
const size_t BUFFERSIZE = 10;
char buffer[BUFFERSIZE] = {'\0','\0','\0','\0','\0','\0','\0','\0','\0','\0',};

MySerial.begin(115200, SERIAL_8N1, 16, 17);  

while(MySerial.available() > 0){
    size_t numBytesRead = MySerial.readBytesUntil('\r', buffer, sizeof(buffer)-1);
    buffer[numBytesRead] = '\0';
    Serial.printf("Data(%lu):|%s|\n", numBytesRead, buffer);


STM32 code:


		ui32value = 77; = pids[stevecc];
		OBD2Data.uwData = ui32value;

	    if (OBD2Data.uwData != 0) {
	      snprintf((char *)buffer, sizeof(buffer), "%d:%lu;\r",, OBD2Data.uwData);
	    } else {
	      snprintf((char *)buffer, sizeof(buffer), "%d:%.2f;\r",, OBD2Data.fData);

		osMessageQueuePut(mid_MODELMsgQueue, &OBD2Data, 0U, 0U);
		// Free dynamically allocated memory
	    if (sizeof(buffer) > 0)
			//HAL_UART_Transmit_IT(&huart1, buffer, sizeof(buffer));
	    	HAL_UART_Transmit_DMA(&huart1, buffer, sizeof(buffer));
			HAL_DMA_PollForTransfer(&dma1_struct, HAL_DMA_FULL_TRANSFER, HAL_MAX_DELAY);
			huart1.gState = HAL_UART_STATE_READY;
	    OBD2Data.uwData = 0;
	    OBD2Data.fData = 0.0;

	    if(++stevecc > sizeof(pids))
	    	stevecc = 0;



Without attempting to understand, what's going on in your ESP code, why don't you simply observe the UART line between STM32 and ESP, using oscilloscope, logic analyzer, or simply connecting that point to your PC?


Your image show your issue on ESP. While until dont work ... numbytes is always 9