annotate Calypso-buzzer-output @ 84:d2fef140ed53

CMU200-maintenance-notes: typo fix
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 13 Jan 2022 19:07:19 +0000
parents 1cdd0f0a6e70
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
40
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 Our dear Calypso has a dedicated digital output for driving old-fashioned
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 cellphone buzzers - I (Mother Mychaela) previously assumed those buzzers to be
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 piezoelectric, but now it appears that they are actually magnetic buzzers, not
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 piezo. But irrespective of the physics of the actual transducer that is
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 ultimately controlled by Calypso BU/PWT output, the Calypso output itself is
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 purely digital, producing digital waveforms, and we (FreeCalypso) need to
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 understand exactly what the chip puts out. The findings presented here have
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 been obtained by observing Calypso BU/PWT output with an oscilloscope; the hw
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 platform used by the Mother for these experiments was a BenQ M32 module - this
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 module has the familiar Calypso+Iota chipset inside, it has BU/PWT brought out,
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 and the breakout board supplied with these modules allowed for very quick
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 experimentation.
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 BU mode
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 =======
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 BU functionality of the BU/PWT output is implemented in the ARMIO block,
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 together with GPIO and keypad functions. Here are the new findings which were
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 previously unknowable without oscilloscope observation:
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 * In "normal" buzzer operation when ARMIO_LOAD_TIM is in the [1,255] range
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 (i.e., not 0), the output frequency is 13 MHz / 512 / (ARMIO_LOAD_TIM + 1).
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 This part matches our previous understanding. The highest frequency that can
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 be produced is 12.6953125 kHz, and the lowest is 99.182129 Hz.
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 * When ARMIO_LOAD_TIM is set to 0 and the buzzer is enabled, BU output is NOT a
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 25.390625 kHz tone (per the formula above) as we previously thought - instead
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 BU output will be constant high if BUZZER_LEVEL_REG is set to maximum 63, or
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 pure 203.125 kHz PWM exactly like LT otherwise.
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 * PWM power level control for BU works exactly like the one for LT - see the
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 companion Calypso-PWM-light article.
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 * The interesting question is exactly how PWM power level control and tone
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 generation combine, and the answer turned out to match the terse description
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 in CAL207: BU is the output of an AND gate; one input to this AND gate is the
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 output of the timer that produces tones between 99 Hz and 12.7 kHz (or
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 constant high if ARMIO_LOAD_TIM is set to 0), and the other input to the AND
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 gate is a PWM block strictly identical to LT.
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 * For a practical example, consider what happens when a 12.7 kHz (max frequency)
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 tone is emitted in combination with PWM. The "on" part of the waveform at
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 this tone frequency equals 512 periods of CLK13M, whereas the full cycle of
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 LT-like PWM is 64 periods of CLK13M. Thus the waveform seen on an o'scope
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 consists of 8 repeated PWM cycles, then a "pause" of 512 CLK13M periods (the
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 "off" part of the tone waveform), then the full cycle repeats. Furthermore,
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 the tone waveform and the PWM waveform fed to the internal AND gate are not
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 synchronized, and the resulting slight misalignment is easily visible on an
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 o'scope.
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 Pirelli DP-L10
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 ==============
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 In the Pirelli DP-L10 phone Calypso BU output is repurposed to control the
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 vibrator. Pirelli's official fw sets ARMIO_LOAD_TIM to 0 and BUZZER_LEVEL_REG
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 to 63; when operated in this manner, BU becomes a mere on/off output under
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 software control just like a GPIO. If someone wishes to run the vibrating motor
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 at a lower speed (i.e., exercise a form of "analog" control), the correct way to
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 perform such feat would be by dialing down BUZZER_LEVEL_REG (PWM control between
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 1/64 and 64/64) - setting ARMIO_LOAD_TIM to a nonzero value does not seem to
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 make any sense when the buzzer has been replaced with a vibrator.
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 PWT mode
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 ========
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 The principal difference between BU and PWT modes is that BU mode generates
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 "arbitrary" tone frequencies by dividing from CLK13M/512, whereas PWT mode
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 generates predefined musical note frequencies, specifically 48 notes of the
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 chromatic scale from F4 through E8 in the scientific pitch notation. The
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 frequency range of PWT mode is narrower than BU mode (349 Hz to 5274 Hz, as
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 opposed to 99 Hz to 12.7 kHz), and PWT does not support constant high output
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 for Pirelli-style vibrator driving - however, BU mode suffers from a major
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 problem in that its repertoire of possible tone frequencies does not correspond
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 to musical notes. Given the desire to have ringtone melodies that are composed
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75 of standard musical notes, TI added the new PWT hardware block that is
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76 specifically designed to produce musical note frequencies.
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78 Here are some observations about PWT made with o'scope experiments:
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
80 * The description of FRC_REG in CAL207 is correct: bits [1:0] select the octave,
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
81 bits [5:2] select the semitone within the octave. The definitions in the
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82 non-functional (not actually used) mmiBuzzer.h header file in TI's BMI source
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
83 are wrong - or more precisely, the definitions under #if 0 are the correct
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
84 ones, whereas the enabled-for-compilation definitions are wrong.
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
85
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
86 * PWM power control works on the same principle as in BU mode: the output of
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
87 the musical tone frequency generator and the output of the PWM block are
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
88 simply ANDed together. The 64-level PWM block itself is very similar to the
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
89 ones in LT and BU, but it runs 8 times slower, i.e., one PWM period is 512
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
90 cycles of CLK13M, as opposed to 64 cycles of CLK13M in BU and LT, and each
1cdd0f0a6e70 Calypso-PWM-light and Calypso-buzzer-output articles written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
91 "quantum" of this slower PWM equals 8 cycles of CLK13M.