Closed
Description
Board
ESP32Dev module
Device Description
I'm using a PWM output, and setup a pin interrupt so i can detect the start of the PWM signal.
This works fine in 2.0.1, but not on 2.0.2
Hardware Configuration
no
Version
latest master
IDE Name
PlatfromIO
Operating System
Win10/Linux
Flash frequency
80Mhz
PSRAM enabled
no
Upload speed
115200
Description
attachInterrupt
should be able to attach to the output signal of the PWM signal generated by ledC.
this does work in 2.0.1, but not in 2.0.2.
I noticed that there were changes made to the LEDC code (#6045)
when using the old (2.0.1) code for ledcAttachPin
in my code, it works again.
So something in the new code, does not allow a PIN interrupt to be attached to the PWM output.
Below is test code to reproduce the problem.
Sketch
#include <Arduino.h>
#define PIN_PWM_OUT 19
#define PWM_CHANNEL 0
volatile uint32_t isrCounter = 0;
// PWM pin low to high transition ISR
void IRAM_ATTR onPulse() {
// increment counter
isrCounter++;
}
void setup() {
pinMode(PIN_PWM_OUT, OUTPUT);
// Setup PWM on channel 0, 1000Hz, 10 bits resolution
ledcSetup(PWM_CHANNEL, 1000, 10); // channel 0 => Group: 0, Channel: 0, Timer: 0
ledcAttachPin(PIN_PWM_OUT, PWM_CHANNEL); // attach the channels to the GPIO to be controlled
ledcWrite(PWM_CHANNEL, 512); // channel 0, duty cycle 50%
// Setup PIN interrupt on rising edge
attachInterrupt(PIN_PWM_OUT, onPulse, RISING);
Serial.begin(115200);
while (!Serial);
}
void loop() {
Serial.printf("ISR Counter: %u\n",isrCounter);
delay(1000);
}
Debug Message
The Counter in above test code will not increase.
Other Steps to Reproduce
No response
I have checked existing issues, online documentation and the Troubleshooting Guide
- I confirm I have checked existing issues, online documentation and Troubleshooting guide.
Metadata
Metadata
Assignees
Labels
No labels