WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

STM32F405 and UART4 compiling problem #1555

@luca-stm32

Description

@luca-stm32

Core 2.1.0
Arduino IDE 1.8.16
Linux 64 bit

I'm developing a board with a STM32F405ZGT6 processor. I'm using the variant "GenericF407ZGTx" because it has the pheripherals that I need.

I need Serial1, Serial4 and Serial5, so I wrote the declaration code in this way:

// RX TX
HardwareSerial Serial1(PA10, PA9);

// RX TX
HardwareSerial Serial5(PD2, PC12);

// RX TX
HardwareSerial Serial4(PC11, PC10);

But, if I compile the code, the copiler tells me that Serial4 is already declared in HardwareSerial.cpp.

So I opened te file variant_generic.h (under hardware\stm32\2.1.0\variants\STM32F4xx\F407Z(E-G)T and changed the line:
// UART Definitions
#ifndef SERIAL_UART_INSTANCE
#define SERIAL_UART_INSTANCE 4
#endif

in:

// UART Definitions
#ifndef SERIAL_UART_INSTANCE
#define SERIAL_UART_INSTANCE 6
#endif

In this way, sketch compiles and serial is running.

What is the purpose of this define?
Is there something that I need to do to make serial4 work without modify sources?

Best regards.
Luca

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions