I am trying to setup a constant PWM on the PWM_1 channel on our Toradex Verdin AM62 D 1GB ET following the PWM (Linux) Pwmchip interface setup.
My problem is now that we can only setup a min Frequency of 2,5Hz (max 469000000ns period). We would need a 1Hz PWM with a duty cycle of 97%.
Is this a hardware restriction or can we work around this in software? / Use different Base Clock in device tree? / Use bigger counter register?
What could be a workaround?
I already tried using a GPIO pin which is toggled in software but this is too inaccurate for our purposes.
Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!
Did you like my answer?
The limitation you’re encountering with the minimum PWM frequency of 2.5Hz on the Toradex Verdin AM62 D 1GB ET is indeed a hardware restriction. This is due to the PWM controller’s design, which has a maximum period of 469000000ns, making it impossible to achieve a 1Hz PWM signal without modifications.
Here are some potential workarounds you could consider:
Adjusting the Base Clock: You could try modifying the Base Clock settings in the device tree. This might allow for different clock configurations that could enable lower PWM frequencies. However, be cautious as this could affect the overall system clock configuration and other components.
Using a Larger Counter Register: If the hardware supports it, increasing the counter size might allow for finer control over the PWM period, potentially enabling a 1Hz output. This would depend on the specific capabilities of the PWM hardware in your device.
External PWM Generators: If the above options do not work, consider using an external PWM generator or a dedicated timer. These can provide the required frequency and duty cycle with higher accuracy than software toggling of GPIO pins.
Since software toggling of a GPIO pin has proven too inaccurate for your needs, focusing on hardware-based solutions or configurations is advisable. Consulting the hardware documentation for the Verdin AM62 may provide additional insights into possible configurations or workarounds.
Please, also check if these links can help you solve your problem:
I’ve searched on our datasheet and AM62 Reference Manual, but I didn’t find anything about the minimum frequency of PWM.
In this case, you could use Cortex M4 or PRU to achieve what you expect. Have you ever considered using the other cores? I saw that TI has an example of PWM for Cortex M4. You can find it on TI’s MCU+SDK for AM62x.
Feel free to ask if you have any doubts or issues.