{PI_NOT_SERVO_GPIO , "GPIO is not in use for servo pulses"},
{PI_NOT_HCLK_GPIO , "GPIO has no hardware clock"},
{PI_NOT_HPWM_GPIO , "GPIO has no hardware PWM"},
- {PI_BAD_HPWM_FREQ , "hardware PWM frequency not 1-125M"},
+ {PI_BAD_HPWM_FREQ , "invalid hardware PWM frequency"},
{PI_BAD_HPWM_DUTY , "hardware PWM dutycycle not 0-1M"},
- {PI_BAD_HCLK_FREQ , "hardware clock frequency not 4689-250M"},
+ {PI_BAD_HCLK_FREQ , "invalid hardware clock frequency"},
{PI_BAD_HCLK_PASS , "need password to use hardware clock 1"},
{PI_HPWM_ILLEGAL , "illegal, PWM in use for main clock"},
{PI_BAD_DATABITS , "serial data bits not 1-32"},
.EX
gpio: see description
.br
-clkfreq: 0 (off) or 4689-250000000 (250M)
+clkfreq: 0 (off) or 4689-250M (13184-375M for the BCM2711)
.br
.EE
.EX
gpio: see description
.br
-PWMfreq: 0 (off) or 1-125000000 (125M)
+PWMfreq: 0 (off) or 1-125M (1-187.5M for the BCM2711)
.br
PWMduty: 0 (off) to 1000000 (1M)(fully on)
.br
.br
The actual number of steps beween off and fully on is the
-integral part of 250 million divided by PWMfreq.
+integral part of 250M/PWMfreq (375M/PWMfreq for the BCM2711).
.br
.br
-The actual frequency set is 250 million / steps.
+The actual frequency set is 250M/steps (375M/steps for the BCM2711).
.br
.br
-There will only be a million steps for a PWMfreq of 250.
-Lower frequencies will have more steps and higher
+There will only be a million steps for a PWMfreq of 250 (375 for
+the BCM2711). Lower frequencies will have more steps and higher
frequencies will have fewer steps. PWMduty is
automatically scaled to take this into account.
.br
-.IP "\fBclkfreq\fP: 4689-250M" 0
+.IP "\fBclkfreq\fP: 4689-250M (13184-375M for the BCM2711)" 0
.br
.br
PI_HW_CLK_MAX_FREQ 250000000
.br
+PI_HW_CLK_MAX_FREQ_2711 375000000
+.br
.EE
.br
-.IP "\fBPWMfreq\fP: 5-250K" 0
+.IP "\fBPWMfreq\fP: 1-125M (1-187.5M for the BCM2711)" 0
The hardware PWM frequency.
.br
.br
PI_HW_PWM_MAX_FREQ 125000000
.br
+PI_HW_PWM_MAX_FREQ_2711 187500000
+.br
.EE
.br
#define PI_NOT_HPWM_GPIO -95 // GPIO has no hardware PWM
.br
-#define PI_BAD_HPWM_FREQ -96 // hardware PWM frequency not 1-125M
+#define PI_BAD_HPWM_FREQ -96 // invalid hardware PWM frequency
.br
#define PI_BAD_HPWM_DUTY -97 // hardware PWM dutycycle not 0-1M
.br
-#define PI_BAD_HCLK_FREQ -98 // hardware clock frequency not 4689-250M
+#define PI_BAD_HCLK_FREQ -98 // invalid hardware clock frequency
.br
#define PI_BAD_HCLK_PASS -99 // need password to use hardware clock 1
.br
#define CLK_CTL_SRC_PLLD 6
#define CLK_OSC_FREQ 19200000
+#define CLK_OSC_FREQ_2711 54000000
#define CLK_PLLD_FREQ 500000000
#define CLK_PLLD_FREQ_2711 750000000
static volatile uint32_t pi_mem_flag = 0x0C;
static volatile uint32_t pi_ispi = 0;
static volatile uint32_t pi_is_2711 = 0;
+static volatile uint32_t clk_osc_freq = CLK_OSC_FREQ;
static volatile uint32_t clk_plld_freq = CLK_PLLD_FREQ;
+static volatile uint32_t hw_pwm_max_freq = PI_HW_PWM_MAX_FREQ;
+static volatile uint32_t hw_clk_min_freq = PI_HW_CLK_MIN_FREQ;
+static volatile uint32_t hw_clk_max_freq = PI_HW_CLK_MAX_FREQ;
static int libInitialised = 0;
int cctl[] = {CLK_GP0_CTL, CLK_GP1_CTL, CLK_GP2_CTL};
int cdiv[] = {CLK_GP0_DIV, CLK_GP1_DIV, CLK_GP2_DIV};
int csrc[CLK_SRCS] = {CLK_CTL_SRC_OSC, CLK_CTL_SRC_PLLD};
- uint32_t cfreq[CLK_SRCS]={CLK_OSC_FREQ, clk_plld_freq};
+ uint32_t cfreq[CLK_SRCS]={clk_osc_freq, clk_plld_freq};
unsigned clock, mode, mash;
int password = 0;
double f;
if (!clkDef[gpio])
SOFT_ERROR(PI_NOT_HCLK_GPIO, "bad gpio for clock (%d)", gpio);
- if (((frequency < PI_HW_CLK_MIN_FREQ) ||
- (frequency > PI_HW_CLK_MAX_FREQ)) &&
+ if (((frequency < hw_clk_min_freq) ||
+ (frequency > hw_clk_max_freq)) &&
(frequency))
SOFT_ERROR(PI_BAD_HCLK_FREQ,
- "bad hardware clock frequency (%d)", frequency);
+ "bad hardware clock frequency %d-%d: (%d)",
+ hw_clk_min_freq, hw_clk_max_freq, frequency);
clock = (clkDef[gpio] >> 4) & 3;
else
{
SOFT_ERROR(PI_BAD_HCLK_FREQ,
- "bad hardware clock frequency (%d)", frequency);
+ "bad hardware clock frequency %d-%d: (%d)",
+ hw_clk_min_freq, hw_clk_max_freq, frequency);
}
}
else
SOFT_ERROR(PI_BAD_HPWM_DUTY, "bad PWM dutycycle (%d)", dutycycle);
if (((frequency < PI_HW_PWM_MIN_FREQ) ||
- (frequency > PI_HW_PWM_MAX_FREQ)) &&
+ (frequency > hw_pwm_max_freq)) &&
(frequency))
SOFT_ERROR(PI_BAD_HPWM_FREQ,
- "bad hardware PWM frequency (%d)", frequency);
+ "bad hardware PWM frequency %d-%d: (%d)",
+ PI_HW_PWM_MIN_FREQ, hw_pwm_max_freq, frequency);
+
if (gpioCfg.clockPeriph == PI_CLOCK_PWM)
SOFT_ERROR(PI_HPWM_ILLEGAL, "illegal, PWM in use for main clock");
pi_mem_flag = 0x04;
pi_is_2711 = 1;
pi_ispi = 1;
+ clk_osc_freq = CLK_OSC_FREQ_2711;
clk_plld_freq = CLK_PLLD_FREQ_2711;
+ hw_pwm_max_freq = PI_HW_PWM_MAX_FREQ_2711;
+ hw_clk_min_freq = PI_HW_CLK_MIN_FREQ_2711;
+ hw_clk_max_freq = PI_HW_CLK_MAX_FREQ_2711;
+
fclose(filp);
if (!gpioMaskSet)
{
#include <stdint.h>
#include <pthread.h>
-#define PIGPIO_VERSION 6906
+#define PIGPIO_VERSION 6909
/*TEXT
/* hardware PWM */
#define PI_HW_PWM_MIN_FREQ 1
-#define PI_HW_PWM_MAX_FREQ 125000000
+#define PI_HW_PWM_MAX_FREQ 125000000
+#define PI_HW_PWM_MAX_FREQ_2711 187500000
#define PI_HW_PWM_RANGE 1000000
/* hardware clock */
-#define PI_HW_CLK_MIN_FREQ 4689
-#define PI_HW_CLK_MAX_FREQ 250000000
+#define PI_HW_CLK_MIN_FREQ 4689
+#define PI_HW_CLK_MIN_FREQ_2711 13184
+#define PI_HW_CLK_MAX_FREQ 250000000
+#define PI_HW_CLK_MAX_FREQ_2711 375000000
#define PI_NOTIFY_SLOTS 32
. .
gpio: see description
-clkfreq: 0 (off) or 4689-250000000 (250M)
+clkfreq: 0 (off) or 4689-250M (13184-375M for the BCM2711)
. .
Returns 0 if OK, otherwise PI_BAD_GPIO, PI_NOT_HCLK_GPIO,
. .
gpio: see description
-PWMfreq: 0 (off) or 1-125000000 (125M)
+PWMfreq: 0 (off) or 1-125M (1-187.5M for the BCM2711)
PWMduty: 0 (off) to 1000000 (1M)(fully on)
. .
. .
The actual number of steps beween off and fully on is the
-integral part of 250 million divided by PWMfreq.
+integral part of 250M/PWMfreq (375M/PWMfreq for the BCM2711).
-The actual frequency set is 250 million / steps.
+The actual frequency set is 250M/steps (375M/steps for the BCM2711).
-There will only be a million steps for a PWMfreq of 250.
-Lower frequencies will have more steps and higher
+There will only be a million steps for a PWMfreq of 250 (375 for
+the BCM2711). Lower frequencies will have more steps and higher
frequencies will have fewer steps. PWMduty is
automatically scaled to take this into account.
D*/
A single character, an 8 bit quantity able to store 0-255.
-clkfreq::4689-250M
+clkfreq::4689-250M (13184-375M for the BCM2711)
The hardware clock frequency.
. .
PI_HW_CLK_MIN_FREQ 4689
PI_HW_CLK_MAX_FREQ 250000000
+PI_HW_CLK_MAX_FREQ_2711 375000000
. .
count::
PI_HW_PWM_RANGE 1000000
. .
-PWMfreq::5-250K
+PWMfreq::1-125M (1-187.5M for the BCM2711)
The hardware PWM frequency.
. .
PI_HW_PWM_MIN_FREQ 1
PI_HW_PWM_MAX_FREQ 125000000
+PI_HW_PWM_MAX_FREQ_2711 187500000
. .
range::25-40000
#define PI_NOT_SERVO_GPIO -93 // GPIO is not in use for servo pulses
#define PI_NOT_HCLK_GPIO -94 // GPIO has no hardware clock
#define PI_NOT_HPWM_GPIO -95 // GPIO has no hardware PWM
-#define PI_BAD_HPWM_FREQ -96 // hardware PWM frequency not 1-125M
+#define PI_BAD_HPWM_FREQ -96 // invalid hardware PWM frequency
#define PI_BAD_HPWM_DUTY -97 // hardware PWM dutycycle not 0-1M
-#define PI_BAD_HCLK_FREQ -98 // hardware clock frequency not 4689-250M
+#define PI_BAD_HCLK_FREQ -98 // invalid hardware clock frequency
#define PI_BAD_HCLK_PASS -99 // need password to use hardware clock 1
#define PI_HPWM_ILLEGAL -100 // illegal, PWM in use for main clock
#define PI_BAD_DATABITS -101 // serial data bits not 1-32
import os
import atexit
-VERSION = "1.43"
+VERSION = "1.44"
exceptions = True
[PI_NOT_SERVO_GPIO , "GPIO is not in use for servo pulses"],
[PI_NOT_HCLK_GPIO , "GPIO has no hardware clock"],
[PI_NOT_HPWM_GPIO , "GPIO has no hardware PWM"],
- [PI_BAD_HPWM_FREQ , "hardware PWM frequency not 1-125M"],
+ [PI_BAD_HPWM_FREQ , "invalid hardware PWM frequency"],
[PI_BAD_HPWM_DUTY , "hardware PWM dutycycle not 0-1M"],
- [PI_BAD_HCLK_FREQ , "hardware clock frequency not 4689-250M"],
+ [PI_BAD_HCLK_FREQ , "invalid hardware clock frequency"],
[PI_BAD_HCLK_PASS , "need password to use hardware clock 1"],
[PI_HPWM_ILLEGAL , "illegal, PWM in use for main clock"],
[PI_BAD_DATABITS , "serial data bits not 1-32"],
Frequencies above 30MHz are unlikely to work.
gpio:= see description
- clkfreq:= 0 (off) or 4689-250000000 (250M)
+ clkfreq:= 0 (off) or 4689-250M (13184-375M for the BCM2711)
Returns 0 if OK, otherwise PI_NOT_PERMITTED, PI_BAD_GPIO,
pigpio daemon is started (option -t).
gpio:= see descripton
- PWMfreq:= 0 (off) or 1-125000000 (125M).
+ PWMfreq:= 0 (off) or 1-125M (1-187.5M for the BCM2711).
PWMduty:= 0 (off) to 1000000 (1M)(fully on).
Returns 0 if OK, otherwise PI_NOT_PERMITTED, PI_BAD_GPIO,
. .
The actual number of steps beween off and fully on is the
- integral part of 250 million divided by PWMfreq.
+ integral part of 250M/PWMfreq (375M/PWMfreq for the BCM2711).
- The actual frequency set is 250 million / steps.
+ The actual frequency set is 250M/steps (375M/steps
+ for the BCM2711).
- There will only be a million steps for a PWMfreq of 250.
- Lower frequencies will have more steps and higher
- frequencies will have fewer steps. PWMduty is
- automatically scaled to take this into account.
+ There will only be a million steps for a PWMfreq of 250
+ (375 for the BCM2711). Lower frequencies will have more
+ steps and higher frequencies will have fewer steps.
+ PWMduty is automatically scaled to take this into account.
...
pi.hardware_PWM(18, 800, 250000) # 800Hz 25% dutycycle
byte_val: 0-255
A whole number.
- clkfreq: 4689-250M
+ clkfreq: 4689-250M (13184-375M for the BCM2711)
The hardware clock frequency.
connected:
PI_NOT_SPI_GPIO = -142
PI_BAD_EVENT_ID = -143
PI_CMD_INTERRUPTED = -144
+ PI_NOT_ON_BCM2711 = -145
+ PI_ONLY_ON_BCM2711 = -146
. .
event:0-31
PWMduty: 0-1000000 (1M)
The hardware PWM dutycycle.
- PWMfreq: 1-125000000 (125M)
+ PWMfreq: 1-125M (1-187.5M for the BCM2711)
The hardware PWM frequency.
range_: 25-40000
.br
gpio: see description
.br
-frequency: 0 (off) or 4689-250000000 (250M)
+frequency: 0 (off) or 4689-250M (13184-375M for the BCM2711)
.br
.EE
.br
gpio: see descripton
.br
-PWMfreq: 0 (off) or 1-125000000 (125M)
+PWMfreq: 0 (off) or 1-125M (1-187.5M for the BCM2711)
.br
PWMduty: 0 (off) to 1000000 (1M)(fully on)
.br
.br
The actual number of steps beween off and fully on is the
-integral part of 250 million divided by PWMfreq.
+integral part of 250M/PWMfreq (375M/PWMfreq for the BCM2711).
.br
.br
-The actual frequency set is 250 million / steps.
+The actual frequency set is 250M/steps (375M/steps for the BCM2711).
.br
.br
-There will only be a million steps for a PWMfreq of 250.
-Lower frequencies will have more steps and higher
+There will only be a million steps for a PWMfreq of 250 (375 for
+the BCM2711). Lower frequencies will have more steps and higher
frequencies will have fewer steps. PWMduty is
automatically scaled to take this into account.
.br
-.IP "\fBclkfreq\fP: 4689-250000000 (250M)" 0
+.IP "\fBclkfreq\fP: 4689-250M (13184-375M for the BCM2711)" 0
The hardware clock frequency.
.br
.br
-.IP "\fBPWMfreq\fP: 1-125000000 (125M)" 0
+.IP "\fBPWMfreq\fP: 1-125M (1-187.5M for the BCM2711)" 0
The hardware PWM frequency.
.br
.br
#define PI_HW_PWM_MAX_FREQ 125000000
.br
+#define PI_HW_PWM_MAX_FREQ_2711 187500000
+.br
.EE
For more information, please refer to <http://unlicense.org/>
*/
-/* PIGPIOD_IF2_VERSION 14 */
+/* PIGPIOD_IF2_VERSION 15 */
#include <stdio.h>
#include <stdlib.h>
#include "pigpio.h"
-#define PIGPIOD_IF2_VERSION 14
+#define PIGPIOD_IF2_VERSION 15
/*TEXT
. .
pi: >=0 (as returned by [*pigpio_start*]).
gpio: see description
-frequency: 0 (off) or 4689-250000000 (250M)
+frequency: 0 (off) or 4689-250M (13184-375M for the BCM2711)
. .
Returns 0 if OK, otherwise PI_NOT_PERMITTED, PI_BAD_GPIO,
. .
pi: >=0 (as returned by [*pigpio_start*]).
gpio: see descripton
-PWMfreq: 0 (off) or 1-125000000 (125M)
+PWMfreq: 0 (off) or 1-125M (1-187.5M for the BCM2711)
PWMduty: 0 (off) to 1000000 (1M)(fully on)
. .
. .
The actual number of steps beween off and fully on is the
-integral part of 250 million divided by PWMfreq.
+integral part of 250M/PWMfreq (375M/PWMfreq for the BCM2711).
-The actual frequency set is 250 million / steps.
+The actual frequency set is 250M/steps (375M/steps for the BCM2711).
-There will only be a million steps for a PWMfreq of 250.
-Lower frequencies will have more steps and higher
+There will only be a million steps for a PWMfreq of 250 (375 for
+the BCM2711). Lower frequencies will have more steps and higher
frequencies will have fewer steps. PWMduty is
automatically scaled to take this into account.
D*/
char::
A single character, an 8 bit quantity able to store 0-255.
-clkfreq::4689-250000000 (250M)
+clkfreq::4689-250M (13184-375M for the BCM2711)
The hardware clock frequency.
count::
#define PI_HW_PWM_RANGE 1000000
. .
-PWMfreq::1-125000000 (125M)
+PWMfreq::1-125M (1-187.5M for the BCM2711)
The hardware PWM frequency.
. .
#define PI_HW_PWM_MIN_FREQ 1
#define PI_HW_PWM_MAX_FREQ 125000000
+#define PI_HW_PWM_MAX_FREQ_2711 187500000
. .
range::25-40000
.br
.br
-$ pigs hp 19 125000001 100000
+$ pigs hp 19 400000000 100000
.br
-96
.br
-ERROR: hardware PWM frequency not 1-125M
+ERROR: invalid hardware PWM frequency
.br
.EE
.br
The actual number of steps beween off and fully on is the
-integral part of 250 million divided by \fBpf\fP.
+integral part of 250M/\fBpf\fP (375M/\fBpf\fP for the BCM2711).
.br
-The actual frequency set is 250 million / steps.
+The actual frequency set is 250M/steps (375M/steps for the BCM2711).
.br
-There will only be a million steps for a \fBpf\fP of 250.
-Lower frequencies will have more steps and higher
+There will only be a million steps for a \fBpf\fP of 250 (375 for
+the BCM2711). Lower frequencies will have more steps and higher
frequencies will have fewer steps. \fBpdc\fP is
automatically scaled to take this into account.
.br
-.IP "\fBcf\fP - hardware clock frequency (4689-250M)" 0
+.IP "\fBcf\fP - hardware clock frequency (4689-250M, 13184-375M for the BCM2711)" 0
The command expects a frequency.
.br
.br
-.IP "\fBpf\fP - hardware PWM frequency (1-125M)" 0
+.IP "\fBpf\fP - hardware PWM frequency (1-125M, 1-187.5M for the BCM2711)" 0
The command expects a frequency.
.br
from distutils.core import setup
setup(name='pigpio',
- version='1.43',
+ version='1.44',
author='joan',
author_email='joan@abyz.me.uk',
maintainer='joan',