AnsweredAssumed Answered

Problem bypassing data from one UART to another?

Question asked by Abhishek Kumar on Nov 4, 2017
Latest reply on Nov 4, 2017 by Clive One

MCU: STM32F777II, running at 64MHz

Source UART: UART4 (DMA Stream configured on both RX,TX), Baud Rate: 9600

Destination UART: UART8 (DMA Stream configured only for RX), Baud Rate: 9600

I need to bypass data coming on UART4 to UART8 not using any DMA channel, so I wrote the following code:

 

unsigned char strbfr[4] = "";

while(1)
{
// Block read (GPS connected)
while(HAL_UART_Receive(&UART_INT, strbfr, 1, HAL_MAX_DELAY) != HAL_OK); 
// Write data on destination UART
while(HAL_UART_Transmit(&UART_BT, strbfr, 1, 100) != HAL_OK); 
while (HAL_UART_GetState(&UART_BT) != HAL_UART_STATE_READY);
}

 

I see that that when the application runs, only few characters from the source i.e. the GPS device (which produces data continuously at 500ms burst rate) gets printed on the destination UART and then it stops sending. Is there any issue with this code? Is it because both source and destination are running at same baud rate? I observe that if i increase the baud rate of destination UART8 to greater than 9600, the code runs fine, however I want to run UART8 at 9600 only due to peripheral constraints.

Outcomes