Skip to content

Mbed OS crashes when PWM on certain digital pins in certain order #93

@vtpgit

Description

@vtpgit

Arduino Nano 33 BLE mbed os crashes when PWM on more than 2 digital pins once we use 4 other.

We are using ARDUINO NANO 33 BLE, Model NINA-8306

Below I distilled a piece that crashes the mbed os.

We are using IDE 1.8.13 with Mbed OS 1.3.0 (whatever the board manager latest downloaded) with a manually edited wiring analog cpp adding the object destruction. My Nano 33 BLE is also stock. I got a second confirmation from a very nice person over at the arduino forum that they can reproduce the problem.

void setup() {
  // D2
  pinMode(D2, OUTPUT);
  analogWrite(D2, 255);

  // D4
  pinMode(D4, OUTPUT);
  analogWrite(D4, 255);

  // D6
  pinMode(D6, OUTPUT);
  analogWrite(D6, 255);

  // D8
  pinMode(D8, OUTPUT);
  analogWrite(D8, 255);

  // Destroy D2, D4, D6, D8
  analogWrite(D2, -1);
  analogWrite(D4, -1);
  analogWrite(D6, -1);
  analogWrite(D8, -1);

  // At that point we have again 4 pins available since the previous 4 were presumably destroyed.
  // D3
  pinMode(D3, OUTPUT);
  analogWrite(D3, 255);

  // D5 or any other pwm not part of the above pin set
  pinMode(D5, OUTPUT);  
  // This next line will crash mbed
  analogWrite(D5, 255);

}

void loop() {}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions