Showing results for 
Search instead for 
Did you mean: 

UART does not send data which come from gui?

Associate III

Hi everyone,

I'm using STM32g491 and rs485 modules. I'm trying to transmit data from uart1 with DMA when I receive data. There is a dilemma it transmit data but also does not? When I try to send a buffer which defined on stm's code, it transmits but when I try to transmit data come through GUI, it does not transmit. There is no problem about data coming from GUI. I can see it when I debug. Here is my code and the data coming from gui on debug


if(uartCh.BLUT == 1)

		HAL_GPIO_WritePin(BLUT _EN_GPIO_Port, BLUT _EN_Pin, 1);
		uart1_return = HAL_UART_Transmit_DMA(&huart1, guiBLUT_gelen, 11);

		uartCh.BLUT  = 0;


	if(uartCh.GNS == 1)

		HAL_GPIO_WritePin(GNS_EN_GPIO_Port, GNS_EN_Pin, 1);
		 uart1_return = HAL_UART_Transmit_DMA(&huart2, guiGNS_gelen, 21);

		uartCh.GNS = 0;



 Ekran görüntüsü 2023-08-24 110943.png


What GUI is this data coming from? Which of those calls works and which doesn't?

> HAL_GPIO_WritePin(BLUT _EN_GPIO_Port, BLUT _EN_Pin, 1);

Looks like you have some rogue spaces in here so not sure we're seeing the actual code. In any case, there isn't anything wrong with the calls you've shown. How do you know data isn't being sent?


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

Thank for your reply,
I solve the problem mentioned in question but there is still problem. 
I write a GUI with C#, I check if data come from guı from STM's debug and every time I send I can see it on debug. 

When it comes UARTs, I know it bcs I'm also wathcing transmit and receive data simultanously with logic analyzer. I can see receiving data, but can't see transmit data. It transmits 3-4 packeges then it stops because of flags. I set these flags every time it comes in RxCallbacks.



uartCh.GNS = 0;



It continues receiving but does not set flags after transmitting 3 or 4 packages. I also use ErrorCallbacks to receive data and set flags in it, if there is ORE.



void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size)
	if(huart->Instance == USART2)
	{       HAL_GPIO_WritePin(GNS_EN_GPIO_Port, GNS_EN_Pin, 0);
         	HAL_UARTEx_ReceiveToIdle_DMA(&huart2,, gns_receive, 50);

		uartCh.GNS = 1;