Nucleo_l073rz USART4 Useable?

Hi all!
I have a custom board using USART4, but it seems that my code is unable to get the data from the connected device.
I used a scope, and a TTL/USB converter to the chip (PC gnd & Rx ← → gnd Tx board) and see the correct output.

I attempted to add:
[env:nucleo_l073rz]

platform = ststm32

board = nucleo_l073rz

framework = arduino

build_flags =

-DSTM32_ENABLE_USART4

To my build flags but no luck. has anyone got USART4 working?

Thanks all!

Can you link to the code that checks for this flag? I don’t find any results. There is howerver ENABLE_HWSERIAL4 which enables Serial4, mapping to USART4, to be used.

You also didn’t show the Arduino code you’re running, so it’s hard to say whether there’s a fault there.

In theory, using the platformio.ini will make Serial4 work with TX = PA0, RX = PA1. (Note: The only other valid USART4 pins are PC10, PC11, in alternate pin mapping configurations, per PeripheralPins.c. Also see mbedos).

[env:nucleo_l073rz]
platform = ststm32
board = nucleo_l073rz
framework = arduino
build_flags =
  -DENABLE_HWSERIAL4
  -DPIN_SERIAL4_TX=PA0
  -DPIN_SERIAL4_RX=PA1
#include <Arduino.h>

void setup() {
    Serial.begin(9600); // connection to PC (ST-Link)
    Serial4.begin(9600); // TX = PA0, RX = PA1,available as A0 and P1 on Arduino header
    Serial.println("Firmware start!");
}

void loop() {
    while(Serial4.available()) {
        char rx = (char) Serial4.read();
        Serial.print(rx);
    }
}