Arduino code compiles, will not work on Nucleo

Post here first, or if you can't find a relevant section!
Post Reply
GlenB
Posts: 1
Joined: Mon Aug 24, 2020 6:40 pm

Arduino code compiles, will not work on Nucleo

Post by GlenB »

Hello,

I have configured a project originally designed for the Arduino Uno/Mega for one of my Nucleo 64 boards.

The project compiles cleanly, but does not work on the Nucleo board. I have tried F103, F303, F446 boards.

The project uses 3 serial ports, and the F303 and F446 boards have at least 4 serial ports. Control port, GPS port, and Nextion display port.

I am assuming the problem is that the compiler is using Arduino libraries, not STM32F libraries. It seems,
however, that Serial (serial0) is working, the control port. It will NOT compile using Serial1 or Serial4 or higher.

I do not know how to make the Arduino IDE stop using one library in favor of another. I suspect this is just the tip of the iceberg, because the same thing is likely to happen when using the I2C, SPI or other peripherals.

TIA for any help, if I am on the wrong forum, sorry, let me know which one this question should be directed to...

GlenB
fredbox
Posts: 125
Joined: Thu Dec 19, 2019 3:05 am
Answers: 2

Re: Arduino code compiles, will not work on Nucleo

Post by fredbox »

Assuming core 1.9.0 and a F103 board:

Code: Select all

HardwareSerial Serial1(PA10, PA9);
HardwareSerial Serial2(PA3, PA2);
HardwareSerial Serial3(PB11, PB10);
void setup(){
  Serial1.begin(9600);
  Serial2.begin(9600);
  Serial3.begin(9600);
}
In the options, select USART enabled, no generic serial. Names Serial1, 2, 3, are suggestions. Name them anything you want. I use gpsSerial for the port connected to my GPS module.
Post Reply

Return to “General discussion”