cancel
Showing results for 
Search instead for 
Did you mean: 

no output of USART with STM32-H103 board

yfbaidyj
Associate
Posted on November 14, 2008 at 07:15

no output of USART with STM32-H103 board

1 REPLY 1
yfbaidyj
Associate
Posted on May 17, 2011 at 12:52

Hallo everybody,

I am new with the Cortex M3 and have some problems using the UART. I can´t see any output on Windows Terminal. I use CrossStudio for ARM with Olimex ARM-USB-OCD and this is the source codes :

void RCC_Configuration(void)

{

RCC_DeInit();

// 2. Enable ext. high frequency OSC

RCC_HSEConfig(RCC_HSE_ON);

// wait until the HSE is ready

while(RCC_GetFlagStatus(RCC_FLAG_HSERDY) == RESET);

// 3. Init PLL

RCC_PLLConfig(RCC_PLLSource_HSE_Div1,RCC_PLLMul_9); // 72MHz

RCC_PLLCmd(ENABLE);

// wait until the PLL is ready

while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET);

// 4. Set system clock divders

/* RCC_USBCLKConfig(RCC_USBCLKSource_PLLCLK_1Div5); */

RCC_HCLKConfig(RCC_SYSCLK_Div1); // AHB Clock = 72 MHz

RCC_PCLK2Config(RCC_HCLK_Div1);

RCC_ADCCLKConfig(RCC_PCLK2_Div8); // ADC Clock = 8 MHz

RCC_PCLK1Config(RCC_HCLK_Div2);

// Flash 1 wait state

*(vu32 *)0x40022000 = 0x12;

// 5. Clock system from PLL

RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);

while(RCC_GetSYSCLKSource() != 0x08)

{

}

RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOC | RCC_APB2Periph_GPIOB | RCC_APB2Periph_AFIO | RCC_APB2Periph_ADC1 |RCC_APB2Periph_AFIO | RCC_APB2Periph_USART1, ENABLE);

}

int main (void)

{

#ifdef DEBUG

debug();

#endif

/* System clocks configuration ---------------------------------------------*/

RCC_Configuration();

// Configure PA.9 (USARTT1_TX) as output Open Drain Output Alternate-Function

GPIO_ResetBits(GPIOA,GPIO_Pin_9);

GPIO_InitStruct.GPIO_Pin = GPIO_Pin_9;

GPIO_InitStruct.GPIO_Mode = GPIO_Mode_AF_OD;

GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;

GPIO_Init(GPIOA, &GPIO_InitStruct);

USART_Configuration();

USART_Cmd(USART1, ENABLE);

while(1)

{

USART_SendData(USART1, 0xaa);

while(!USART_GetFlagStatus(USART1, USART_FLAG_TXE))

{

}

while(!USART_GetFlagStatus(USART1, USART_FLAG_TC))

{

}

}

}

/*******************************************************************************/

void USART_Configuration(void)

{

USART_InitTypeDef USART_InitStruct;

/* Configure -------------------------*/

USART_InitStruct.USART_BaudRate = 9600; /* 9600 Baud */

USART_InitStruct.USART_WordLength = USART_WordLength_8b;

USART_InitStruct.USART_StopBits = USART_StopBits_1;

USART_InitStruct.USART_Parity = USART_Parity_No ;

USART_InitStruct.USART_HardwareFlowControl = USART_HardwareFlowControl_None;

USART_InitStruct.USART_Mode = USART_Mode_Tx;

/* USART_InitStruct.USART_Clock = USART_Clock_Enable;

USART_InitStruct.USART_CPOL = USART_CPOL_Low;

USART_InitStruct.USART_CPHA = USART_CPHA_1Edge;

USART_InitStruct.USART_LastBit = USART_LastBit_Disable; */

USART_Init(USART1, &USART_InitStruct);

}

I have tested the output of UART Tx Pin with oscilloscope but there is output signal. Before i have already test program loading by the simple ''blinky'' program and it´s ok.

I really have no idea. Could someone help me ? thank u