‎2021-05-12 07:43 AM
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:
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
‎2021-05-12 07:56 AM
Hello @AKart.1​ and welcome to STM32 World =)
I advise you to have a look at the example here: STM32 UART DMA RX/TX
Please consider this FAQ article: DMA is not working on STM32H7 devices, for DMA usage with STM32H7 devices in case DMA is not working, or the transmitted/received data are corrupted,
Have a look also to the STM32H7 errata sheet and check if you have the same conditions as described here:
Hope my answer helped you! :smiling_face_with_smiling_eyes:
When your question is answered, please close this topic by choosing Select as Best.
Imen
‎2021-05-12 08:05 AM
The DTCM RAM can't be used for DMA on the H7, so pay attention to the memory buffer address, and perhaps look at the bus matrix diagram to better understand the plumbing.
‎2021-05-13 12:06 AM
Hello,
thank you for the fast replay :)
I have this condition (DMA stream locked). Can you help me please to solve it? How to enable bit 20 of DMA_SxCR register? Maybe I use the incorrect DMA stream? Thanks.