2023-03-25 06:54 PM
my code as follows
#include <hackflight.h>
#include <boards/stm32f/stm32f4.h>
#include <core/mixers/fixedpitch/quadxbf.h>
#include <core/pids/angle.h>
#include <debug.h>
#include <escs/dshot.h>
#include <imus/softquat.h>
#include <sbus.h>
#include <vector>
#include <SPI.h>
#include <mpu6x00.h>
#include <dshot_stm32f4.h>
static const uint8_t LED_PIN = PB5;
static const uint8_t IMU_CS_PIN = PA4;
static const uint8_t IMU_INT_PIN = PC4;
static const uint8_t MOTOR1_PIN = PB_0;
static const uint8_t MOTOR2_PIN = PB_1;
static const uint8_t MOTOR3_PIN = PA_3;
static const uint8_t MOTOR4_PIN = PA_2;
static std::vector<uint8_t> stream1MotorPins = {MOTOR3_PIN, MOTOR4_PIN};
static std::vector<uint8_t> stream2MotorPins = {MOTOR1_PIN, MOTOR2_PIN};
static SPIClass spi = SPIClass(
Stm32FBoard::MOSI_PIN, Stm32FBoard::MISO_PIN, Stm32FBoard::SCLK_PIN);
static Mpu6000 mpu = Mpu6000(spi, IMU_CS_PIN);
static bfs::SbusRx rx(&Serial3);
static Stm32F4Dshot dshot;
static DshotEsc esc = DshotEsc(&dshot);
///////////////////////////////////////////////////////
static AnglePidController anglePid;
static Mixer mixer = QuadXbfMixer::make();
static SoftQuatImu imu(Imu::rotate270);
static std::vector<PidController *> pids = {&anglePid};
///////////////////////////////////////////////////////
static Stm32F4Board board(LED_PIN);
extern "C" void DMA2_Stream1_IRQHandler(void)
{
dshot.handleDmaIrqStream1();
}
extern "C" void DMA2_Stream2_IRQHandler(void)
{
dshot.handleDmaIrqStream2();
}
// IMU interrupt
static void handleImuInterrupt(void)
{
board.handleImuInterrupt(imu);
}
// Receiver interrupt
void serialEvent3(void)
{
if (rx.Read()) {
bfs::SbusData data = rx.data();
board.setSbusValues((uint16_t *)data.ch, micros(), data.lost_frame);
}
}
// Interupt from Skyranger
void serialEvent4(void)
{
board.handleSkyrangerEvent(Serial4);
}
void setup(void)
{
// Start receiver UART
Serial3.begin(100000, SERIAL_8E2);
// Start Skyranger UART
Serial4.begin(115200);
spi.begin();
mpu.begin();
board.begin(imu, IMU_INT_PIN, handleImuInterrupt);
dshot.begin(stream1MotorPins, stream2MotorPins);
}
void loop(void)
{
mpu.readSensor();
int16_t rawGyro[3] = { mpu.getRawGyroX(), mpu.getRawGyroY(), mpu.getRawGyroZ() };
int16_t rawAccel[3] = { mpu.getRawAccelX(), mpu.getRawAccelY(), mpu.getRawAccelZ() };
// Support sending attitude data to Skyranger over Serial4
board.step(imu, pids, mixer, esc, rawGyro, rawAccel, Serial4);
}
error message I am getting. any help would be appreciated
:/users/a1buc/appdata/local/arduino15/packages/stmicroelectronics/tools/xpack-arm-none-eabi-gcc/10.3.1-2.3/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: C:\Users\a1buc\AppData\Local\Temp\arduino\sketches\288D9788E91064DEA0187234D39EA2F9\sketch\BetaFpvF405Sbus.ino.cpp.o: in function `_GLOBAL__sub_I_DMA2_Stream1_IRQHandler':
BetaFpvF405Sbus.ino.cpp:(.text.startup._GLOBAL__sub_I_DMA2_Stream1_IRQHandler+0x1ec): undefined reference to `Serial3'
c:/users/a1buc/appdata/local/arduino15/packages/stmicroelectronics/tools/xpack-arm-none-eabi-gcc/10.3.1-2.3/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: C:\Users\a1buc\AppData\Local\Temp\arduino\sketches\288D9788E91064DEA0187234D39EA2F9\sketch\BetaFpvF405Sbus.ino.cpp.o: in function `setup':
BetaFpvF405Sbus.ino.cpp:(.text.setup+0x1ec): undefined reference to `Serial3'
collect2.exe: error: ld returned 1 exit status
Using library Hackflight at version 0.1 in folder: C:\Users\a1buc\OneDrive\Documents\Arduino Projects\libraries\Hackflight
Using library DshotSTM32 at version 0.1 in folder: C:\Users\a1buc\OneDrive\Documents\Arduino Projects\libraries\DshotSTM32
Using library SPI at version 1.0.0 in folder: C:\Users\a1buc\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.4.0\libraries\SPI
Using library Bolder Flight Systems SBUS at version 8.1.4 in folder: C:\Users\a1buc\OneDrive\Documents\Arduino Projects\libraries\Bolder_Flight_Systems_SBUS
Using library MPU6x00 at version 0.0.1 in folder: C:\Users\a1buc\OneDrive\Documents\Arduino Projects\libraries\MPU6x00
Using library SrcWrapper at version 1.0.1 in folder: C:\Users\a1buc\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.4.0\libraries\SrcWrapper
exit status 1
Compilation error: exit status 1
2023-03-25 07:19 PM
changed board type and it compiled