STM32L083 UART receives only one byte
Hi,
I am trying to receive data (on STM32L083) via USART1, the way I was used to doing it on STM32L071. Specifically, I used a circular buffer that was continuously written to by DMA - RX. Now, I've ported the code to this L083 and it seems that nothing is being written to the global DMA buffer (although I am 100% sure that data is coming in on the UART pin). As a test, I tried to receive data simply using HAL without DMA and am able to receive only 1 byte; there are never more. Do you know what the problem might be? It seems like nothing can go wrong. I have a speed of 9600, and the data on the pin has been verified with a logic analyzer. What else can I check?
Here the simple RX I used:
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_DMA_Init();
MX_USART1_UART_Init();
/* USER CODE BEGIN 2 */
HAL_UART_Receive(&huart1, myArray, 5, HAL_MAX_DELAY);
/* USER CODE END 2 */
And there is variant of code for using DMA and circular buffer:
/*Uart Init DMA */
LL_DMA_DisableChannel(DMA1,LL_DMA_CHANNEL_3);
LL_DMA_ConfigTransfer(DMA1, LL_DMA_CHANNEL_3,
LL_DMA_DIRECTION_PERIPH_TO_MEMORY |
LL_DMA_PRIORITY_LOW |
LL_DMA_MODE_CIRCULAR |
LL_DMA_PERIPH_NOINCREMENT |
LL_DMA_MEMORY_INCREMENT |
LL_DMA_PDATAALIGN_BYTE |
LL_DMA_MDATAALIGN_BYTE);
LL_DMA_ConfigAddresses(DMA1, LL_DMA_CHANNEL_3,
LL_USART_DMA_GetRegAddr(USART1, LL_USART_DMA_REG_DATA_RECEIVE),
(uint32_t)GlUartRxBuffer,LL_DMA_GetDataTransferDirection(DMA1, LL_DMA_CHANNEL_3));
LL_DMA_SetDataLength(DMA1, LL_DMA_CHANNEL_3, UART_CIRCLE_MAX_BUFFER_SIZE);
LL_DMA_SetPeriphRequest(DMA1, LL_DMA_CHANNEL_3, LL_DMA_REQUEST_3);
/* Enable DMA RX Interrupt */
LL_USART_EnableDMAReq_RX(USART1);
/* Enable DMA Channel Rx */
LL_DMA_EnableChannel(DMA1, LL_DMA_CHANNEL_3);