I seem to be running the gamut of issues here! The focus now is on how to make use of the UART ports available on the STM32 F1. For those who haven’t been following the saga, I have my build scripts setup like so:
[env:genericSTM32F103C8]
platform = ststm32
framework = arduino
board = genericSTM32F103C8
upload_protocol = dfu
I’m now trying to implement this library, which makes use of a UART port to communicate with the peripheral. In accordance with the example given, I’ve initialized the VescUART
class like so:
VescUart vesc; // VESC
// Init VESC
Serial1.begin(19200);
while (!Serial1) {}
vesc.setSerialPort(&Serial);
However, upon compiling:
Processing genericSTM32F103C8 (platform: ststm32; board: genericSTM32F103C8; framework: arduino)
------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/genericSTM32F103C8.html
PLATFORM: ST STM32 > STM32F103C8 (20k RAM. 64k Flash)
HARDWARE: STM32F103C8T6 72MHz 20KB RAM (64KB Flash)
DEBUG: CURRENT(blackmagic) EXTERNAL(blackmagic, jlink, stlink)
Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF MODES: FINDER(chain) COMPATIBILITY(soft)
Collected 33 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <SD> 1.2.3
| |-- <SPI> 1.0
|-- <VescUart> 1.0.0
|-- <MPU6050_tockn> 1.4.0
| |-- <Wire> 1.0
|-- <Wire> 1.0
Compiling .pioenvs\genericSTM32F103C8\src\main.cpp.o
Archiving .pioenvs\genericSTM32F103C8\lib6a5\libSPI.a
Archiving .pioenvs\genericSTM32F103C8\lib00d\libSD_ID868.a
Indexing .pioenvs\genericSTM32F103C8\lib6a5\libSPI.a
Compiling .pioenvs\genericSTM32F103C8\lib94d\VescUart_ID5830\buffer.cpp.o
Compiling .pioenvs\genericSTM32F103C8\lib94d\VescUart_ID5830\crc.cpp.o
Indexing .pioenvs\genericSTM32F103C8\lib00d\libSD_ID868.a
Compiling .pioenvs\genericSTM32F103C8\lib017\Wire\SoftWire.cpp.o
Compiling .pioenvs\genericSTM32F103C8\lib017\Wire\Wire.cpp.o
Compiling .pioenvs\genericSTM32F103C8\lib017\Wire\utility\WireBase.cpp.o
Compiling .pioenvs\genericSTM32F103C8\lib0d0\MPU6050_tockn_ID2824\MPU6050_tockn.cpp.o
Archiving .pioenvs\genericSTM32F103C8\lib94d\libVescUart_ID5830.a
C:\Users\neilb\.platformio\lib\MPU6050_tockn_ID2824\src\MPU6050_tockn.cpp: In member function 'void MPU6050::calcGyroOffsets(bool)':
C:\Users\neilb\.platformio\lib\MPU6050_tockn_ID2824\src\MPU6050_tockn.cpp:73:23: warning: value computed is not used [-Wunused-value]
wire->read() << 8 | wire->read();
~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
Indexing .pioenvs\genericSTM32F103C8\lib94d\libVescUart_ID5830.aC:\Users\neilb\.platformio\lib\MPU6050_tockn_ID2824\src\MPU6050_tockn.cpp:74:23: warning: value computed is not used [-Wunused-value]
wire->read() << 8 | wire->read();
~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
C:\Users\neilb\.platformio\lib\MPU6050_tockn_ID2824\src\MPU6050_tockn.cpp:75:23: warning: value computed is not used [-Wunused-value]
wire->read() << 8 | wire->read();
~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
C:\Users\neilb\.platformio\lib\MPU6050_tockn_ID2824\src\MPU6050_tockn.cpp:76:23: warning: value computed is not used [-Wunused-value]
wire->read() << 8 | wire->read();
~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
src\main.cpp: In function 'void setup()':
src\main.cpp:108:29: error: no matching function for call to 'VescUart::setSerialPort(USBSerial*)'
vesc.setSerialPort(&Serial);
^
In file included from src\main.cpp:5:0:
C:\Users\neilb\.platformio\lib\VescUart_ID5830\src/VescUart.h:49:8: note: candidate: void VescUart::setSerialPort(HardwareSerial*)
void setSerialPort(HardwareSerial* port);
^~~~~~~~~~~~~
C:\Users\neilb\.platformio\lib\VescUart_ID5830\src/VescUart.h:49:8: note: no known conversion for argument 1 from 'USBSerial*' to 'HardwareSerial*'
src\main.cpp: In function 'void loop()':
src\main.cpp:162:31: warning: second operand of conditional expression has no effect [-Wunused-value]
constrain(rpm, 0, MAX_RPM); // Should be extranous, but just make sure
^
src\main.cpp:162:31: warning: third operand of conditional expression has no effect [-Wunused-value]
*** [.pioenvs\genericSTM32F103C8\src\main.cpp.o] Error 1
I’m not sure why Serial1
is of type USBSerial
and not HardwareSerial
, especially because Serial
is the one that I call to make use of the USB port. Can anyone help explain why this is? Thanks!