Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 May 2014 12:56:32 +0100
From:      fabiodive <fabiodive@gmail.com>
To:        freebsd-arm@FreeBSD.org
Subject:   Beaglebone Black. PWM minimum frequency of 1.52KHz
Message-ID:  <F5705D29-1EFE-4A20-89CC-CB0E52EB57F3@gmail.com>

next in thread | raw e-mail | index | archive | help
Hello,

PWM on Beaglebone Black

during my laboratory tests I was not able to setup a frequency suitable =
for servo motors.
I tried several times with many values but the results was always the =
same.
The minimal frequency I was able to achieve was 1.52 KHz.
Also, I noticed odd results with the most of configuration values, in =
this case
I lost the PWM output signal.

I tried some combinations, measuring the results with an oscilloscope, =
the period
configuration key appears to loose its  nanoseconds meaning beyond a =
value:=20

# sysctl dev.am335x_pwm.1.period=3D1500
# sysctl dev.am335x_pwm.1.dutyA=3D300
result frequency: 66 KHz  ->should be 666 KHz
length of period: 15 us ->should be 1.5 us
length of pulse: 2 us

# sysctl dev.am335x_pwm.1.period=3D1500000
# sysctl dev.am335x_pwm.1.dutyA=3D10000
result frequency: 1.71 KHz -> should be 666Hz
length of period:  585 us
length of pulse:  100 us

# sysctl dev.am335x_pwm.1.period=3D1800000
# sysctl dev.am335x_pwm.1.dutyA=3D10000
result frequency: 3.24 KHz -> should be 555Hz
length of period:  308 us
length of pulse:  100 us

the testing platform:
Beaglebone Black - FreeBSD 11 - uboot 2014.1

root@beaglebone:~ # uname -ar
FreeBSD beaglebone 11.0-CURRENT FreeBSD 11.0-CURRENT #0 r265728: Fri May =
 9 06:59:54 WEST 2014

(follow dmesg with some sdhci register dumps)

root@beaglebone:~ # dmesg
Copyright (c) 1992-2014 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
	The Regents of the University of California. All rights =
reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 11.0-CURRENT #0 r265728: Fri May  9 06:59:54 WEST 2014
    =
seaman@bluewaters:/usr/local/crochet-freebsd/work/obj/arm.armv6/usr/local/=
freebsd_src_11/sys/BBBELFARO arm
FreeBSD clang version 3.4 (tags/RELEASE_34/final 197956) 20140216
module run already present!
module runfw_fw already present!
CPU: Cortex A8-r3 rev 2 (Cortex-A core)
 Supported features: ARM_ISA THUMB2 JAZELLE THUMBEE ARMv4 Security_Ext
 WB disabled EABT branch prediction enabled
LoUU:2 LoC:2 LoUIS:1=20
Cache level 1:=20
 32KB/64B 4-way data cache WT WB Read-Alloc
 32KB/64B 4-way instruction cache Read-Alloc
Cache level 2:=20
 256KB/64B 8-way unified cache WT WB Read-Alloc Write-Alloc
