hal_dma_printf icon indicating copy to clipboard operation
hal_dma_printf copied to clipboard

dmi.sending is always 1

Open linuxhj opened this issue 3 years ago • 0 comments

void dma_printf_putc(uint8_t c){
    dma_ring_putc(&dmi.tx_ring, c);
    if(!dmi.sending){
        uint16_t len = (uint16_t)dma_ring_available_linear(&dmi.tx_ring);
        dmi.previous_send_len = len;
        dmi.sending = true;
        HAL_UART_Transmit_DMA(dmi.huart, dmi.tx_ring.buf+dma_ring_get_r_ptr(&dmi.tx_ring), len);
    }
}

if the len = 0, the DMA can not go into the DMA interrupt,so the dmi.sending is 1 forever. So the printf function can not work well.

linuxhj avatar Jun 03 '21 08:06 linuxhj