Hi all,
I am running a PWM at 50/255 with default settings on a Teensy 4.1, using the simple Arduino code below:
However, I noticed that with a single capture on the oscilloscope, that the first pulse varies quite drastically, usually it is as wide as shown in the image below, but sometimes, it can be narrower than the PWM pulses that comes afterwards. I can only see this happening on the very first pulse and none later. Does anyone know what could be causing this and how I would go about fixing this?
The oscilloscope probe is connected to the Teensy by 2x 20cm jumper leads going to pin 0 and the ground pin right next to pin 0. The Teensy is being powered via USB, CPU speed is 600MHz.
Thanks!
I am running a PWM at 50/255 with default settings on a Teensy 4.1, using the simple Arduino code below:
Code:
int PWM_Pin = 0;
void setup() {
// put your setup code here, to run once:
pinMode(PWM_Pin, OUTPUT);
delay(1000);
}
void loop() {
// put your main code here, to run repeatedly:
analogWrite(PWM_Pin, 50);
}
However, I noticed that with a single capture on the oscilloscope, that the first pulse varies quite drastically, usually it is as wide as shown in the image below, but sometimes, it can be narrower than the PWM pulses that comes afterwards. I can only see this happening on the very first pulse and none later. Does anyone know what could be causing this and how I would go about fixing this?
The oscilloscope probe is connected to the Teensy by 2x 20cm jumper leads going to pin 0 and the ground pin right next to pin 0. The Teensy is being powered via USB, CPU speed is 600MHz.
Thanks!