Using USART3 for serial and USART3 CTS pin as GPIO

All about boards manufactured by ST
Post Reply
arthurkafer
Posts: 2
Joined: Fri Oct 30, 2020 12:13 pm

Using USART3 for serial and USART3 CTS pin as GPIO

Post by arthurkafer »

Hello guys

I'm using the STM32F070CBT6TR MCU in a custom board and I'm using all of its pins in my project. I'm trying to use Serial3 for debugging just as a test and writing a pin as output, PA6. My code is simple, its just starting USART3 serial and it's working fine, but when I try to digitalWrite PA6, serial just stops working. I read on the datasheet that PA6 has the USART3_CTS configuration, and I don't understend how it stops serial communication. Is there another configuration I need to make to disable that pin as a CTS default pin?

As far as I know, stm32duino libraries does not have support for CTS/RTS, but I wonder if I could disable it anyways.

Here's my simple sketch:

Code: Select all

#include <HardwareSerial.h>
HardwareSerial SerialPort(USART3);

void setup() {
	SerialPort.begin(9600);
	SerialPort.println("DAE");
    pinMode(PA8, INPUT);
	pinMode(PA6, OUTPUT);
	digitalWrite(PA6, HIGH);

}

void loop() {
	SerialPort.println(analogRead(PA8));
}
We tried to call serial.begin before and after setting PA6 pinMode but serial still doesnt work. If we dont use PA6 (not calling pinMode and digitalWrite), serial works fine.
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: Using USART3 for serial and USART3 CTS pin as GPIO

Post by fpiSTM »

You should better create your own variant for the STM32F070CBT6TR instead of using the Nucleo_F072RB one.
They do not use the same CMSIS device definition, etc...
arthurkafer
Posts: 2
Joined: Fri Oct 30, 2020 12:13 pm

Re: Using USART3 for serial and USART3 CTS pin as GPIO

Post by arthurkafer »

Got it, thanks for the quick reply
Post Reply

Return to “STM boards (Discovery, Eval, Nucleo, ...)”