cancel
Showing results for 
Search instead for 
Did you mean: 

Cube USART DMA Tranfer works only once.

haraldgraef
Associate II
Posted on June 03, 2016 at 22:35

Hi everybody,

I have some issue with using the DMA Transfer method on a Discovery F3 (F303) board. Don't know if it's a bug, or if I missed something...

The HAL is generated with Cube (under Eclipse, Cube-Version is STM32Cube_FW_F3_V1.4.0).

Following issue:

I start a DMA-Receive (Mainclass.cpp, line 81), which is continuously restarted within the HAL_UART_RxCpltCallback (yes, I should try circular mode).

When a button-press occours I want to send some string-message. This works fine - but only one time.

Snippet (Mainclass.cpp, line 110):

if (last_key == '#')

  {

    strncpy((char*) uart_tx_buffer,

      (const char*) ''oans, zwoa, gsuffa..'',

           uart_tx_buffer_len);

  HAL_UART_Transmit_DMA(uart, uart_tx_buffer, uart_tx_buffer_len);

  }

Problem is, that after transmission the UART-State stays ''BUSY_RX_TX''. This prevents further transmissions. Maybe I should set the state by my own software, but no IRQ is called where I could do this.

A look into UART_DMATransmitCplt (file stm32f3xx_hal_uart.c) shows the enabling of some IRQ. But no IRQ is ever called.

Line 1848:

    /* Enable the UART Transmit Complete Interrupt */

    __HAL_UART_ENABLE_IT(huart, UART_IT_TC);

Workaround may be to use circular mode and stop transmission in the HAL_UART_TxCpltCallback?

So - which IRQ is enabled by line 1848 (or should be enabled)? Did I miss something?

Source files will be attached later.

Thank you

EDIT: I didn't manage to attach files. Blocked by administrator...
1 REPLY 1
haraldgraef
Associate II
Posted on June 03, 2016 at 23:34

(Cool. My first post was swallowed, my second one echoed several times.)

I played around with some settings in Cube - got it.

The global Interrupt on USART1 must be enabled. Works now!