2020-10-19 08:05 AM
I connect PC6 with PC7 to get a loopback on my evaluation board.
I add the following code:
do{
memset( aRxBuffer, 0x00, sizeof(aRxBuffer));
if(HAL_UART_Receive_DMA(&UartHandle, (uint8_t *)aRxBuffer, RXBUFFERSIZE) != HAL_OK)
{
Error_Handler();
}
if(HAL_UART_Transmit_DMA(&UartHandle, (uint8_t*)aTxBuffer, TXBUFFERSIZE)!= HAL_OK)
{
Error_Handler();
}
while( HAL_UART_GetState(&UartHandle) != HAL_UART_STATE_READY)
{
BSP_LED_Toggle(LED1);
HAL_Delay(100);
}
testCompare = memcmp(aRxBuffer,aTxBuffer, sizeof(aRxBuffer));
}
while( 1 );
Only the first time aRxBuffer contain the content of aTxBuffer.
With a logic analyser I can see transmiting data is okay.
I also see triggering of interrupt calback function HAL_UART_RxCpltCallback(), but no data in aRxBuffer.
Do I need to a special trick to receive data the second time?