UART DMA sends sometimes random data when using ADC
Hi everyone,
I'm relatively new to STM, i'm making my diploma thesis with it. It's going to be a mini, portable oscilloscope, but at this point I'm totally stuck. I started using ADC with DMA, but soon I realised this might be not the perfect option, so I dumped the idea, and started using instead the UART with DMA. It all worked well, until I started working with ADC too. I tried interrupt and poll mode too, but I always end up with random spikes, when I monitor the transmitted data. It goes well, if there are small, slow changes in voltage, but every time, when there is a relatively fast(now I do it with a 10K potentiometer, so fast means a half turn with a fast move). It just goes up from 2-3000mVs instantly to over a million, and immediately falls back to the previous value. I checked in code, the measured and calculated values are ok, they never go up, so it seems like the problem is with UART. I don't have an oscilloscope, or any equipment(just a cheap crap multimeter), and I can't go to the university thanks to covid, so I would really appreciate any help, because i'm out of ideas. Already tried changing baudrate, adc sampling time, modifying/deleting IT handlers etc. but none of them seemed to help.
I'm using a Nucleo-L452RE-P board.
Code in the link(everything is written in main.c: https://github.com/ibruno26/szakdolgozat)
Thanks for everything.
