#Sending msp packets to fc

1 messages · Page 1 of 1 (latest)

atomic cedar
#

Hi; I am currently attempting to send raw mspv2 packets over a chip to a betafpv fc. Link to said fc (4in1 version) is here; https://betafpv.com/collections/brushless-flight-controller/products/matrix-1s-brushless-flight-controller-hd

I was previously successful in sending msp packets, but this is no longer the case. I don't know why; I was previously successful with the exact same board, but had to replace it. I am now attempting to re-configure it so it recieves the code as previous. Said javascript code is in the response below.

Screenshots of my betaflight are attached below, and so is the respective javacript code (in a response below). Status, serial, are below, dump.cli as a text file is attached.

status

MCU G474 Clock=168MHz (PLLR-HSI), Vref=3.31V, Core temp=47degC
Stack size: 2048, Stack address: 0x2001fff0
Configuration: CONFIGURED, size: 3955, max available: 8192
Devices detected: SPI:1, I2C:0
Gyros detected: gyro 1 locked dma
GYRO=ICM42688P, ACC=ICM42688P
OSD: NONE (237 x 169)
BUILD KEY: 99e9954b77e60910ee61ac5fbf2968fe (4.5.2)
System Uptime: 330 seconds, Current Time: 2026-01-13T15:58:04.541+00:00
CPU:41%, cycle time: 136, GYRO rate: 7352, RX rate: 15, System rate: 9
Voltage: 0 * 0.01V (0S battery - NOT PRESENT)
I2C Errors: 0
FLASH: JEDEC ID=0x00852018 16M
Arming disable flags: RXLOSS CLI MSP DSHOT_TELEM

serial

serial 20 1 115200 57600 0 115200
serial 0 2048 115200 57600 0 115200
serial 1 1 115200 57600 0 115200
serial 2 0 115200 57600 0 115200
serial 3 0 115200 57600 0 115200

BETAFPV

The Matrix 1S Brushless Flight Controller redefines 1S whoop performance with two purpose-driven architectures: the 3IN1 for DJI O4 digital dominance and the 4IN1 for analog mastery

#

serial.redirect(SerialPin.P1, SerialPin.P2, BaudRate.BaudRate115200)

// State
let armed = false
let angleMode = true   // Assume drone already in ANGLE mode
let pitch = 1500       // Neutral pitch

// Build and send MSP_SET_RAW_RC
function sendRC() {
    let buf = pins.createBuffer(9 + 32)

    // MSPv2 header
    buf[0] = 0x24
    buf[1] = 0x58
    buf[2] = 0x3C
    buf[3] = 0x00        // flag
    buf[4] = 0xC8        // MSG_ID = 200 LE
    buf[5] = 0x00
    buf[6] = 0x20        // payload length = 32 bytes
    buf[7] = 0x00
#
    // Channels: Roll, Pitch, Throttle, Yaw, AUX1, AUX2, CH7–16
    let channels = [
        1500,                // Roll
        pitch,               // Pitch
        1000,                // Throttle safe
        1500,                // Yaw
        armed ? 2000 : 1000, // AUX1 (ARM)
        angleMode ? 2000 : 1000, // AUX2 (ANGLE)
        1000, 1000, 1000, 1000,
        1000, 1000, 1000, 1000,
        1000, 1000
    ]

    // Payload little-endian
    let idx = 8
    for (let ch of channels) {
        buf[idx++] = ch & 0xFF
        buf[idx++] = (ch >> 8) & 0xFF
    }

    // CRC8-DVB-S2
    let crc = 0
    for (let i = 3; i < idx; i++) {
        crc ^= buf[i]
        for (let b = 0; b < 8; b++) {
            crc = (crc & 0x80) ? ((crc << 1) ^ 0xD5) : (crc << 1)
            crc &= 0xFF
        }
    }
    buf[idx] = crc

    serial.writeBuffer(buf)
}

// LED feedback using preset icons
function updateLED() {
    if (armed && angleMode) {
        basic.showIcon(IconNames.Happy)
    } else if (armed) {
        basic.showIcon(IconNames.Heart)
    } else if (angleMode) {
        basic.showIcon(IconNames.Diamond)
    } else {
        basic.showIcon(IconNames.SmallSquare)
    }
}
// Button A → increase pitch or part of ARM combo
input.onButtonPressed(Button.A, function () {
    if (input.buttonIsPressed(Button.B) && angleMode) {
        // Both pressed → toggle ARM
        armed = !armed
    } else {
        // Single press → pitch +10
        pitch += 10
        if (pitch > 2000) pitch = 2000
    }
    sendRC()
    updateLED()
})

// Button B → decrease pitch or part of ARM combo
input.onButtonPressed(Button.B, function () {
    if (input.buttonIsPressed(Button.A) && angleMode) {
        // Both pressed → toggle ARM
        armed = !armed
    } else {
        // Single press → pitch -10
        pitch -= 10
        if (pitch < 1000) pitch = 1000
    }
    sendRC()
    updateLED()
})
atomic cedar
#

Sending msp v2 packets to fc

#

Sending msp packets to fc