NUCLEO-F756ZG: Use of 5 serial ports + ethernet

Post here all questions related to STM32 core if you can't find a relevant section!
Post Reply
quest4exit
Posts: 4
Joined: Sat May 07, 2022 6:47 am

NUCLEO-F756ZG: Use of 5 serial ports + ethernet

Post by quest4exit »

Hello,
I have an interesting problem: For a project, I need to use 5 UART ports and ethernet (for mqtt). On a custom pcb I wired my serial connections like this:

UART2_RX: PD_6
UART2_TX: PD_5
UART4_RX: PC_11
UART4_TX: PC_10
UART5_RX: PD_2
UART5_TX: PC_12
UART6_RX: PG_9
UART6_TX: PG_14
UART7_RX: PE_7
UART7_TX: PE_8

Using this very basic code, the port on (PG9, PG14) works:

Code: Select all

#include <DFRobotDFPlayerMini.h>

HardwareSerial Serial1(PG9,PG14);

DFRobotDFPlayerMini mp3Player1;

void setup() {

    Serial1.begin(9600);

    delay(500);

    mp3Player1.begin(Serial1);
  
    delay(500);

    mp3Player1.play(1);
}

void loop() {
}
But as soon, as I add ethernet functionality, I can't get the port to do anything:

Code: Select all

#include <DFRobotDFPlayerMini.h>
#include <LwIP.h>
#include <STM32Ethernet.h>

HardwareSerial Serial1(PG9,PG14);

DFRobotDFPlayerMini mp3Player1;

byte mac[] = {0xDA,0x30,0xDE,0xEE,0xDE,0xEC};

IPAddress ip(192, 168, 178, 177);
IPAddress gateway(192,168,178,1);
IPAddress subnet(255,255,255,0);

EthernetClient ethClient;

void setup() {

    Ethernet.begin(mac, ip);
    
    delay(500);

    Serial1.begin(9600);

    delay(500);

    mp3Player1.begin(Serial1);
  
    delay(500);

    mp3Player1.play(1);
}

void loop() {
}
I didn't find any obvious conflicts regarding the pins PG9 and PG14 ... and now I'm running out ouf ideas. Any suggestion would be highly appreciated.
by fpiSTM » Sat May 07, 2022 7:47 am
Currently Ethernet configure all pins available in PinMap_Ethernet array. PG14 is one of them: https://github.com/stm32duino/Arduino_C ... ins.c#L414

You have to redefine this array with only the required pins.
Go to full post
User avatar
fpiSTM
Posts: 1723
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: NUCLEO-F756ZG: Use of 5 serial ports + ethernet

Post by fpiSTM »

Currently Ethernet configure all pins available in PinMap_Ethernet array. PG14 is one of them: https://github.com/stm32duino/Arduino_C ... ins.c#L414

You have to redefine this array with only the required pins.
quest4exit
Posts: 4
Joined: Sat May 07, 2022 6:47 am

Re: NUCLEO-F756ZG: Use of 5 serial ports + ethernet

Post by quest4exit »

Thank you so much - that did the trick!
Post Reply

Return to “General discussion”