2019-01-31 08:56 PM
I'm using the nucelo STM32F446RE dev board and attempting to output two ADC channels over UART (technically I think it's USART). I Can see in the debug tab that I'm reading the ADC channels correctly. I had been reading out one channel over UART 2 (the default) but I'm now trying to read two channels our over UART 1 but I'm not getting any data out of the UART (both Baud rates are matched, and it's connected to my computer). On the Dev board I had to Bridge SB62 and SB63 and took off SB13 and SB14 to enable UART 1.
To read two ADC channels I used the DMA, but I'm using the "HAL_UART_Transmit" command to try to transmit the data. I noticed there is a "HAL_UART_Transmit_DMA" command, do I have to use that instead? When trying to read the UART I get no data output.
If someone has time to take a look at my code or make a suggestion(main.c file attached), I'm probably making a very simple mistake and would be forever grateful for any help. Thanks in advance.
2019-01-31 11:27 PM
> I noticed there is a "HAL_UART_Transmit_DMA" command, do I have to use that instead?
I suppose yes, but I'm not into Cube code.
My approach would have been different.
Two ADC channels instead of one are just a few bytes more to transmit. I would have picked up the ADC results at once (EOS), and send them at once, preferably as ASCII string.
Once that worked, I would think about switching to DMA.
2019-02-01 08:42 AM
If you implement a sw fifo to queue and send text from adc text converted data to usart tx, detecting issues maybe easier, especially the time to send 2 adc channels data by usart vs adc refresh speed. Worst case, put your 2 adc values in volatile global data, then in the main loop, read and send them by usart.