Skip to main content
AAnth.1
Senior
July 21, 2020
Question

STM32F407 UART problems. PuTTY, FTDI USB to TTL converter

  • July 21, 2020
  • 2 replies
  • 1608 views

EDIT: For crying out loud. Why is half of my code chopped off? 

#if !defined(__SOFT_FP__) && defined(__ARM_FP)
 #warning "FPU is not initialized, but the project is compiling for an FPU. Please initialize the FPU before use."
#endif
 
#include "stm32f4xx.h"
 
//	UART1 is used. Sits on APB2 bus
//	GPIOA sits on AHB1 bus. USART1 is AF7 for PA9 and PA10
//	PA9:	USART1_TX
//	PA10:	USART1_RX
//	Baudrate: 9600
 
void funcGPIOInit();
void funcUARTInit();
void funcUARTSend();
 
int main(void)
{
	funcGPIOInit();
	funcUARTInit();
	funcUARTSend();
	for(;;)
	{
 
	}
}
 
void funcGPIOInit()
{
	// Enable AHB1 bus. Set PA9 and PA10 to AF,
	RCC->AHB1ENR |= (1MODER |= (2MODER |= (2OTYPER &= ~(1OTYPER &= ~(1OSPEEDR &= ~(3OSPEEDR &= ~(3PUPDR &= ~(3PUPDR &= ~(3AFR[1] |= (7AFR[1] |= (7APB2ENR |= (1BRR = 0xD03;
	USART1->CR1 |= (1CR1 &= ~(1CR1 &= ~(1CR1 |= (1CR2 &= ~(3CR1 |= (1DR = 120;
}

This topic has been closed for replies.

2 replies

AAnth.1
AAnth.1Author
Senior
July 21, 2020
#if !defined(__SOFT_FP__) && defined(__ARM_FP)
 #warning "FPU is not initialized, but the project is compiling for an FPU. Please initialize the FPU before use."
#endif
 
#include "stm32f4xx.h"
 
//	UART1 is used. Sits on APB2 bus
//	GPIOA sits on AHB1 bus. USART1 is AF7 for PA9 and PA10
//	PA9:	USART1_TX
//	PA10:	USART1_RX
//	Baudrate: 9600
 
void funcGPIOInit();
void funcUARTInit();
void funcUARTSend();
 
int main(void)
{
	funcGPIOInit();
	funcUARTInit();
	funcUARTSend();
	for(;;)
	{
 
	}
}
 
void funcGPIOInit()
{
	// Enable AHB1 bus. Set PA9 and PA10 to AF,
	RCC->AHB1ENR |= (1MODER |= (2MODER |= (2OTYPER &= ~(1OTYPER &= ~(1OSPEEDR &= ~(3OSPEEDR &= ~(3PUPDR &= ~(3PUPDR &= ~(3AFR[1] |= (7AFR[1] |= (7APB2ENR |= (1BRR = 0xD03;
	USART1->CR1 |= (1CR1 &= ~(1CR1 &= ~(1CR1 |= (1CR2 &= ~(3CR1 |= (1DR = 120;
}

AAnth.1
AAnth.1Author
Senior
July 21, 2020

I just noticed that the forum software alters my code snipped. LOL guys, seriously? You seem to have a bug in your software.

Tesla DeLorean
Guru
July 21, 2020

It is more likely what you're pasting. On a Mac?

Just attach as a buildable .C​ rather than inlining the code.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
AAnth.1
AAnth.1Author
Senior
July 21, 2020

Hi clive1, I paste my code in from a windows machine. WIN10 as I did before in my other posts as well. I can also see that the software modifies my code. I set every register bit in its own line of code. However, the code shown above collected all register manipulations with an OR.

Anyway, let me attach the main.c file which contains the source code.

Thank you,

0693W000001tJC5QAM.jpg

0693W000001tJBlQAM.png

0693W000001tJBRQA2.png