Arm Mbed OS support forum

Update from MBED OS 5 to 6 Causes unknown freeze

I have updated my MBED OS library from 5.15 to 6.13 and have replaced all the deprecated code. Now when i flashed the firmware to the MAX32630FTHR it just freezes and does not output anything to the serial console. I create all the classes that i use statically in the main. When disabling some of the classes the main function runs and prints out a message back to me. Here is my main.cpp code:

#include "Controller.h"
#include "Buttons.h"
#include "ErrorHandler.h"
#include <cstdint>
#include "SerialConstructor.h"
#include "gpio_regs.h"

static const std::string FirmwareVersion = "";

ControllerEventQueue eventQueue;
UnbufferedSerial pc(P2_1, P2_0, 115200);
UnbufferedSerial blue(P0_1, P0_0, 115200); 
// BluetoothCOM ble(blue, pc); 
// I2C i2cACC(P1_6, P1_7);
// I2C i2cPMIC(P3_4, P3_5);
DigitalOut ceECG(P0_7);         // CE Chip enable pin MAX30001

// SPI spiECG(P0_5, P0_6, P0_4);   // MOSI, MISO, SCLK lines from MAX30001
// SPI spiFlash(P1_1, P1_2, P1_0); // MOSI, MISO, SCLK lines from ISSI chip
DigitalOut ceFlash(P1_3, 1);    // CE Chip enable pin flash memory, pulled high
DigitalOut resetFlash(P1_5, 1); // Reset pin serial flash memory, pulled high
// MAX30001 ecg(&spiECG, &ceECG);
// MAX30001_helper ecg_helper(ecg, pc);
// SerialFlash flash(spiFlash, ceFlash, resetFlash);
// PMIC pmic(i2cPMIC);
// FuelGauge fuelgauge(i2cPMIC);
// IMU imu(i2cACC);

DigitalIn intPMIC(P6_7);
DigitalIn intECG(P6_3);
DigitalIn intRtoR(P6_4);
DigitalIn intACC(P6_2);
DigitalIn PSUSwitch(P7_4, PullNone);
DigitalIn MCUSwitch(P5_6, PullNone);
// Buttons buttons(PSUSwitch, MCUSwitch, pmic);
DataManagement dataManagement;
Oscillator oscillator;

DigitalInOut greenLED(P7_1, PIN_OUTPUT, OpenDrain, 0);
DigitalInOut redLED(P7_2, PIN_OUTPUT, OpenDrain, 1);
DigitalInOut blueLED(P7_0, PIN_OUTPUT, OpenDrain, 1);
StatusLED statusLED(greenLED, redLED, blueLED);

// Controller controller(eventQueue, ble, pc, ecg_helper, intPMIC, intECG, intRtoR,
//                       intACC, pmic, imu, dataManagement,
//                       fuelgauge, statusLED, oscillator);

int main() {
        char buffer[200]; int len = 0;
        len = snprintf(buffer, 200, "Power on. Firmware version: %s\n", FirmwareVersion.c_str());
        pc.write(buffer, len);
//   while (true) {
//     controller.Run();
//   }

If i enable back one of the classes that are commented out the firmware does not work anymore.
MbedOS also does not throw an error. Does somebody know this problem?

1 Like

Same thing here! The strange thing is when I disable some classes the code does run. Furthermore it shows no error or what so ever.

1 Like

Hello @Niels_Evers,

Which compiler do you use?

I am asking as i have a project with MAX32630FTHR and MAX30003 so something similar to yours and after updating Mbed Studio V1.4 to 1.4.1 (wich also updates ARMC 6.14 to ARMC 6.15) i also lost most of my outputs that worked before. Seems like ARMC 6.15 compiler breaks something behind the scenes.

Try using GCC_ARM compiler, that solved my issues, though i am not sure if you are facing the same problem.

1 Like

Thanks for your help. This indeed fixed the problem! Weird that its happening but now everything works! :grin: For people who are facing the same problem this is the link for how to use ARM_GCC instead of ARMC6. Switching to GCC - Installing | Mbed Studio Documentation