Portenta Machine Control BLE Communication Slowdown: masterStatesCharacteristic.writeValue Causing Performance Degradation

I'm working on a project using two Arduino Portenta Machine Controls (PMC) communicating via BLE. The setup aims to:

  • Mirror digital inputs from each PMC to the digital outputs of the other
  • Mirror analog input from the peripheral to analog output on the central device

Issue:
After approximately one hour of operation, the central PMC experiences significant performance degradation, sometimes leading to complete system crashes. Through testing, I've identified that the performance issues appear to be related to repeated calls to masterStatesCharacteristic.writeValue(DI.currentDIstate) in the central device.

Specific Symptoms:

  1. Central PMC gradually slows down over time
  2. Performance improves when commenting out the BLE write operation
  3. Peripheral PMC maintains normal performance
  4. System occasionally crashes after extended operation

Relevant Code Section (Central PMC):

if (currentMillis - previousMillis3 >= DI_BLE_WRITE_DELAY) {
    previousMillis3 = currentMillis;
    if (DI.currentDIstate != DI.lastDIstate) {
        masterStatesCharacteristic.writeValue(DI.currentDIstate); // Problematic line, removing it greatly increases performance
        DI.lastDIstate = DI.currentDIstate;
    }
}

Has anyone encountered similar BLE performance degradation issues with the Portenta Machine Control? Any suggestions for optimizing BLE communication or alternative approaches would be greatly appreciated.

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