Hello,
I have an issue with my teensy 4.1. Every time i change the pwm from 0 to over 1023 the teensy 4.1 reset it self, when i choose a pwm resolution over 10 bits. However when i use 10 bits or 8 bits it works proberly.
Is Teensy 4.1 capable of pwm resolution of over 10 bits?
PJRC website states it is capable of over 10 bits pwm up to 15 bits.
How can i use the function analogWriteResolution() properly?
will analogWriteResolution() set the pwm resolution for all pwm pins or only the pwm pins that are in use or what does it even do?
the setup is as follows:
Teensy 4.1 is connected to my pc via micro usb cable and it drives 3 smd mosfet gates via pwm, bss mosfet with max Drain current of 200 mA. The mosfets are all in open loop (D and S are not connected to anything at all).
the following code is what i use to change the pwm resolution as well as the pwm duty cycle:
#include <Arduino.h>
#includes .........
void setup()
{
pinMode(pin1, OUTPUT);
pinMode(pin2, OUTPUT);
pinMode(pin3, OUTPUT);
analogWriteFrequency(pin1, 4577);
analogWriteFrequency(pin2, 4577);
analogWriteFrequency(pin3, 4577);
analogWriteResolution(15);
}
void loop()
{
for (size_t i1=0; i<32768; i++){
analogWrite(pin1, i1);
}
for (size_t i2=0; i<32768; i++){
analogWrite(pin2, i2);
}
for (size_t i3=0; i<32768; i++){
analogWrite(pin3, i3);
}
}
After the first for loop reaches i1 = 1023 the teensy 4.1 reset why?
I tried to connect the vin pin to 5V with 2A current just in case, but i get the same result -> teensy reset.
Can anyone please help me?
It is very urgent
Kind regards
Hussain
I have an issue with my teensy 4.1. Every time i change the pwm from 0 to over 1023 the teensy 4.1 reset it self, when i choose a pwm resolution over 10 bits. However when i use 10 bits or 8 bits it works proberly.
Is Teensy 4.1 capable of pwm resolution of over 10 bits?
PJRC website states it is capable of over 10 bits pwm up to 15 bits.
How can i use the function analogWriteResolution() properly?
will analogWriteResolution() set the pwm resolution for all pwm pins or only the pwm pins that are in use or what does it even do?
the setup is as follows:
Teensy 4.1 is connected to my pc via micro usb cable and it drives 3 smd mosfet gates via pwm, bss mosfet with max Drain current of 200 mA. The mosfets are all in open loop (D and S are not connected to anything at all).
the following code is what i use to change the pwm resolution as well as the pwm duty cycle:
#include <Arduino.h>
#includes .........
void setup()
{
pinMode(pin1, OUTPUT);
pinMode(pin2, OUTPUT);
pinMode(pin3, OUTPUT);
analogWriteFrequency(pin1, 4577);
analogWriteFrequency(pin2, 4577);
analogWriteFrequency(pin3, 4577);
analogWriteResolution(15);
}
void loop()
{
for (size_t i1=0; i<32768; i++){
analogWrite(pin1, i1);
}
for (size_t i2=0; i<32768; i++){
analogWrite(pin2, i2);
}
for (size_t i3=0; i<32768; i++){
analogWrite(pin3, i3);
}
}
After the first for loop reaches i1 = 1023 the teensy 4.1 reset why?
I tried to connect the vin pin to 5V with 2A current just in case, but i get the same result -> teensy reset.
Can anyone please help me?
It is very urgent
Kind regards
Hussain