2018-04-29 11:44 AM
Posted on April 29, 2018 at 20:44
Hello Community,
I just getting started with STM32 and Hal Library. For one project i would like to collect data from an RPLidar (2000 Samples per second). In that case i want to use the DMA unit to perform the data collection. After a week of reading Datasheets and don't getting it to work i want to ask you for help. My problem is that i don't know if the DMA collects DATA and not throws any interrupt or it just not collects any data. I think my problem is elementary so i hope i just forget some init. I would be happy if someone with experience in the DMA could watch for my code and say if there is something wrong.
Some information about the project:
I started with the UART example for the STM767ZI from the CUBEMX and tried upon that to get the DMA to work.
main.c
init
2018-04-29 12:49 PM
Typically it is because the DMA isn't working, either it is not triggered, or throws an error. You could paint the buffer with a recognizable data pattern and observe if it changes, but if you don't see HT or TC interrupts it is because it is not doing sufficient transfers.
2018-04-29 02:55 PM
For UART receive make sure that any pending errors have been cleared (parity, framing, noise, etc)
UART5 RX would be DMA1 Channel 4 Stream 0, initialization looks reasonable, although I'd approach this differently.
2018-04-30 03:28 AM
Unfortunately i forgot to set up the IRQ_Handlers. Now i also receive the Error messages for the UART. It is the Overrun Error which was expectable also the DMA receive Data correctly.
But why is the DMA working fine when first the ERROR_Handler is called?
Ok, i think as i am receive data from the uart register the flags are automatically cleared and after that the callback is 'fired'.