STM32f407 USART3 port does not write to com port terminal window
Hi,
I'm using STM32F407ZG (Waveshare open407Z board) with Coocox version 1.5.0.
http://
I am using Coocox example project "ADCc_DMA.c". I coppied the c file below. It configures the USART3 port of the microController on pins PC10 and PC11.
I was able to build and run the procedure on the board.
But using the USB-to-UART board that came with the board (PL2303), the serial port "terminal window" does not show data written to it.
The driver of USB-to-UART port seems fine as the terminal window does connect to the com port. But there is just no data printing.
Can somebody help me debugging this.
Thanks,
Amin
=======
/* Includes -------
#include "stm32f4xx.h"
#include "stm32f4xx_rcc.h"
#include "stm32f4xx_gpio.h"
#include "stm32f4xx_adc.h"
#include "stm32f4xx_dma.h"
#include "stm32f4xx_usart.h"
#include <stdio.h>
/** @addtogroup STM32F4xx_
* @{
*/
/** @addtogroup ADC_ADC3_DMA
* @{
*/
/* Private typedef -------
/* Private define -------
/* if you are not using the LCD, you can monitor the converted value by adding
the variable "ADC3ConvertedV
#define ADC3_DR_ADDRESS ((uint32_
/* Private macro -------
/* Private variables -------
__IO uint16_t ADC3ConvertedValue = 0;
__IO uint32_t ADC3ConvertedVo
/* Private function prototypes -------
/* Private functions -------
void ADC3_CH7_
void USART_Config(void);
void Display(void);
/**
* @brief ADC convert potentimeter program
* @param None
* @retval None
*/
void ADCConvert_
{
/*!< At this stage the microcontroller clock setting is already configured,
this is done through SystemInit() function which is called from startup
file (startup_
To reconfigure the default setting of SystemInit() function, refer to
*/
USART_Config();
/* ADC3 configuration *******
/* - Enable peripheral clocks */
/* - DMA2_Stream0 channel2 configuration */
/* - Configure ADC Channel7 pin as analog input */
/* - Configure ADC3 Channel7 */
ADC3_
/* Start ADC3 Software Conversion */
ADC_SoftwareS
while (1)
{
ADC3Convert
/* Display ADC3 converted value on Hyperterminate */
Display();
}
}
/**
* @brief ADC3 channel07 with DMA configuration
* @param None
* @retval None
*/
void ADC3_CH7_
{
ADC_InitTypeDef ADC_InitStructure;
ADC_CommonIni
DMA_InitTypeDef DMA_InitStructure;
GPIO_InitTypeDef GPIO_InitStructure;
/* Enable ADC3, DMA2 and GPIO clocks *******
RCC_AHB1Perip
RCC_APB2Perip
/* DMA2 Stream0 channel2 configuration *******
DMA_InitStruc
DMA_InitStruc
DMA_InitStruc
DMA_InitStruc
DMA_InitStruc
DMA_InitStruc
DMA_InitStruc
DMA_InitStruc
DMA_InitStruc
DMA_InitStruc
DMA_InitStruc
DMA_InitStruc
DMA_InitStruc
DMA_InitStruc
DMA_InitStruc
DMA_Init(
DMA_Cmd(
/* Configure ADC3 Channel7 pin as analog input *******
GPIO_
GPIO_
GPIO_
GPIO_Init(GPIOF, &GPIO_InitStruc
/* ADC Common Init *******
ADC_CommonIni
ADC_CommonIni
ADC_CommonIni
ADC_CommonIni
ADC_CommonIni
/* ADC3 Init *******
ADC_InitStruc
ADC_InitStruc
ADC_InitStruc
ADC_InitStruc
ADC_InitStruc
ADC_InitStruc
ADC_InitStruc
ADC_Init(ADC3, &ADC_InitStruct
/* ADC3 regular channel7 configuration *******
ADC_RegularCh
/* Enable DMA request after last transfer (Single-ADC mode) */
ADC_DMAReques
/* Enable ADC3 DMA */
ADC_DMACmd(ADC3, ENABLE);
/* Enable ADC3 */
ADC_Cmd(ADC3, ENABLE);
}
void USART_Config(void)
{
/* USARTx configured as follow:
- BaudRate = 115200 baud
- Word Length = 8 Bits
- One Stop Bit
- No parity
- Hardware flow control disabled (RTS and CTS signals)
- Receive and transmit enabled
*/
GPIO_InitTypeDef GPIO_InitStructure;
USART_InitTypeDef USART_InitStruc
/* Enable GPIO clock */
RCC_AHB1Perip
/* Enable UART clock */
RCC_APB1Perip
/* Connect PXx to USARTx_Tx*/
GPIO_
/* Connect PXx to USARTx_Rx*/
GPIO_
/* Configure USART Tx as alternate function */
GPIO_
GPIO_
GPIO_
GPIO_
GPIO_
GPIO_Init(GPIOC, &GPIO_InitStruc
/* Configure USART Rx as alternate function */
GPIO_
GPIO_
GPIO_Init(GPIOC, &GPIO_InitStruc
USART_
USART_
USART_
USART_
USART_
USART_
/* USART configuration */
USART_
/* Enable USART */
USART_Cmd(USART3, ENABLE);
}
/**
* @brief Display ADC converted value via USART
* @param None
* @retval None
*/
void Display(void)
{
uint32_t v=0,mv=0;
v=(ADC3Conver
mv = (ADC3ConvertedV
printf(" ADC = %u,%u V \n\r",v,mv);
}
/**
* @}
*/
/**
* @}
*/
/******
Question information
- Language:
- English Edit question
- Status:
- Answered
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask Amin Kamalzadeh for more information if necessary.