comparison Calypso-buzzer-output @ 40:1cdd0f0a6e70

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