How to read Data with UART circular DMA and byte-by-byte Data and use two Buffer ? with stm32f407 ? without FreeRTOS and realtime !!
Hello Friends
i'm new in STM32
i wanna know how to Read Data Byte-by-Byte from uart Rx Circular Dma and save this data in a buffer ?
and my challenge is i do not know my input data length and type of that (hex, bin, ascii ,...)
theres any sample code ?
i think my code is wrong
uint8_t rxBuffer[10];
... in main :
{
...
HAL_UART_Receive_DMA(&huart1, (int8_t*) rxBuffer, 1);
...
}
..... and i use rx callback :
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
{
//
switch ((uint32_t) huart->Instance)
{
case USART1_BASE:
//
Receive_Data(rxBuffer);
break;
}
}
and my receive data function :
uint8_t Receive_Data(uint8_t* Data)
{
while (Data[0] != '\n')
{
//
buffer[i] = Data[0];
i++;
if(i == n)
{
i = 0;
//return buffer;
}
}
}
can anyone help me ?
thanks