This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

uart problem!!

hey,

I wrote below code but I never get 'A' in output!!!!

I use Arduino uno to read data!

void SysTick_Handler(void){
	i++;
	if(i==1000) i=0;
}
int main(){
	RCC->AHB1ENR|=RCC_AHB1ENR_GPIOAEN;
	RCC->APB1ENR |=RCC_APB1ENR_USART2EN;			// enable usart2
	//PA2,PA3
	GPIOA->MODER |=0xA0;											// enable PA2,PA3
	GPIOA->OSPEEDR |=0xA0; 										// set speed
	GPIOA->AFR[0]=0x7700;											// set AFR7
	USART2->CR1=0x2008;
	USART2->BRR=0x1117;
	SysTick_Config(168000);
	while(1){
		USART2->DR='A';
	}
}

Parents Reply Children