energia / Energia

Fork of Arduino for the Texas Instruments LaunchPad's
http://energia.nu
Other
795 stars 672 forks source link

Analogwrite not working on MSP432 on P6.5 and P6.4 #1011

Closed fcooper closed 5 years ago

fcooper commented 6 years ago

Describe the expected results.

PWM output on P6.4 and P6.5 when using analogWrite, The MSP432 pinmap indicates that those pins are valid for analogwrite.

Describe the actual results.

No PWM output on pins P6.4 and P6.5. Verified by connecting logic analyzer to pins. When connected to those pins I see no output. When changing to other pins capable of analogwrite I see a square wave. Confirmed that the pins do work but toggling them using digitalWrites.

List the steps to reproduce the problem.

#define LED RED_LED
int left_pwm_pin = 10;  // P6.5

void setup() {                

pinMode(LED, OUTPUT);   
pinMode(left_pwm_pin, OUTPUT);      // sets the digital pin as output
analogWrite(left_pwm_pin, 125);
}

void loop() {
  digitalWrite(LED, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(LED, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);               // wait for a second
}
robertinant commented 5 years ago

The pinmap is incorrect. P6.4/P6.5 are not PWM capable. Fixed with https://github.com/energia/energia.nu/commit/2b461aa5a99a750f8d3b102adbf2551ee2dd02f5

rei-vilo commented 5 years ago

Updated pins map

msp432p401r