Page 1 of 1

Using USART3 for serial and USART3 CTS pin as GPIO

Posted: Fri Oct 30, 2020 12:28 pm
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.

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

Posted: Fri Oct 30, 2020 1:51 pm
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...

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

Posted: Fri Oct 30, 2020 3:58 pm
by arthurkafer
Got it, thanks for the quick reply