474 questions
0
votes
0
answers
50
views
SAM3X8E / Arduino Due: Timer/Counter not generating PWM on TIOB0 (PB27) — output stuck HIGH
I'm trying to generate a PWM signal on PB27 / Arduino Due pin 13, which corresponds to TIOB0 on the SAM3X8E (used on the Arduino Due).
However, the output pin just goes HIGH and stays there — no PWM ...
1
vote
1
answer
240
views
How to Avoid Potential PWM Signal Instability from Rapid CCR Updates in While Loop on STM32"
I am working on an STM32 microcontroller (running at 168 MHz) to generate PWM signals on Timer channels (Ch1 and Ch2) with a frequency of 500 Hz. The PWM is used to control a motor's applied voltage, ...
1
vote
1
answer
190
views
How to use LL drivers on an STM32 to generate PWM deadtime
I am trying to generate 3 channel center aligned PWM with complementary outputs and deadtime insertion on an STM32G474. To test functionality of the timers, I currently have the 6 outputs connected to ...
0
votes
0
answers
52
views
Diagnose issue with PWM on nrf53 using Zephyr: seems to be ready but not erroring or working
I am looking for ways to diagnose a problem with a vibration motor NFP-3C-03208B using Zephyr on a custom nrf5340 boardh. I have working on a nordic dk but is not working on a custom board. The device ...
1
vote
0
answers
56
views
Very Specific Combination of Servo.write and analogWrite messes up frequencies on esp32 PWM pins
Preface: First time asking a question, please take it easy with the "YOU SHOULD FORMAT YOUR QUESTIONS THIS WAY!"
Question: Why does this happen?
I'm programming an esp32 S3 dev module using ...
2
votes
2
answers
442
views
STM32G4 TIM1 center aligned PWM update event problem
I'm facing an issue with the update event triggering in STM32G4 TIM1. I've configured TIM1 to generate PWM signals and set the update event to Center-Aligned Mode 1. However, I've noticed that the ...
1
vote
0
answers
56
views
Measure PWM Duty Cycle with Pic
I am trying to measure two PWM input signals and, based on them, turn a LED on or off. I am using a PIC16F18313 microcontroller.
I have a Futaba remote control, and through its receiver, I receive two ...
0
votes
0
answers
99
views
Add a PWM pin on BeagleBone Black
I need to add two new PWM pins to my DTS file on a BeagleBone Black. How can I do that?
It has the P9_42 as the PWM pin, but I'm having some difficulty in adding another PWM pin. I'll use in mg90 for ...
0
votes
0
answers
130
views
LEDC PWM in RISC-V assembly on ESP32-C3 using ESP-IDF
I've started a personal project. The idea is to output PWM on pin 8 (GPIO8) of a ESP32-C3 using LEDC peripheral on an ESP32-C3 using assembly language (RISC-V) with ESP-IDF. I've started by ...
0
votes
0
answers
32
views
STM32H7 trigger at falling edge of PWM signal
I'd like to trigger a GPIO when detecting a falling edge on my PWM.
I want to do all of this within the same timer.
For example:
Timer 1: PWM Generation
Timer 2: input capture indirect mode or ...
1
vote
0
answers
55
views
Can STM32 PWM settings affect other timer settings?
#include "Main.h"
#define MAX_Intensity 1600
static volatile uint16_t Intensity = 10;
void Timer4_Configuration(void)
{
TIM_TimeBaseInitTypeDef TIM_BaseStructure;
...
0
votes
1
answer
87
views
PWM configured via DMA does not work properly at high speeds
I have set RCC on STM32F767ZI to 48 MHz (when setting to a higher frequency an error occurs, although in CubeMX with the same settings there is no error).
rcc.cr.modify(|_, w| w.hsebyp().set_bit())...
0
votes
1
answer
95
views
How to control duty cycle via DMA on Rust?
I wrote my code based on this topic, but it is not work. I'm using the stm32f7xx_hal crate, but I think the logic of my program is similar to the code from the example. My problem is that the duty ...
0
votes
1
answer
277
views
Rust Embassy SimplePwm waveform functions don't work as intended
Duty-cycle behaves strangely at high frequencies.
While at 20 KHz the error is barely noticeable
PWM of 20 KHz
At 6 MHz it becomes obvious
PWM of 6 MHz
I use the STM32F11ce6 microcontroller.
Clock ...
2
votes
2
answers
413
views
STM32: PWM output for dimming a led
I'm new here and I have some questions about generating a PWM signal for dimming an led using STM32 boards.
I'm trying to generate the PWM only by writing the nessasarry bits with bit manipulation. ...
1
vote
1
answer
182
views
ATmega328 Timer1 Fast PWM Mode 15 Not properly set up
I am having issues with properly setting up the fast PWM mode 15 in my Arduino Uno (ATmega328).
Most of the registers seem pretty straight-forward, but I am not sure about a few of them.. For example, ...
1
vote
1
answer
392
views
Pi Pico PWM function and toggle() pin function
I am trying to write a program for the pi pico using Micropython to send pwm signals to a mosfet module to turn it on and off to send pulsed current through a DC electromagnet. The MOSFET switches ...
0
votes
1
answer
247
views
Looking for library supporting hardware PWM on RPi3 (not using sysfs)
I wrote years ago a short c program for a Raspberry Pi (RPi3) using the pigpio library to send an infrared signal to a heating system. Still in use. The carrier frequency is 450 kHz, i.e., pretty fast ...
0
votes
2
answers
83
views
I can't program STM32F100RBTx to send pwm signals
I am trying to send PWM signals using STM32F100RBTx but it is not working. I double checked all the addresses but it is still the same. I wasn't sure if I was flashing at the beginning but I ...
0
votes
1
answer
163
views
ESP32 pulsed PWM at low frequencies
The problem is that I'm expecting a low frequency (1.25khz) continuous square wave when writing to the PWM output of the ESP32 and what I get is regular/irregular pulsed PWM triangle wave with a 125hz ...
0
votes
0
answers
157
views
How to change the duty cycle of a square wave without introducing any change in the pulse generaror in MATLAB simulink?
I have four square waves S1, S2, S3 and S4. All have 50% duty cycle. When S1 is on S2 is off
(vice versa) and when S4 is on S3 is off (vice versa). I want to change the duty cycle of S1 and S3 to more ...
0
votes
1
answer
563
views
Orchestration of DMA transfer to PWM peripheral on STM32
I have a STM32F411 board and want to output a PWM signal using timers/PWM/DMA: once every 2 ms a, 16 pulses are sent, each representing one bit. Each pulse has a period of ~3 microseconds with varying ...
0
votes
1
answer
696
views
Configuring timer channel as output
I use NUCLEO-F042K6 board to generate a PWM signal. I use Timer2 for that purpose. Timer2 has 4 channels, but according to STM32F042x4 Datasheet CH1 cannot be redirected to physical pin.
[
I still ...
0
votes
0
answers
58
views
Servo motor doesn't respond
I'm trying to "steer" my servo by using pwm. To make my code better, I refactor the FILE type out of the function so that the file is not being opened and closed with every call I make. But ...
1
vote
1
answer
272
views
How to generate two signals with variable frequency and constant phase difference?
I have an STM32F411 Black Pill board, and I am trying to simulate a rotary encoder with this.
I want to generate two PWM signals, which are always 90 degrees out of phase, but have variable frequency. ...
1
vote
3
answers
1k
views
What is the difference between SET_AUTORELOAD And SET_COUNTER
What is the difference between these two functions.
__HAL_TIM_SET_AUTORELOAD(&htim3,45);
__HAL_TIM_SET_COUNTER(&htim3,45);
For example, if ı want to chance the Counter Period on the fly. ...
0
votes
1
answer
347
views
STM32 fails to generate PWM using some timers
I have an arduino Giga (STM32H7), and I'm trying to generate PWM's. I succeeded using alternate function AF9 of PA7 (digital pin 5), which uses TIM14_CH1. Now, using the exact same code (as far as I ...
2
votes
0
answers
234
views
What is the best way to convert ticks to degrees for PWM phase shift (STM32)?
Goal: implementing a phase shift between PWM TIM1 and TIM8 (STM32F303CBT6).
How will I do this:
I will configure TIM1/TIM8 as MASTER/SLAVE and change the phase shift between them.
TIM_SetCounter(TIM1, ...
0
votes
3
answers
3k
views
STM32 PWM Generation
I need to generate PWM in periods of 20ms and at a frequency of 50Hz.
The pulse width (duty cycle) of the generated PWM should be between 1.5 and 2ms
I'm using STM32f103c8t6 mcu and my APB2 peripheral ...
0
votes
1
answer
229
views
Arduino breaking both IR input and PWM output when used together
I made wrote this fairly simple code which sets output on LED pin to some analog number
#include <Arduino.h>
#include <IRremote.hpp>
#define IR_RECEIVE_PIN 7
#define LED_PIN 11
uint16_t ...
0
votes
1
answer
354
views
STM32 change PWM Duty Cycle dynamically in RTOS
I'm using this code below trying to achieve a intensity transition effect upon turning on a light:
void output2ControlTask(void *argument)
{
/* USER CODE BEGIN output2ControlTask */
uint32_t ...
0
votes
1
answer
445
views
STM32 PWM first pulse width varies
I'm using Marlin on a BTT SKR MINI E3 V3.0 board (ARM Cortex M0+ STM32), and I'm trying to use a PWM signal to time a delay used to acquire images.
I do the timing by counting a number of pulses in a ...
-2
votes
1
answer
522
views
Change Arduino Mega pin 2 and pin 3 PWM frequency
I am new to Arduino Mega. I am using it to build a switch mode regulator. I need to change Arduino Mega pin 2 and pin 3 PWM frequency to 10kHz or more than that. Appreciate if you can explain in ...
0
votes
1
answer
184
views
Achieving a 6-second period for a PWM Wave using nRF52 Series PWM Driver in C
I am working on a project using an nRF52 Series MCU, where I am aiming to produce a sinusoidal PWM wave with a total period of approximately 6 seconds using the nRF52 SDK v.15.3.0.
I have initialized ...
0
votes
1
answer
121
views
LED PWM with Tact switch
While the button is pressed, led is fade on gradually.
Using pwm
when the Brightness value is more than 255, the value is reset to 0
while the button is not pressed, the Brightness keeps brightest ...
-1
votes
1
answer
215
views
Control fan speed with PCA9685 and a PIC [closed]
I would like to control the speed of various motors using a PIC and PCA9685.
This following code allow me to start the rotation, but it does not reduce the speed
void pca9685_Set_rate(int address, int ...
1
vote
2
answers
2k
views
Set PWM frequency on Arduino Mega using Timer2 in "phase & frequency correct" (mode 5)
Using my Arduino Mega 2560 I am trying to generate a PWM signal where I can change both PWM frequency and Duty Cycle. For that I decided to use Timer2 OC2A output. The code is the following one:
void ...
0
votes
1
answer
427
views
GD32F303RBT6 - TIMER_0 - PWM Settings
Good morning, everyone,
I am a firmware developer and am currently using the GD32F303R8T6 microcontroller to control a brushless motor.
To control such a motor, I plan to use the timer peripheral ...
1
vote
0
answers
453
views
Trouble activating PWM on PA6 of Orange Pi One using DTSO and WiringOP
I'm attempting to activate PWM on pin PA6 of an Orange Pi One board. I've tried using a Device Tree Blob Overlay (DTBO) and accessing the sysfs interface, as well as using the WiringOP library, but I'...
0
votes
1
answer
2k
views
STM32 2 PWM Generation with phase difference using TIM1 and TIM2. TIM2 PWM does not turn on properly when i stop it and restart
I can generate 2 pwm signals with phase difference between them, but when I stop and restart, TIM2 PWM turn on with %100 Duty Cycle.
I use Internal Triggering System to generate delay between to PWM.
...
0
votes
1
answer
64
views
Can't update Output Compare Register (OCRnA) via USART (ATmega88)
I managed to create a perfect square wave by using the 8-bit timer2 in ATmega88 running at 16 MHz. I also managed the change the OCR2A in the code and change the frequency of the signal as expected. I ...
1
vote
0
answers
101
views
Timer 3 PWM generation works but doesn't rotate the servo
I have been building a 6 degree of freedom industrial robot using stm32f091rc taking advantage of multiple timers to generate pwm pulses to rotate the robots' joint angles and to do forward and ...
1
vote
2
answers
297
views
Minimize CPU usage for software PWM in the Raspberry PI
I want to generate some 4 software PWM signals on GPIO pins (5, 6, 19, and 26) on the Raspberry Pi 4B using the pigpio library (which is in C). I want to generate a PWM frequency of 8 kHz. I was able ...
0
votes
1
answer
467
views
STM32 Timer registers (PWM Measurement) Not working
I'm trying to measure the pulse width of a signal on the STM32G431RB, and I keep getting random values from the counter registers. I've checked the signal and it's fine (PWM Signal from a receiver).
...
0
votes
1
answer
1k
views
zephyr pin control on device tree
I'm trying to create an overlay with for a pwm output for a pin in zephyr rtos , the overlay has pinctrl-1 and a pinctrl-name for pin configuration ,however a .dts file was already define with ...
-1
votes
1
answer
1k
views
stm32 with pin PWM capable : datasheet?
I want to build a project with an STM32G070.
I need a couple of PWM pins.
I look at the datasheet and user manual, and I cannot find anywhere if all pins of if only some are PWM capable and so, which ...
0
votes
1
answer
207
views
Sound synthesis with PWM output
I'm trying to synthesize sound on the Arduboy, which is a handheld gaming device with an AVR ATMega32u4 microcontroller and a speaker attached between its pins C6 and C7.
My plan is to use timer 4 to ...
-1
votes
2
answers
731
views
play audio with pwm of a attiny85
I'm trying to understand how to implement audio playback from scratch on attiny85. The goal is to play a short sound (cat meows, so i want it to remain recognizable) from an array representing ...
0
votes
0
answers
2k
views
How to set and change duty cycles for PWM code
I am trying to blink the yellow and green LEDs on my CC32xx board. To do that I need to edit some code that was presented to me. I need to set duty for PWM1 to 90%, set duty for PWM2 to 10%, set the ...
2
votes
1
answer
176
views
PI negative controller output to unsigned duty cycle
I am trying to implement a PI controller in C that outputs / controls a PWM's duty cycle on a microcontroller. The duty cycle that I can write to the certain PWM control register is limited to 10bit (...