cancel
Showing results for 
Search instead for 
Did you mean: 

Receive/Transmit UART data using DMA

IShar.2
Associate II

Hello,

I use with:

- Nucleo-H743ZI2

-STM32CubeIDE ver 1.6.0

-MCU Package ver 1.9.0

I made loopback between PB14 & PB15 , the loopback work i checked it without DMA .

I try to send data from buffer and get the data using DMA but it is not working.

Thank's

4 REPLIES 4
Javier1
Principal

Hi i dont know how you expect anyone to help you if you dont post the code or add more context.

Anyway this video helped me a while back, take a look.

we dont need to firmware by ourselves, lets talk
IShar.2
Associate II

#define SIZE 10

/* USER CODE END PD */

/* Private macro -------------------------------------------------------------*/

/* USER CODE BEGIN PM */

/* USER CODE END PM */

/* Private variables ---------------------------------------------------------*/

/* USER CODE BEGIN PV */

uint32_t buffer_tx[SIZE] = {20, 21, 22, 23, 24, 25, 26, 27, 28, 29};

uint32_t buffer_rx[SIZE];

/* USER CODE END PV */

/* Private function prototypes -----------------------------------------------*/

void SystemClock_Config(void);

/* USER CODE BEGIN PFP */

/* USER CODE END PFP */

/* Private user code ---------------------------------------------------------*/

/* USER CODE BEGIN 0 */

void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart)

{

}

void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)

{

}

void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size)

{

 while(1);

}

/* USER CODE END 0 */

/**

 * @brief The application entry point.

 * @retval int

 */

int main(void)

{

 /* USER CODE BEGIN 1 */

 /* USER CODE END 1 */

 /* Enable I-Cache---------------------------------------------------------*/

 SCB_EnableICache();

 /* Enable D-Cache---------------------------------------------------------*/

 SCB_EnableDCache();

 /* 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_USART1_UART_Init();

 /* USER CODE BEGIN 2 */

 if (HAL_OK != HAL_UARTEx_ReceiveToIdle_DMA(&huart1, buffer_rx, SIZE))

 {

  Error_Handler();

 }

 HAL_UART_Transmit(&huart1, buffer_tx, 5, 100);

 /* USER CODE END 2 */

 /* Infinite loop */

 /* USER CODE BEGIN WHILE */

 while (1)

 {

  /* USER CODE END WHILE */

  /* USER CODE BEGIN 3 */

 }

 /* USER CODE END 3 */

}

IShar.2
Associate II

Hello there,

I want to using with this function "HAL_UARTEx_ReceiveToIdle_DMA(&huart1, buffer_rx, SIZE))"

Thank's

Tilen MAJERLE
ST Employee

Usually problem is linked with the fact that your DMA has no access to the memory where your DMA buffers are. Usually DMA buffers are by default placed to DTCM RAM. You will have to move them to D1, D2 or D3 domain RAM memory.

See this FAQ: https://community.st.com/s/article/FAQ-DMA-is-not-working-on-STM32H7-devices