2019-06-02 11:35 PM
#include "stm32f10x.h"
void usartSetup (void);
int SendChar ();
int main()
{
while(1)
{
usartSetup();
SendChar();
}
}
void usartSetup (void)
{
RCC->APB1ENR = 0x00040000;
RCC->APB2ENR = 0x0000000C;
GPIOB->CRH = 0x00000900;
USART3->BRR = 0x340;
USART3->CR1 = 0x00002008;
}
int SendChar ()
{
while (!(USART3->SR & 0x00000080));
USART3->DR = '2';
}
I tried this simple program for USART3 communication, it doesnot work for me. I initialize the registers as same as USART1, is there any configuration i missed in above code, please point me out.
2019-06-02 11:53 PM
What's with the sock-puppet accounts?
https://community.st.com/s/question/0D50X0000Aqql5aSQA/about-usart-in-stm32
Perhaps OR on clock signals rather than blind writing.
Document or comment the code so we know what pins and ports we're talking about, and you'll remember a week from now when you come back to the code.
Is anything else physically connected to the pins?
Can you use a scope to understand what's happening?
Can you use a debugger to check what registers are getting set too?
Consider that APB1 will clock at 36 rather than 72 MHz.