Skip to content

Hard fault when DMA transmitting at the same time #7

@ranshalit

Description

@ranshalit

Hello,

The demonstration works perfectly.
But on trying to add continuous dma transmit HAL_UART_Transmit_DMA at the same time, we get hard fault.
I first verified that dma transmit alone works without any issues, and it does.
Than I tried to understand why I get hard fault:
According to my testing I see that pos index in dma_rx_buf[pos] is larger than buffer size.
Further cheking shows that it happens in timout case (flag is 1) and that dma_uart_rx.prevCNDTR is smaller than currCNDTR which gives a negative value for length , i.e. very large value !

length = (dma_uart_rx.prevCNDTR < DMA_BUF_SIZE) ? (dma_uart_rx.prevCNDTR - currCNDTR)
I first thought that maybe the system is too busy, but trying to do something else (instead of dma transmission does not give the same fault).

I still try to understand why it happens.

Thanks for any suggestion,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions