Electronic – 16bit DMA UART w/ STM32F4

dmaserialstm32stm32f4uart

How do I transmit 16 bits of data with UART to a 16 bit array? I've got two elements in my array, my UART is set up as 8N1 and my DMA is set to circular.

I'm using some HAL stuff, and here's my setup:

extern uint16_t tx_buffer[2];
extern uint16_t rx_buffer[2];


  MX_DMA_Init();
  MX_USART1_UART_Init();
  HAL_UART_Receive_DMA(&huart1, (uint8_t *) rx_buffer, 4);

However, when I send a string of 4 8N1 bytes, my array looks like this:

p/z rx_buffer
{0x88, 0x00}

I've tried a few different permutation of changing the type for the pointer in the HAL_UART_Receive_DMA function as well as the type for the arrays…I've also tried 2 & 4 for the DMA length, but still nothing works.

Any idea why this is happening?

Thanks

Best Answer

Ahhh, I had my DMA transfer size set to word, not byte...