PWM generation
-
Hello guys, I have a question: is it possible to set a PWM signal, for example, with a duration of 10 ms and pauses of 34 ms, to some output from the board?
Board: fly_F407ZG (stm32f4-wifi)
Firmware: RepRapFirmware for STM32F4 based Boards 3.4.6_101 (2023-08-01)
Duet WiFi Server Version: 1.25-01S-D
Duet Web Control 3.4.6 -
@Doshs Do you mean an on period of 10ms and an off period of 34ms, so a total cycle time of 43ms? If so you should be able to set a PWM frequency of 23.26Hz using the Q parameter to the M950 command you use to define the output. Then setting an on period of 10/43 = 0.232 using the M42 command should give you the desired on/off periods.
That's an unusual PWM frequency, what is it you are trying to control?
-
@gloomyandy , I got such a PWM from the PA_0 pin, only it looks a little different from what I imagined
-
@Doshs PA_0 is a temperature sensor input so will have various signal conditioning components attached to it:
<img src="blob:chrome-untrusted://media-app/0c87b31b-f39f-4eb5-8b75-ee41a4c2e674" alt="Screenshot 2023-10-05 09.35.24.png"/>These will be "smoothing" the output of the normal PWM square wave, you need to use a pin that does not have any addional components attached. On that board I'd suggest using the servo output, or one of the pins on the exp1/exp2 headers.
-
@gloomyandy Thank you very much!
Now it is clear why the signals were so strange -
It's sad that there are so few pin for PWM on the FLY board
-
-