real memory  =3D 536870912 (512 MB)
avail memory =3D 516030464 (492 MB)
Texas Instruments AM3358 Processor, Revision ES1.1
wlan: mac acl policy registered
random: <Software, Yarrow> initialized
ofwbus0: <Open Firmware Device Tree>
simplebus0: <Flattened device tree simple bus> on ofwbus0
aintc0: <TI AINTC Interrupt Controller> mem 0x48200000-0x48200fff on =
simplebus0
aintc0: Revision 5.0
ti_scm0: <TI Control Module> mem 0x44e10000-0x44e11fff on simplebus0
am335x_prcm0: <AM335x Power and Clock Management> mem =
0x44e00000-0x44e012ff on simplebus0
am335x_prcm0: Clocks: System 24.0 MHz, CPU 1000 MHz
am335x_dmtimer0: <AM335x DMTimer> mem =
0x44e05000-0x44e05fff,0x44e31000-0x44e31fff,0x48040000-0x48040fff,0x480420=
00-0x48042fff,0x48044000-0x48044fff,0x48046000-0x48046fff,0x48048000-0x480=
48fff,0x4804a000-0x4804afff irq 66,67,68,69,92,93,94,95 on simplebus0
Timecounter "AM335x Timecounter" frequency 24000000 Hz quality 1000
Event timer "AM335x Eventtimer" frequency 24000000 Hz quality 1000
ti_adc0: <TI ADC controller> mem 0x44e0d000-0x44e0efff irq 16 on =
simplebus0
ti_adc0: scheme: 0x1 func: 0x730 rtl: 0 rev: 0.1 custom rev: 0
gpio0: <TI General Purpose I/O (GPIO)> mem =
0x44e07000-0x44e07fff,0x4804c000-0x4804cfff,0x481ac000-0x481acfff,0x481ae0=
00-0x481aefff irq 96,97,98,99,32,33,62,63 on simplebus0
gpioc0: <GPIO controller> on gpio0
gpiobus0: <OFW GPIO bus> on gpio0
gpioled0: <GPIO led> at pin(s) 53 on gpiobus0
gpioled1: <GPIO led> at pin(s) 54 on gpiobus0
gpioled2: <GPIO led> at pin(s) 55 on gpiobus0
gpioled3: <GPIO led> at pin(s) 56 on gpiobus0
uart0: <TI UART (16550 compatible)> mem 0x44e09000-0x44e09fff irq 72 on =
simplebus0
uart0: console (115384,n,8,1)
ti_edma30: <TI EDMA Controller> mem =
0x49000000-0x490fffff,0x49800000-0x498fffff,0x49900000-0x499fffff,0x49a000=
00-0x49afffff irq 12,13,14 on simplebus0
ti_edma30: EDMA revision 40014c00
sdhci_ti0: <TI MMCHS (SDHCI 2.0)> mem 0x48060000-0x48060fff irq 64 on =
simplebus0
mmc0: <MMC/SD bus> on sdhci_ti0
sdhci_ti1: <TI MMCHS (SDHCI 2.0)> mem 0x481d8000-0x481d8fff irq 28 on =
simplebus0
mmc1: <MMC/SD bus> on sdhci_ti1
cpsw0: <3-port Switch Ethernet Subsystem> mem 0x4a100000-0x4a103fff irq =
40,41,42,43 on simplebus0
cpsw0: CPSW SS Version 1.12 (0)
cpsw0: Initial queue size TX=3D128 RX=3D384
cpsw0: Ethernet address: 90:59:af:69:c1:b4
miibus0: <MII bus> on cpsw0
smscphy0: <SMC LAN8710A 10/100 interface> PHY 0 on miibus0
smscphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
iichb0: <TI I2C Controller> mem 0x44e0b000-0x44e0bfff irq 70 on =
simplebus0
iichb0: I2C revision 4.0
iicbus0: <OFW I2C bus> on iichb0
iic0: <I2C generic I/O> on iicbus0
am335x_pmic0: <TI TPS65217 Power Management IC> at addr 0x24 on iicbus0
iichb1: <TI I2C Controller> mem 0x4802a000-0x4802afff irq 71 on =
simplebus0
iichb1: I2C revision 4.0
iicbus1: <OFW I2C bus> on iichb1
iic1: <I2C generic I/O> on iicbus1
iichb2: <TI I2C Controller> mem 0x4819c000-0x4819cfff irq 30 on =
simplebus0
iichb2: I2C revision 4.0
iicbus2: <OFW I2C bus> on iichb2
iic2: <I2C generic I/O> on iicbus2
am335x_pwm0: <AM335x PWM> mem =
0x48300000-0x483000ff,0x48300100-0x4830017f,0x48300180-0x483001ff,0x483002=
00-0x4830025f irq 86,58 on simplebus0
am335x_pwm1: <AM335x PWM> mem =
0x48302000-0x483020ff,0x48302100-0x4830217f,0x48302180-0x483021ff,0x483022=
00-0x4830225f irq 87,59 on simplebus0
am335x_pwm2: <AM335x PWM> mem =
0x48304000-0x483040ff,0x48304100-0x4830417f,0x48304180-0x483041ff,0x483042=
00-0x4830425f irq 88,60 on simplebus0
musbotg0: <TI AM33xx integrated USB OTG controller> mem =
0x47400000-0x47400fff,0x47401000-0x474012ff,0x47401300-0x474013ff,0x474014=
00-0x474017ff,0x47401800-0x47401aff,0x47401b00-0x47401bff,0x47401c00-0x474=
01fff irq 17,18,19 on simplebus0
musbotg0: TI AM335X USBSS v0.0.13
usbus0: Dynamic FIFO sizing detected, assuming 16Kbytes of FIFO RAM
usbus0 on musbotg0
usbus1: Dynamic FIFO sizing detected, assuming 16Kbytes of FIFO RAM
usbus1 on musbotg0
ti_pruss0: <TI Programmable Realtime Unit Subsystem> mem =
0x4a300000-0x4a37ffff irq 20,21,22,23,24,25,26,27 on simplebus0
ti_pruss0: AM33xx PRU-ICSS
Timecounters tick every 10.000 msec
usbus0: 480Mbps High Speed USB v2.0
usbus1: 480Mbps High Speed USB v2.0
ugen0.1: <Mentor Graphics> at usbus0
uhub0: <Mentor Graphics OTG Root HUB, class 9/0, rev 2.00/1.00, addr 1> =
on usbus0
ugen1.1: <Mentor Graphics> at usbus1
uhub1: <Mentor Graphics OTG Root HUB, class 9/0, rev 2.00/1.00, addr 1> =
on usbus1
mmcsd0: 4GB <SDHC SD04G 3.0 SN 28559571 MFG 07/2013 by 39 PH> at mmc0 =
48.0MHz/4bit/65535-block
uhub1: 1 port with 1 removable, self powered
uhub0: 1 port with 1 removable, self powered
ugen1.2: <Ralink> at usbus1
run0: <1.0> on usbus1
run0: MAC/BBP RT3070 (rev 0x0201), RF RT3020 (MIMO 1T1R), address =
bc:f6:85:66:b8:1b
random: unblocking device.
sdhci_ti1-slot0: Got data interrupt 0x00000002, but there is no active =
command.
sdhci_ti1-slot0: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D REGISTER =
DUMP =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
sdhci_ti1-slot0: Sys addr: 0x00000000 | Version:  0x00003101
sdhci_ti1-slot0: Blk size: 0x00000004 | Blk cnt:  0x00000001
sdhci_ti1-slot0: Argument: 0x00020000 | Trn mode: 0x0000071b
sdhci_ti1-slot0: Present:  0x01f70000 | Host ctl: 0x00000000
sdhci_ti1-slot0: Power:    0x0000000d | Blk gap:  0x00000000
sdhci_ti1-slot0: Wake-up:  0x00000000 | Clock:    0x00008007
sdhci_ti1-slot0: Timeout:  0x00000006 | Int stat: 0x00000000
sdhci_ti1-slot0: Int enab: 0x017f00fb | Sig enab: 0x017f00fb
sdhci_ti1-slot0: AC12 err: 0x00000000 | Slot int: 0x00000000
sdhci_ti1-slot0: Caps:     0x06e10080 | Max curr: 0x00000000
sdhci_ti1-slot0: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
sdhci_ti1-slot0: Got data interrupt 0x00000002, but there is no active =
command.
sdhci_ti1-slot0: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D REGISTER =
DUMP =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
sdhci_ti1-slot0: Sys addr: 0x00000000 | Version:  0x00003101
sdhci_ti1-slot0: Blk size: 0x00000004 | Blk cnt:  0x00000001
sdhci_ti1-slot0: Argument: 0x00020000 | Trn mode: 0x0000071b
sdhci_ti1-slot0: Present:  0x01f70000 | Host ctl: 0x00000000
sdhci_ti1-slot0: Power:    0x0000000d | Blk gap:  0x00000000
sdhci_ti1-slot0: Wake-up:  0x00000000 | Clock:    0x00008007
sdhci_ti1-slot0: Timeout:  0x00000006 | Int stat: 0x00000000
sdhci_ti1-slot0: Int enab: 0x017f00fb | Sig enab: 0x017f00fb
sdhci_ti1-slot0: AC12 err: 0x00000000 | Slot int: 0x00000000
sdhci_ti1-slot0: Caps:     0x06e10080 | Max curr: 0x00000000
sdhci_ti1-slot0: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
sdhci_ti1-slot0: Got data interrupt 0x00000002, but there is no active =
command.
sdhci_ti1-slot0: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D REGISTER =
DUMP =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
sdhci_ti1-slot0: Sys addr: 0x00000000 | Version:  0x00003101
sdhci_ti1-slot0: Blk size: 0x00000004 | Blk cnt:  0x00000001
sdhci_ti1-slot0: Argument: 0x00020000 | Trn mode: 0x0000071b
sdhci_ti1-slot0: Present:  0x01f70000 | Host ctl: 0x00000000
sdhci_ti1-slot0: Power:    0x0000000d | Blk gap:  0x00000000
sdhci_ti1-slot0: Wake-up:  0x00000000 | Clock:    0x00008007
sdhci_ti1-slot0: Timeout:  0x00000006 | Int stat: 0x00000000
sdhci_ti1-slot0: Int enab: 0x017f00fb | Sig enab: 0x017f00fb
sdhci_ti1-slot0: AC12 err: 0x00000000 | Slot int: 0x00000000
sdhci_ti1-slot0: Caps:     0x06e10080 | Max curr: 0x00000000
sdhci_ti1-slot0: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
sdhci_ti1-slot0: Got data interrupt 0x00000002, but there is no active =
command.
sdhci_ti1-slot0: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D REGISTER =
DUMP =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
sdhci_ti1-slot0: Sys addr: 0x00000000 | Version:  0x00003101
sdhci_ti1-slot0: Blk size: 0x00000004 | Blk cnt:  0x00000001
sdhci_ti1-slot0: Argument: 0x00020000 | Trn mode: 0x0000071b
sdhci_ti1-slot0: Present:  0x01f70000 | Host ctl: 0x00000000
sdhci_ti1-slot0: Power:    0x0000000d | Blk gap:  0x00000000
sdhci_ti1-slot0: Wake-up:  0x00000000 | Clock:    0x00008007
sdhci_ti1-slot0: Timeout:  0x00000006 | Int stat: 0x00000000
sdhci_ti1-slot0: Int enab: 0x017f00fb | Sig enab: 0x017f00fb
sdhci_ti1-slot0: AC12 err: 0x00000000 | Slot int: 0x00000000
sdhci_ti1-slot0: Caps:     0x06e10080 | Max curr: 0x00000000
sdhci_ti1-slot0: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
am335x_pmic0: TPS65217C ver 1.2 powered by AC
Trying to mount root from ufs:/dev/mmcsd0s2a [rw,noatime]...
warning: no time-of-day clock registered, system time will not be set =
accurately
wlan0: Ethernet address: bc:f6:85:66:b8:1b
run0: firmware RT2870 ver. 0.33 loaded
run0: firmware RT2870 ver. 0.33 loaded


thank you!
cheers,
f.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?F5705D29-1EFE-4A20-89CC-CB0E52EB57F3>