cancel
Showing results for 
Search instead for 
Did you mean: 

USART RX and TX issue

Mani1
Associate II

I am using STM32F746G discovery board.

~~~

void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) {

   HAL_UART_Receive_IT (&huart6, Rx_buff, USART_RX_BUFFER_SIZE);

   HAL_Delay(500);

   HAL_UART_Transmit(&huart6, &Rx_buff, USART_RX_BUFFER_SIZE, 1000);

}

~~~

This is the way i am using USART6, TX and RX.

here my doubt is, i fixed my USART_RX_BUFFER_SIZE =10.

I send 10 bytes data via serial terminal(hercules), in this case my usart transmit also works with same 10 bytes data.

But i send 9 bytes data means, the uart transmit is not transmit the 9 bytes data.

my requirement is,

how much amount of bytes received via UART_Receive(); , that amount of bytes, send via UART_Transmit();

Thanks

Manikandan D

10 REPLIES 10
Mani1
Associate II

Now my doubt is clear. Inside ISR function they are typecasting the Rx_buff.

like,

HAL_DMA_Start_IT(huart->hdmarx, (uint32_t)&huart->Instance->RDR, (uint32_t)huart->pRxBuffPtr, Size)

Because Function declaration of HAL_DMA_Start_IT is,

HAL_StatusTypeDef HAL_DMA_Start_IT(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength);

Thanks for your replies :smiling_face_with_smiling_eyes: