Duet3D / RepRapFirmware

OO C++ RepRap Firmware
GNU General Public License v3.0
932 stars 533 forks source link

[Bug]: Low Frequency on PWM pins with version 3.5.0 #977

Closed Pourya-3deo closed 4 months ago

Pourya-3deo commented 4 months ago

Duet Forum Discussion Thread

I tried I couldn't register

Which Duet products are you using?

Firmware Version

RRF 3.5.0

Duet Web Control Version

DWC 3.4.6

Are you using a Single Board Computer (RaspberryPi) with your Duet?

Please upload the results of sending M122 in the gcode console.

M122 Report
FIRMWARE_NAME: RepRapFirmware for Duet 3 MB6HC FIRMWARE_VERSION: 3.5.0 ELECTRONICS: Duet 3 MB6HC v1.02 or later FIRMWARE_DATE: 2024-04-16 09:43:06

Please upload the content of your config.g file.

Config.g

M950 P10 C"io4.out" Q10

Please upload the content of any other releveant macro files.

M42 P10 S0.2

Details specific to your printer.

Our own 3d printer

Links to additional info.

No response

What happened?

Expected result Frequency should be 10 HZ

Observed result Frequency was 17.88 HZ

Steps to reproduce

dc42 commented 4 months ago

This is a known limitation, present because the timer/counter channels on the SAME70 processor are only 16 bits wide and the range of input clocks available is limited. The timer channels currently use a 150MHz clock divided by 128, so the minimum available PWM frequency is 150MHz/(128*65535) = 17.88Hz. We may be able to reduce the minimum frequency to 11.44Hz by switching to a different clock.

The PWM-capable outputs on the 6HC that are drive by timer/counter channels on the 6HC are: OUT4 OUT5 OUT8 OUT7 IO4.OUT IO5.OUT IO7.OUT

The PWM-capable outputs on the 6HC that are driven by the PWM peripheral and have a lower minimum frequency are: OUT0 OUT1 OUT2 OUT3 OUT6 OUT9

Pourya-3deo commented 4 months ago

Thank you for your email, I was worried about that and hoped for a solution, is there any software based PWM with a macro maybe?

On Fri, Apr 19, 2024 at 2:04 AM dc42 @.***> wrote:

This is a known limitation, present because the timer/counter channels on the SAME70 processor are only 16 bits wide and the range of input clocks available is limited. The timer channels currently use a 150MHz clock divided by 128, so the minimum available PWM frequency is 150MHz/(128*65535) = 17.88Hz. We may be able to reduce the minimum frequency to 11.44Hz by switching to a different clock.

The PWM-capable outputs on the 6HC that are drive by timer/counter channels on the 6HC are: OUT4 OUT5 OUT8 OUT7 IO4.OUT IO5.OUT IO7.OUT

The PWM-capable outputs on the 6HC that are driven by the PWM peripheral and have a lower minimum frequency are: OUT0 OUT1 OUT2 OUT3 OUT6 OUT9

— Reply to this email directly, view it on GitHub https://github.com/Duet3D/RepRapFirmware/issues/977#issuecomment-2066146176, or unsubscribe https://github.com/notifications/unsubscribe-auth/BEEQV2BBNDNHRZZNFRNV6WTY6DMYDAVCNFSM6AAAAABGNZOHBWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRWGE2DMMJXGY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

dc42 commented 4 months ago

If you need a lower PWM frequency than 18.8Hz then use one of the outputs that is controlled by the PWM peripheral, which I listed in my reply above.

Pourya-3deo commented 4 months ago

So I tried OUT0 and OUT9 but I don't get any accurate square shaped signal. Here is the code: Config: M950 P10 C"out9" Q10 Macro: M42 P10 S0.5