Updated Configuration Variables (CV) List (markdown)
1 parent
6a820f6f84
commit
1c50bcc985
1 file changed
+20
@@ -150,6 +150,26 @@ Every slice controls two independent output channels, duty cycle from 0% to 100%
|
||||
* Clock Divider: Additional clock divider
|
||||
* Level Channel A / Level Channel B - (16Bit each): Determining how many of the x cycles the signal is at a high level - effectively determining the duty cycle
|
||||
|
||||
To see which CVs correspond to which slice and channel, it is advisable to use CV.h as a reference
|
||||
|
||||
The PWM-frequency is calculated as follows: f<sub>PWM</sub> = 125 MHz / [ (CV<sub>clk_div</sub> + 1) * (CV<sub>wrap</sub> + 1) ]
|
||||
|
||||
The duty-cycle can be calculated as follows: D = CV<sub>Level</sub> / CV<sub>wrap</sub> + 1
|
||||
|
||||
**Example configuration - (AUX2: PWM-Frequency f<sub>PWM</sub> = 10kHz; Duty-cycle D = 20%):**
|
||||
|
||||
AUX1 => GPIO25 => Slice 4 / Channel B => Wrap: CV_144 & CV_145; Clock-divider: CV_146; Level(B): CV_149 & CV_150
|
||||
|
||||
=> f<sub>PWM</sub> = 10kHz = 125 MHz / [ (0 + 1) * (12499 + 1) ];
|
||||
|
||||
=> CV_144 = 110000, CV_145 = 11010011, CV_146 = 0; --- (Note: "12499<sub>dec</sub>" = "11000011010011<sub>bin</sub>")
|
||||
|
||||
=> CV<sub>Level</sub> = CV_149 & CV_150 = D * (CV<sub>wrap</sub> + 1) = 0.2 * 12500 = 2500
|
||||
|
||||
=> CV_149 = 1001, CV_150 = 11000100; --- (Note: "2500<sub>dec</sub>" = "100111000100<sub>bin</sub>")
|
||||
|
||||
Another configuration which also achieves 10kHz and D = 20% would be CV<sub>clk_div</sub> = 10, CV<sub>wrap</sub> = 1249, CV<sub>Level</sub> = 250.
|
||||
|
||||
|
||||
A more detailed explanation can be found in the [RP2040-Datasheet](https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf) in Chapter 4.5.
|
||||
|
||||
|
||||
Reference in new issue
Block a user