2015-06-01 05:21 AM
Hello! I'm using STM32F407 processor. When I'm trying to send 1 byte via USART-DMA (for example 0x72) I get two bytes ''72 72'' in terminal.If I send two or more bytes everything is okay. If I send something from terminal I can't receive one byte, only two or more bytes can be received. Maybe someone can help to solve this problem. Thanks.
2015-06-01 05:43 AM
Not without seeing your code. What library are you using?
2015-06-01 06:48 AM
Aren't there more efficient ways to send one character? Seems like DMA would add a lot of overhead in this case.
2015-06-02 12:25 AM
Here's the function that sends buffer
uint32_t USART_Send(USART_Handle* handle, uint8_t *data, uint32_t size) { assert_param(handle); assert_param(handle->instance); assert_param(data); assert_param(size <= sizeof(handle->buffer_tx)); if(handle->buffer_tx_busy) return 0; handle->buffer_tx_busy = 1; memcpy(handle->buffer_tx, data, size); /* Configure DMA Stream source address */ handle->dma_tx_instance->M0AR = (uint32_t)handle->buffer_tx; /* Configure DMA Stream data length */ handle->dma_tx_instance->NDTR = size; LEDS_ON_GREEN(handle->params.led); DMA_Cmd(handle->dma_tx_instance, ENABLE); if(!_DMA_Cmd(handle->dma_tx_instance, ENABLE) && handle->buffer_tx_busy) { Errors.Error_uart = ERROR_FAIL_UART_DMA_CMD; return 0; } return size; }