Page 1 of 1

STM32L073RZTx + USART4 Doable?

Posted: Mon Mar 03, 2025 3:30 pm
by kevin192291
Hello All!
I have a custom board that has a LC76G (gps chip) connected to USART 4.
I have verified with my oscilloscope that the LC76G IS sending data... but the RX pin (PC11) isn't recieving anything :(
I have been working non-stop on this for 2 days, and am at my wits end.

I am using Platformio with arduinostm32 lib.

Here is what I have tried:
Using SoftwareSerial, no luck, though hardware would be better.
defining it as a HardwareSerial device, like so:

Code: Select all

HardwareSerial Serial1(USART1); //works
HardwareSerial Serial2(USART2); //works
HardwareSerial Serial4(USART4); // does't work :(
I have tried adding build flags to my platformio.ini file:
build_flags =

Code: Select all

    -D ENABLE_HWSERIAL4
    -D HAL_UART_MODULE_ENABLED
    -D PIN_SERIAL4_TX=PC11
    -D PIN_SERIAL4_RX=PC10
Tried manually setting the setRx() and setTx() calls
and many (many) more things...
Without any luck :(

I did make sure the device works because I soldered 2 wires to the GPS on the board,
the Rx, and GND, and connected thoes to my TTL/Uart converter to my PC, and I made sure i can get data
I did, this shows me my board is correctly powering the chip, and it is correctly handling the reset pin.

Is this possible to do? If so, where am I going wrong with my 4th serial port?

Thank you all so much for any help at all!!!

-Kevin

Re: STM32L073RZTx + USART4 Doable?

Posted: Mon Mar 03, 2025 6:03 pm
by fpiSTM
Add _ALT1 after PC11 an PC10:
-D PIN_SERIAL4_RX=PC11_ALT1
-D PIN_SERIAL4_TX=PC10_ALT1

And it seems you invert rx and Tx in your definition ;)
Looks strange to have a space after -D. :roll:

Re: STM32L073RZTx + USART4 Doable?

Posted: Tue Mar 04, 2025 3:29 am
by kevin192291
fpiSTM wrote: Mon Mar 03, 2025 6:03 pm Add _ALT1 after PC11 an PC10:
-D PIN_SERIAL4_RX=PC11_ALT1
-D PIN_SERIAL4_TX=PC10_ALT1

And it seems you invert rx and Tx in your definition ;)
Looks strange to have a space after -D. :roll:
Hello @fpiSTM ! That did the trick! I worked on this without stop for so long and it was something so small. I did see the _ALT defs in the variants file as i was looking for fixes, but I didn't see any documentation on it. Is there a link to the docs around this so I can learn for next time?

Also, is it best practice to NOT use a space after the -D in my ini file? :p