12bit ADC output over USART on STM32
- January 23, 2019
- 3 replies
- 8622 views
My goal: I'm trying to read two ADC pins with 12 bit resolution and output the values through DMA over USART.
I can see that the ADC values are being read in the debug tab in STM32CubeMX. I can "talk" over USART to my serial capture program by having it print "Hello World". However, I cannot get the ADC values to be sent over USART. Part of the problem might be that I need to convert a uint32 to a uint_8 for the USART, although I thought had solved that (with help), but now I'm not so sure. I have a lot of commented out sections of code but would really appreciate someone advice on what I'm doing wrong. The Baud rate on the STM32 and serial monitor are both at 115200.
I attached a zip but I think the issue is likely with the UART transmit part of code:
uint32_t adcVal[2]; /*array to store ADC values*/
HAL_UART_Transmit(&huart2,(void *)adcVal, sizeof(adcVal),10); // Sends 4 bytes, binary data