Questions tagged [pwm]

PWM (Pulse-width modulation) is a technique for controlling power to electrical devices, made practical by modern electronic power switches.

468 questions
1
vote
1 answer

PWM for LED dimming unusual behavior

I made a function, where PWM signal is generated at the output (PORTD) without usage of PWM control registers inside PIC microcontroller (PIC18F452). In order to slowly dim LED connected at the output, I was trying to increase the time needed for…
Keno
  • 126
  • 8
1
vote
1 answer

How to test a RGBLED without Raspberry Pi connection?

I was working with gpiozero and wanted to use the MockFactory to debug on a local device without Raspberry Pi (4) connection. The last time I used the Mockfactory was with an gpiozero.LED object. But this time I used a gpiozero.RGBLED output device.…
1
vote
1 answer

Microchip dsPIC33 Start all PWMs at same time

Using dsPIC33CK256MP508 on the Curiosity board. Trying to run 4 PWM generators in high resolution mode. I will run them in single cycle mode. Trying to figure out how to kick off all 4 signals at the exact same time, or trigger them from the same…
kjav
  • 93
  • 1
  • 7
1
vote
3 answers

PWM "Pulses" w/ MSP430

I am trying to develop a delay generator that can generate 50 "pulses" within a short amount of time and then hold for a much longer time, then repeat. I am familiar with using the MSP 430 as a constant PWM source, but I am not sure what the best…
CLand
  • 11
  • 2
1
vote
1 answer

STM32F4 PWM Buzzer Stops Playing Halfway Through Song

I am trying to write code to play simple songs using a STM32F407G discovery board and the STM32CUBEIDE. I created an array to store the note frequency values and also one for their duration(not 100% accurate yet,just wanted to test a concept). I…
1
vote
1 answer

STM32 Difference between Max interface clock and max timer clock

I am using TIM1 on a H743ZI with 3 PWM channels. I am trying to maximize the PWM resolution so I need to maximize the clock speed on TIM1. the datasheet (screenshot below) gives 120MHz and 240MHz values for Max interface clock and Max timer…
zytra
  • 87
  • 1
  • 11
1
vote
1 answer

How to make DMA work for changing the duty cycle of a PWM port using Rust?

I'm trying to change my PWM duty cycle every period from a stored buffer using a DMA. It's something very close to this topic but the code is now a little bit outdated. I'm also using the stm32l4xx_hal implementation for my project. What I have for…
1
vote
0 answers

RPI Zero - Bare metal - PWM

I try to produce a PWM on a RPI zero pin.. it's a bare metal c code I try to have a pulse on pin 13, I tried many different codes, none of them work while I can use GPIO's, SPI and UART without problem so the bootloader works I also tried to put the…
Phil123456
  • 83
  • 1
  • 10
1
vote
2 answers

PWM using bcm2835 library as non-root in Raspberry Pi

I need to control some DC motors using PWM. I have been trying to use the bcm2835 library, but I need root access to run my program. I need to avoid this, as this program is part of a ROS package, which gives problems if run as root. I have tried to…
lortane
  • 11
  • 1
1
vote
0 answers

Calculate Continuous servo PWM Frequency and duty cycle

im using a Raspberry pi 2 2 x DS3115-360 servos Im trying to get the frequency and duty cycle working correctly but I cant find the data sheet on this servo. I tried the typical 50hz 7.5 dc but it does not seem to be working for me. I tried…
1
vote
1 answer

How do I get this simple PWM example to work?

I am just starting to work with the MSP430 microcontrollers after previously only working with STM32, and as I am still a beginner with all of this, the change is quite a lot, but I am struggling to get a simple PWM output working. At the office,…
MCG
  • 155
  • 1
  • 9
1
vote
2 answers

Generate a fixed number of pulses on the STM32F4 PWM

I am trying to control a servo motor (link). It is a brushless DC motor with an interface similar to a stepper motor. The motor rotates for a defined distance based on the number of pulses it receives from the PWM. The speed is determined by the…
Eduardo Cardoso
  • 165
  • 2
  • 9
1
vote
2 answers

SAMD21: how to set PWM using TCC?

I'm programming a SAMD21 and I need PWM. When I chose pin with F function TCC0 output: PA22 - TCC0/WO[4] PA23 - TCC0/WO[5] I successfully configured TCC0 base counter: // enable clock for TCC0 - disable clock masking PM->APBCMASK.reg |=…
EFK
  • 23
  • 5
1
vote
1 answer

How can I change LED's brightness with PWM and USART in USART1_IRQHandler?

I am using STM32F4 discovery board and I am working on changing LED brightness and timer period using ADC and USART. I use DMA to fetch ADC values, selected TIM4 for PWM and selected USART1 for USART. ADC, USART and PWM are working well so far, but…
1
vote
1 answer

ATMEGA32U4 PWM issue

I am developing a simple program to run a buzzer in AVR on a Teensy 2.0 (ATMEGA32u4) and I am having great difficulty getting the PWM output to work. The PWM output is on PB6 and I can test it digitally so I am not worried about the hardware setup…