m5stack_BMPCC6K fix stack smashing protect failure

Hi,
I am new to this community and I hope my post is in the right space of discussion.

I am trying to control a Blackmagic 6k camera with an M5stack (esp32) board. I followed this GitHub tutorial: GitHub - schoolpost/BlueMagic32: Arduino ESP32 Library for connecting to Blackmagic Cameras using Bluetooth Low Energy.

my setup:

MAC: M2 ventura 13
Arduino IDE: 2.1.0
Esp32 board manager version 1.0.4
Library: GitHub - schoolpost/BlueMagic32: Arduino ESP32 Library for connecting to Blackmagic Cameras using Bluetooth Low Energy.

Example used:

#include <BlueMagic32.h>

#define BUTTON_PIN 0

int buttonState;           // the current reading from the input pin
int lastButtonState = LOW; // the previous reading from the input pin

unsigned long lastDebounceTime = 0; // the last time the output pin was toggled
unsigned long debounceDelay = 50;   // the debounce time; increase if the output flickers

void setup()
{

    Serial.begin(115200);

    BMDConnection.begin("BlueMagic32");
    BMDControl = BMDConnection.connect();

    pinMode(BUTTON_PIN, INPUT);
}

void loop()
{

    int reading = digitalRead(BUTTON_PIN);

    // If the switch changed, due to noise or pressing:
    if (reading != lastButtonState)
    {
        lastDebounceTime = millis();
    }

    if ((millis() - lastDebounceTime) > debounceDelay)
    {
        if (reading != buttonState)
        {
            buttonState = reading;

            // only toggle the LED if the new button state is HIGH
            if (buttonState == HIGH)
            {
                if (BMDConnection.available())
                {
                    BMDControl->toggleRecording();
                }
            }
        }
    }

    lastButtonState = reading;
}

But when I enter the password given by the camera, the M5stack reboot. I get this message in the monitor:

BLE Advertised Device found: 
---> PLEASE ENTER 6 DIGIT PIN (end with ENTER) : 
517380
Stack smashing protect failure!

abort() was called at PC 0x400df9bc on core 1

Backtrace: 0x40092a2c:0x3ffc9610 0x40092c5d:0x3ffc9630 0x400df9bc:0x3ffc9650 0x400d93ff:0x3ffc9670 0x400d9426:0x3ffc9730 0x400d577d:0xa0b063cc

Rebooting...
BLE Advertised Device found:

Do you have any idea how could I settle this problem?

Thank you for your help.
Nelson

I moved your topic to an appropriate forum category @neloutch.

In the future, please take some time to pick the forum category that best suits the subject of your topic. There is an "About the _____ category" topic at the top of each category that explains its purpose.

This is an important part of responsible forum usage, as explained in the "How to get the best out of this forum" guide. The guide contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.