USART DMA no data- HAL_UART_ErrorCallback() i get huart->ErrorCode = HAL_UART_ERROR_DMA
Hey,
I'm new with STM32 =)
I have STM32H743ZIT6
I'm trying to read GPS data from ublox device.
After creating a new project with STM32cubeIDE.
This is the following configuration in the IOC file:
- USART2
- DMA - USART2_RX with circular mode
- global interrupt enabled
- Baud rate = 115200, no parity, word length = 8 bits, stop bits = 1, 16 over sampling
the main.c file contains:
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_DMA_Init();
MX_USART2_UART_Init();
/* USER CODE BEGIN 2 */
HAL_StatusTypeDef status = HAL_UART_Receive_DMA(&huart2, gps_buf, CHARS_TO_READ);
if (status != HAL_OK)
Error_Handler();
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
}
also in main file :
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart){
/* add global buffer*/
HAL_UART_Transmit(&huart2, (uint8_t *)gps_buf, 255, 1);
}
void HAL_UART_ErrorCallback(UART_HandleTypeDef *huart){
while(1){
}
}
when I'm executing the code with debug mode I see that the GPS buffer is empty all the time (not accessing the HAL_UART_RxCpltCallback function at all) and after a few iterations the run stops at HAL_UART_ErrorCallback function and the huart object error status is:
huart->ErrorCode = HAL_UART_ERROR_DMA (error 16)
I'm sure that all cables are ok because I already managed to do so perfectly with STM32F767 which has the same pinout as STM32H743ZIT6.
any idea what is wrong?
thanks
A.K