The MAXQ7667 smart system-on-a-chip (SoC) provides a
time-of-flight ultrasonic distance-measuring solution. The
device is optimized for applications involving large distance measurement with weak input signals or multiple
target identification. The MAXQ7667 features high signalto-noise ratio achieved by combining flexible electronics
with the intelligence necessary to optimize each function
as environmental and target conditions change.
An integrated burst signal generator and echo reception
components process ultrasonic signals between 25kHz
and 100kHz. Echo reception components include a programmable gain low-noise amplifier (LNA), a 16-bit
sigma-delta ADC to digitize the received echo signals,
and digital signal processing (DSP). DSP limits noise
with a bandpass filter, and creates an echo envelope
through demodulation and lowpass filtering. Input
referred noise is a low 0.7µV
RMS
. A programmable
phase-locked loop (PLL) frequency synthesizer supplies
the reference frequency for the burst generator and the
clock for the echo receiver’s digital filter. An embedded
16-bit MAXQ20 microcontroller (µC) controls all the preceding functions.
The µC optimizes the burst frequency and reception
frequency for each transmission at any temperature.
The MAXQ7667 achieves smart sensing by monitoring
the echo signals and then actively changing the transmitted and received parameters to obtain optimum
results. Digital filtering and burst synthesis do not
require CPU intervention. This leaves all the CPU power
available for echo optimization, communication, diagnostics, and additional signal processing.
The MAXQ7667 operates with three different power
supply voltages: +5V, +3.3V, and +2.5V. Two internal
linear regulators allow operation from a single +5V supply when three external power supplies are not available. Alternatively, the MAXQ7667 can control an
external pass transistor to allow operation from a single
supply voltage of +8V to +65V or more, depending on
the external component tolerance. The device is available in a 48-pin LQFP package and is specified to
operate from -40°C to +125°C.
Sampling Rate
Internal Bandgap Voltage Reference for the
ADCs (Also Accepts External Voltage Reference)
o Timer/Digital I/O Peripherals
o High-Performance, Low-Power, 16-Bit RISC Core
o Program and Data Memory
o Crystal/Clock Module
o 16 x 16 Hardware Multiplier with 48-Bit
Accumulator, Single Clock Cycle
o Power-Management Module
o JTAG Interface
o Universal Asynchronous Receiver-Transmitter
Stresses beyond those listed under “Absolute Maximum Ratings” may cause permanent damage to the device. These are stress ratings only, and functional
operation of the device at these or any other conditions beyond those indicated in the operational sections of the specifications is not implied. Exposure to
absolute maximum rating conditions for extended periods may affect device reliability.
DVDDIO, GATE5, REG3P3, REG2P5 to
DGND ................................................................-0.3V to +6.0V
AVDD to AGND .....................................................-0.3V to +4.0V
DVDD to DGND .....................................................-0.3V to +3.0V
DVDDIO to DVDD..................................................-0.3V to +6.0V
AVDD to DVDD......................................................-0.3V to +4.0V
AGND to DGND.....................................................-0.3V to +0.3V
Digital Inputs/Outputs to DGND..........-0.3V to (V
DVDDIO
+ 0.3V)
Analog Inputs/Outputs to AGND ............-0.3V to (V
AVDD
+ 0.3V)
XIN, XOUT to DGND ..............................-0.3V to (V
DVDD
+ 0.3V)
Maximum Current into Any Pin............................................50mA
Note 1: Noise measured at bandpass filter output with ECHO+ and ECHO- shorted divided by the gain with f
BPF
= 50kHz.
Note 2: Gain adjust resolution typically ranges between 6.25% and 12.5%.
Note 3: LIN 2.0 specifies a maximim data rate of 20kbps. Higher data rates could be possible with compatible devices and suitable
line conditions.
ELECTRICAL CHARACTERISTICS (continued)
(V
DVDDIO
= +5V, V
AVDD
= +3.3V; V
DVDD
= +2.5V, system clock (f
SYSCLK
) = 16MHz, burst frequency (f
BURST
) = bandpass frequency
(f
BPF
) = 50kHz, C
REFBG
= C
REF
= 1µF in parallel with 0.01µF, f
ADCCLK
= 2MHz (SAR data rate = 125ksps), TA= T
MIN
to T
MAX
, unless
otherwise specified. Typical values are at T
A
= +25°C.)
PARAMETERSYMBOLCONDITIONSMINTYPMAXUNITS
SPI INTERFACE TIMING (Figures 11 and 12)
SPI Master Operating
Frequency
SPI Slave Operating
Frequency
SCLK Output Pulse-Width
High/Low
MOSI Output Hold Time
After SCLK Sample Edge
MOSI Output Valid to Sample
Edge
MISO Input Valid to SCLK
Sample Edge
MISO Input Hold Time After
SCLK Sample Edge
SCLK Inactive to MOSI
Inactive
SCLK Input Pulse-Width
High/Low
SS Active to First Shift Edget
MOSI Input Setup Time to
SCLK Sample Edge
MOSI Input Hold Time After
SCLK Sample Edge
MISO Output Valid After
SCLK Shift Edge Transition
7, 18, 43 DGND Digital Ground. Connect all DGND nodes together. Connect to AGND at a si ngle point.
8, 17, 44 DVDDIO
9 P0.0/URX
10 P0.1/UTX
11 P0.2/TXEN
12
13 P0.4/T0B
14 P0.5/T1
15 P0.6/T2
16 P0.7/T2B
20 XIN
P0.3/T0/
ADCCTL
Port 1 Data 3/JTAG Serial Clock Input. P1.3 i s a general-purpose digital I/O. TCK is the JTAG
serial test clock input. Refer to the MAXQ7667 User’s Guide Sections 5 and 11.
Port 1 Data 4/SPI Serial Data Output. P1.4 is a general-purpose digital I/O. MOSI is the master
output, sla ve input for the SPI interface. Refer to the MAXQ7667 User’s Guide Sections 5 and 9.
Port 1 Data 5/SPI Serial Data Input. P1.5 is a general-purpose digital I/O. MISO is the ma ster input,
slave output for the SPI interface. Refer to the MAXQ7667 User’s Guide Sections 5 and 9.
Port 1 Data 6/SPI Serial Clock Output. P1.6 is a general-purpose digital I/O. SCLK is the serial
clock for the SPI interface. SCLK is an input when operating as a s lave and an output when
operating as a master. Refer to the MAXQ7667 User’s Guide Sections 5 and 9.
Port 1 Data 7/Schedule Timer Sync Input/SPI Slave Select. P1.7 is a general-purpose digital I/O.
A rising edge on the SYNC input resets the schedule timer. In SPI slave mode, SS is the SPI
slave-select input. In SPI master mode, use SS or a GPIO to manually select an external slave.
Refer to the MAXQ7667 User’s Guide Sections 5, 7, and 9.
Digital Supply Voltage. Connect DVDD directly to a +2.5V external source or to REG2P5 output for
single supply operation. B ypass DVDD to DGND with a 0.1µF capacitor as clo se a s possible to
the device. Connect all DVDD nodes together.
Digital I/O Supply Voltage. DVDDIO powers al l digital I/Os except for XIN and XOUT. Bypass
DVDDIO to DGND with a 0.1µF capacitor as close as possible to the device. Connect all DVDDIO
nodes together.
Port 0 Data 0/UART Rece ive Data Input. P0.0 is a general-purpose digital I/O. URX is a UART or
LIN data receive input. Refer to the MAXQ7667 User ’s Guide Sections 5 and 8.
Port 0 Data 1/UART Transm it Data Output. P0.1 i s a general-purpose digital I/O. UTX is a UART or
LIN data transmit output. Refer to the MAXQ7667 User’s Guide Sections 5 and 8.
Port 0 Data 2/UART Transm it Output. P0.2 is a general-purpose digital I/O. TXEN asserts low when
the UART is transmitting. Use TXEN to enable an e xternal LIN/UART transcei ver. Refer to the
MAXQ7667 U ser’ s Guide Sections 5 and 8.
Port 0 Data 3/Timer 0 I/O/ADC Control Input. P0.3 is a general-purpose digital I/O. T0 is the
primary Type 2 timer/counter 0 output or input. ADCCTL is a sampling/conversion trigger input for
the SAR ADC. Refer to the MAXQ7667 User ’s Guide Sections 5, 6, and 14.
Port 0 Data 4/Timer 0B I/O/Comparator Output. P0.4 is a general-purpose d igital I/O. T0B is the
secondary Type 2 timer/counter 0 output or input. Refer to the MAXQ7667 User’s Guide Sections
5 and 6.
Port 0 Data 5/Timer 1 I/O. P0.5 is a general-purpose digital I/O. T1 is the primary Type 2
timer/counter 1 output or input. Refer to the MAXQ7667 User’s Guide Sections 5 and 6.
Port 0 Data 6/Timer 2 I/O. P0.6 is a general-purpose digital I/O. T2 is the primary Type 2
timer/counter 2 output or input. Refer to the MAXQ7667 User’s Guide Sections 5 and 6.
Port 0 Data 7/Timer 2B I/O. P0.7 is a general-purpose digital I/O. T2B is the secondary Type 2
timer/counter 2 output or input. Refer to the MAXQ7667 User’s Guide Sections 5 and 6.
Crystal Oscillator Input. Connect an external crystal or resonator between XIN and XOUT. When
using an external clock source drive XIN with 2.5V level clock while leaving XOUT unconnected.
Connect XIN to DGND when an external clock source i s not used.
Crystal Oscillator Output. Connect an external crystal or resonator between XIN and XOUT. Leave
21 XOUT
22 REG2P5 +2.5V Voltage Regulator Output
23 REG3P3 +3.3V Voltage Regulator Output
24 GATE5
25RESET
26 FILT
27, 32 AVDD
28, 31, 33 AGND Analog Ground. Connect all AGND nodes together. Connect to DGND at a single point.
29 ECHON Negati ve Echo Input. AC-couple ECHON to an u ltrasonic transducer.
30 ECHOP Positive Echo Input. AC-couple ECHOP to an ultrasonic transducer.
34 REF
35 REFBG +2.5V Reference Output/Reference Buffer Input. Bypas s to AGND with a 0.47µF capacitor.
36 AIN0 SAR ADC Input 0. AIN0 pairs with AIN1 in differential mode.
37 AIN1 SAR ADC Input 1. AIN1 pairs with AIN0 in differential mode.
38 AIN2 SAR ADC Input 2. AIN2 pairs with AIN3 in differential mode.
49 AIN3 SAR ADC Input 3. AIN3 pairs with AIN2 in differential mode.
40 AIN4 SAR ADC Input 4
41 N.C. No Connection. Internally connected. Leave unconnected.
45 BURST
46 P1.0/TDO
47 P1.1/TMS
48 P1.2/TDI
XOUT unconnected when driving XIN with a 2.5V level clock or when an external clock source is
not used.
+5V DVDDIO Voltage Regulator Control Output. GATE5 controls an external npn or nMOS
transistor that pas ses power to DVDDIO.
Reset Input/Output. RESET is open drain with an internal pullup resistor to DVDDIO. Internal
circuitry pulls RESET low when V
enabled and the watchdog timeout period e xpires. Force RESET low externally for manual reset.
PLL VCO Control Input. Connect external filter components on FILT for the in ternal PLL circu it. See
the Typical Application Circuit/Functional Diagram.
Analog Supply Voltage. Connect all AVDD inputs directly to a +3.3V source or to REG3P3 for selfpowered operation. Bypass each AVDD to AGND with a 0.1µF capacitor as close as possible to
the device.
ADC Reference Input/Reference Buffer Output. When using the internal reference, the buffered
bandgap reference voltage (V
external reference, apply an e xternal vo ltage source ranging between 1V and V
Disable the reference buffer when apply ing an external reference at REF. B ypass REF to AGND
with a 0.47µF capacitor.
Burst Output. Burst is the ultrasonic transducer excitation pulse output. BURST remains in threestate mode on power-up.
Port 1 Data 0/ JTAG Output. P1.0 is a general-purpose digital I/O. TDO is the JT AG ser ial data
output. Refer to the MAXQ7667 User’s Guide Sections 5 and 11.
Port 1 Data 1/ JTAG Test Mode-Select Input. P1.1 is a general-purpose digital I/O. TMS is the JTAG
mode-select input. Refer to the MAXQ7667 User’s Guide Section s 5 and 11.
Port 1 Data 2/ JTAG Input. P1.2 i s a general-purpose digital I/O. TDI is the JTAG serial data input.
Refer to the MAXQ7667 User’s Guide Sections 5 and 11.
REF
fal ls b elow its brownout reset va lue or watchdog reset is
DVDDIO
) is provided for both SAR and sigma-delta ADCs. When using an
at REF.
AVDD
MAXQ7667
16-Bit, RISC, Microcontroller-Based,
Ultrasonic Distance-Measuring System
Low-Noise Amplifier
Time Variable Gain Amplifier
16-Bit Sigma-Delta ADC
Digital Bandpass Filter
Full-Wave Rectifier and Digital Lowpass Filter
8-Deep, 16-Bit Wide FIFO Simplifies Real-Time
Processing
Magnitude Comparator
5-Channel, 12-Bit SAR ADC with 250ksps
Sampling Rate
Internal Bandgap Voltage Reference for the ADCs
(Also Accepts External Voltage Reference)
o Timer/Digital I/O Peripherals
SPI Interface
Three 16-Bit (or Six 8-Bit) Programmable Type 2
Timers/Counters
16-Bit Schedule Timer
Programmable Watchdog Timer
16 General-Purpose Digital I/Os with
Multipurpose Capability
o High-Performance, Low-Power, 16-Bit RISC Core
1MHz–16MHz Operation, Approaching 1MIPS per
1MHz
Low Power (< 2.5mA/MIPS, DVDD = +2.5V)
16-Bit Instruction Word, 16-Bit Data Bus
33 Instructions (Most Require Only One Clock
Cycle)
16-Level Hardware Stack
Three Independent Data Pointers with Automatic
Increment/Decrement
o Program and Data Memory
Internal 32KB Program Flash
Internal 4KB Data RAM
Internal 8KB Utility ROM
The ultrasonic distance-measurement peripherals in the
MAXQ7667 include a burst signal generator for
acoustic transmission and mixed signal circuits for
amplifying and digitizing echo signals ranging between
25kHz and 100kHz. The burst signal is a square wave
with adjustable duty cycle and pulse count. The burst is
derived either directly from the system clock or from a
programmable PLL locked to the system clock. The
MAXQ7667 effectively digitizes the echo signals
received at the ECHOP and ECHON inputs using an
LNA, sigma-delta ADC with variable analog gain amplifier, noise-limiting digital bandpass filter, digital fullwave rectifier, and a digital lowpass filter (see the
Typical Application Circuit/Functional Diagram
). The
device detects echo signals at the burst frequency with
amplitudes ranging from 10µV
P-P
to 100mV
P-P
. Echoes
greater than 100mV
P-P
and less than 2V
P-P
are internally clipped but do not saturate the receiver. To optimize
echo reception, the clock used for processing the echo
locks to the burst frequency. The MAXQ7667’s burst
generator can generate higher frequencies, but the
maximum usable frequency for the echo receive path is
100kHz . For applications requiring transducer frequencies above 100kHz, implement an external echo
receive path. The SAR ADC can then digitize the filtered echo envelope.
An integrated 16-bit RISC µC (MAXQ20) provides timing control, signal processing, and data I/O. The 16-bit
Harvard architecture RISC core executes most instructions in a single clock cycle from instruction fetch to
cycle completion. The MAXQ20 provides optimal performance for noise-sensitive analog applications.
The MAXQ7667 includes a 13.5MHz RC oscillator,
external crystal oscillator, watchdog timer, schedule
timer, three general-purpose Type 2 timers/counters,
two 8-bit GPIO ports, SPI interface, JTAG interface, LIN
capable UART interface, 12-bit SAR ADC with five multiplexed input channels, supply-voltage monitors, and a
voltage reference for communication, diagnostics, and
miscellaneous support.
Burst Controller
The MAXQ7667 provides a square-wave burst signal at
the BURST output. Use the burst control to transmit an
ultrasonic signal. Typical applications use the burst signal to switch an external transistor that drives a highvoltage transformer, which excites the transducer (see
the
Typical Application Circuit/Functional Diagram
).
Use software to configure the duty cycle, frequency,
number of pulses, and drive current of the burst. See
Section 17 of the
MAXQ7667 User’s Guide
.
Derive the burst signal either directly from the system
clock or from a programmable oscillator phase locked
to the system clock (Figure 1). Using the system clock
limits the burst frequency to one of 16 choices. Integer
division of the system clock generates these 16 frequencies. The PLL allows a fractional division of the
system clock. Any frequency within the PLL range is
selectable to a resolution of 0.13% or better.
When using the internal PLL, connect external filter
components (C1, R1, and C2) to FILT as shown in
Figure 1. These components filter the analog voltage
that controls the VCO in the PLL. The filter component
values shown in the figure are suitable for the entire
PLL frequency range.
MAXQ7667
C2
330pF
SYSTEM
CLOCK
(f
SYSCLK
)
ECHO
RECEIVE
CLOCK
PLL
C1
33nF
FILT
R1
24kΩ
PWM
2mV
P-P
DIAGNOSTIC
BURST
1
0
BTRN.10:BCKS
BPH[9:0]
PLLF[10:9]:PLLC[1:0]
BTRN[15:12]:BDIV[3:0]
BTRN[7:0]:BCNT[7:0]
BPH.15:BSTT
BTRN.9:BTRI
BPH.14:BDSBTRN.11:BPOL
BTRN.8:BGT
BURST
PLLF[8:0]
BURST CLOCK
GENERATOR
RECEIVE CLOCK
PRESCALE
Figure 1. Burst Transmission Stage
MAXQ7667
Echo Receive Path
Low-Noise Amplifier (LNA)
The LNA provides a 40V/V fixed gain to the input signal.
The differential inputs of the LNA are ECHOP and
ECHON. For proper biasing of the LNA, AC-couple the
transducer or any external circuitry to ECHOP and
ECHON. For a single-ended input signal, AC-couple the
signal to ECHOP with a 0.01µF capacitor and connect
ECHON to AGND through a 0.01µF capacitor placed as
close as possible to the signal source. The outputs of the
LNA connect to the inputs of a 16-bit sigma-delta ADC
and can connect internally to the AIN0 and AIN1 inputs
of the SAR ADC for external monitoring (Figure 2).
Diagnostic Signals
An analog multiplexer located at the input of the LNA
selects one of three possible signals for processing by
the echo receive path; the normal echo signal AC-coupled to the ECHOP and ECHON inputs, 0V signal, or a
2mV
P-P
internally generated signal (Figure 2). The
2mV
P-P
square-wave signal, with frequency and duty
cycle matching the burst signal, allows the echo
receive chain to process a simulated echo.
MAXQ7667
0.47µF
AGND
REFGB
0.47µF
TO EXTERNAL VOLTAGE
REFERENCE
AGND
REF
VARIABLE
GAIN SIGMA-
DELTA ADC
FIFO
8 x 16
FIFO
CONTROL
BANDPASS
FILTER
CLOCK
CONTROL
ECHO
RECEIVE
CLOCK
RCVC[4:0]:RCVGN[4:0]
RCVC[7:6]:LNAISEL[1:0]
RCVC.8:LNAOSEL
BPFI[15:0]
APE.13:RSARE
2.5V
BANDGAP REF
APE.12:BGE
FULL-WAVE
RECTIFIER PLUS
LOWPASS FILTER
R*
R*
*R = ECHO INPUT RESISTANCE. SEE THE ELECTRICAL CHARACTERISTICS SECTION.
The MAXQ7667 features a 16-bit sigma-delta ADC with
an analog gain adjustable from 38dB to 60dB (including the fixed LNA gain) with a maximum gain step of
12.5% (typical). Gain changes settle within one ADC
conversion. Use software to create a virtual time variable gain amplifier. A digital bandpass and lowpass filters remove switching glitches and DC offset at the
output of the ADC.
In a typical application, the software sets the gain to a
low value when the burst is first sent and increases the
gain as the time from when the burst was sent increases. As a result, strong echoes from nearby objects are
processed without clipping while small signals from distant objects are processed with the maximum gain. The
ADC samples the amplified echo signal from the LNA at
80 times the burst output frequency. The ADC provides
conversion results at a data rate equal to 10 times the
burst output frequency. The ADC conversion results
also load to an 8-deep first-in-first-out (FIFO) at the
native data rate or a separate time base without loading
the CPU.
Digital Bandpass Filter
The digital bandpass filter has a center frequency that
tracks the burst output frequency. The bandpass width
is 14% of the center frequency. The bandpass filter provides the 16-bit output data at a data rate equal to 10
times the burst output frequency.
Full-Wave Rectifier
The full-wave rectifier detects the envelope of the digital
bandwidth filter output to generate a DC output proportional to the peak-to-peak amplitude of the input signal.
Full-wave rectification allows the digital lowpass filter to
respond faster without excessive ripple.
Digital Lowpass Filter
The lowpass filter removes the ripple from the full-wave
detector output. The output of the lowpass filter is available at a data rate equal to five times the burst output
frequency. The corner frequency is 1/5 the burst frequency with approximately 40dB per decade rolloff.
The 16-bit output data of the lowpass filter is stored in a
FIFO register with a depth of eight samples. The
MAXQ7667 allows data transfer from the lowpass filter
output to the FIFO automatically each time the lowpass
filter output updates, through the control of one of the
timer outputs, or through software. The device includes
a FIFO depth counter with programmable interrupt levels and generates an interrupt if a FIFO overflow condition occurs. The output of the digital lowpass filter
connects to a digital comparator that can generate an
interrupt for a specified echo signal level.
Digital Comparator and Threshold Adjust
The digital comparator output asserts when the echo
amplitude at the output of the digital lowpass filter crosses a given threshold. The comparator’s threshold level,
hysteresis, and interrupt polarity are programmable.
SAR ADC
The MAXQ7667 incorporates a 12-bit unbuffered SAR
ADC with sample-and-hold and conversion rate up to
250ksps. The ADC allows measurements of tempera-
ture, battery voltage, or other parameters using five single-ended or two fully differential analog inputs
(AIN0–AIN4). All of the analog inputs have a range of 0
to V
REF
in unipolar mode and ±V
REF
/2 in bipolar mode.
The SAR ADC supports three different conversion start
sources: timers, ADC control input (ADCCTL), and software write. The conversion start source triggers the
ADC acquisition and conversion. The system clock provides the ADC clock frequency programmable to 1/2,
1/4, 1/8, or 1/16 of the system clock. Use internal
bandgap reference, external reference, or AVDD for
voltage reference of the SAR ADC. Figure 3 shows a
simplified block diagram of the SAR ADC.
The output of the SAR ADC is straight binary in unipolar
mode and two’s complement in bipolar mode. Figures 4
and 5 show the ADC transfer functions in unipolar
mode and bipolar mode.
000
001
002
003
004
FFC
FFB
FFD
FFE
FFF
0123
4
FS
FS - 1.5 LSB
FULL-SCALE
TRANSITION
FS = REF
ZS = 0
1 LSB = REF/4096
OUTPUT CODE (hex)
DIFFERENTIAL INPUT VOLTAGE (LSB)
Figure 4. Unipolar Transfer Function
800
801
FFE
001
000
FFF
7FE
7FF
-FS
0
+FS
OUTPUT CODE (hex)
DIFFERENTIAL INPUT VOLTAGE (LSB)
+FS - 1.5 LSB
FULL-SCALE
TRANSITION
+FS = REF/2
ZS = 0
-FS = -REF/2
1 LSB = REF/4096
-FS + 0.5 LSB
Figure 5. Bipolar Transfer Function
MAXQ7667
16-Bit, RISC, Microcontroller-Based,
Ultrasonic Distance-Measuring System
Figures 6 and 7 show the equivalent input circuit of the
MAXQ7667 analog input architecture. During acquisition (track), a sampling capacitor charges to the positive input voltage at AIN0–AIN4 in single-ended mode
or AIN0 and AIN2 in differential mode while a second
sampling capacitor connects to AGND in single-ended
mode or AIN1 and AIN3 in differential mode. The ADC
conversion start source and the ADC dual mode selection bits control the T/H timing.
Voltage Reference
The MAXQ7667 supports three possible voltage reference sources for ADC conversion; 2.5V internal
buffered bandgap reference, external source, and
AVDD. The internal 2.5V bandgap reference has high
initial accuracy and temperature coefficient of typically
less than 100ppm/°C. When operating in internal reference mode, either the buffered output of the internal
reference or AVDD connects to the SAR ADC while the
buffered output of the internal reference connects to the
sigma-delta ADC. When operating in external reference
mode, an external source ranging between 1V and
V
AVDD
applied at either the REF or REFBG inputs pro-
vides the reference to the SAR ADC and sigma-delta
ADC. Bypass REFBG and REF to AGND with a 0.47µF
capacitor for optimum performance. See Section 14 of
the
MAXQ7667 User’s Guide
.
Schedule Timer
The MAXQ7667’s schedule timer provides general timekeeping and software synchronization to an external I/O.
The schedule timer features include the following:
• 16-bit autoreload up-counter for the timer
• Programmable 16-bit alarm register
• Alarm interrupts
• Schedule timer incremented by a programmable
system clock prescaler (1, 1/2, 1/4, 1/8, 1/16, 1/32,
1/64, 1/128)
• Schedule timer up-counter resettable through an
external I/O pin, which allows synchronization of a
schedule timer to an external event
• Wake-up alarm to pull the system clock from stopmode to normal operation
Figure 8 shows a simplified block diagram of the
schedule timer.
MAXQ is a registered trademark of Maxim Integrated Products, Inc.
Type 2 Timers/Counters
The MAXQ7667 includes three 16-bit timers/counters
with programmable I/O (Figure 9). Each timer is a Type
2 timer implemented in the MAXQ®family. The Type 2
timer is an autoreload 16-bit timer/counter offering the
following functions:
• 8-bit/16-bit timer/counter
• Up/down autoreload
• Counter function of external pulse
• Capture
• Compare
Clock Sources
The MAXQ7667 oscillator module supplies the system
clock for the µC core and all of the peripheral modules.
The high-frequency oscillator operates with a 1MHz to
16MHz crystal. Use the internal RC oscillator as the
system clock for applications that do not require precise timing. See Section 15 of the
MAXQ7667 User’s
Guide
.
The MAXQ7667 supports the following master clock
sources:
• Internal high-frequency oscillator drives an external 1MHz–16MHz crystal or ceramic resonator
• Internal, fast-starting, 13.5MHz RC oscillator
(default oscillator at startup and in the event the
external crystal fails)
• External 4MHz–16MHz clock input
Crystal Selection
The MAXQ7667 requires a crystal with the following
specifications:
Frequency: 1MHz–16MHz
C
LOAD
: 6pF (min)
Drive level: 5µW
Series resonance resistance: 30Ω (max)
Note: Quartz crystal vendors often specify series resonance resistance (R1). Series resonance resistance is
the resistance observed when the resonator is in the
series resonant condition. When a resonator is used in
the parallel resonant mode with an external load capacitance, as is the case with the MAXQ7667 oscillator circuit, the effective resistance at the loaded frequency of
oscillation is:
R1 x (1 + (CO/C
LOAD
))
2
For typical shunt capacitance (CO) and load capacitance (C
LOAD
) values, the effective resistance poten-
tially exceeds R1 by a factor of 2.
MAXQ7667
16-Bit, RISC, Microcontroller-Based,
Ultrasonic Distance-Measuring System
The joint test action group (JTAG) IEEE 1149.1 standard
defines a unique method for in-circuit testing and programming. The MAXQ7667 conforms to this standard,
implementing an external test access port (TAP) and
internal TAP controller for communication with a JTAG
bus master, such as an automatic test equipment (ATE)
system. The MAXQ7667 JTAG interface does not allow
boundary scan. For detailed information on the TAP and
TAP controller, refer to IEEE Std 1149.1 “IEEE Standard
Test Access Port and Boundary-Scan Architecture” on
the IEEE website at www.standards.ieee.org.
The TAP controller communicates synchronously with
the host system (bus master) through four digital I/Os:
test mode select (TMS), test clock (TCK), test data
input (TDI), and test data output (TDO). The internal
TAP module consists of shift registers and a TAP controller (Figure 10). The shift registers serve as transmit
and receive data buffers for a debugger. Maintain the
maximum TCK clock frequency to below 1/8 the system
clock frequency for proper operation.
READ
TO DEBUG
ENGINE
WRITE
MUX
SHADOW REGISTER
765432 10S1S0
DEBUG REGISTER
SYSTEM PROGRAMMING REGISTER
MAXQ7667
43210
MUX
DVDDIO
P1.2/TDI
DVDDIO
P1.1/TMS
DVDDIO
P1.3/TCK
POWER-ON
RESET
MUX
BYPASS
INSTRUCTION REGISTER
TAP
CONTROLLER
2
10
UPDATE-DR
UPDATE-DR
MUX
DVDDIO
P1.0/TDO
MAXQ7667
16-Bit, RISC, Microcontroller-Based,
Ultrasonic Distance-Measuring System
The following four digital I/Os form the TAP interface:
• TDO—Serial output signal for test instruction and
data. Data transitions on the falling edge of TCK.
TDO idles high when inactive. TDO serially transfers internal data to the external host. Data transfers lease significant bit first.
• TDI—Serial input signal for test instruction and
data. Transition data on the rising edge of TCK.
TDO pulls high when unconnected. TDI serially
transfers data from the external host to the internal
TAP module shift registers. Data transfers least
significant bit first.
• TCK—Serial clock for the test logic. When TCK
stops at 0, storage elements in the test logic must
retain their data indefinitely. Force TCK high when
inactive.
• TMS—Test mode selection. The rising edge of TCK
samples the test signals at TMS. The TAP controller
decodes the test signals at TMS to control the test
operation. Force TMS high when inactive.
UART/LIN Interface
The MAXQ7667 includes a UART/LIN transceiver combination that supports communication speeds up
2MBd. The LIN standard for example limits communication speed to 20kBd or less. Connect a LIN transceiver
or other UART connections such as RS-232 and RS-485
directly to the MAXQ7667’s 2-wire interface: URX and
UTX. The MAXQ7667 operates as a LIN slave or LIN
master device. The UART provides the programmable
baud-rate generators to communicate effectively to or
from the LIN transceiver. The device holds up to 8
bytes of data in each of the transmit and receive FIFOs.
The following characteristics apply to the MAXQ7667
UART/LIN interface:
• Full-duplex operation for asynchronous data transfers up to 500kBd (system clock/32)
• Half-duplex operation for synchronous data transfers up to 2MBd (system clock/8)
• 8-deep receive and transmit FIFO with programmable interrupt for receive and transmit
• Independent baud-rate generator
• Programmable 9th data bit (commonly used for
parity or address/data selection)—UART mode
only
• Hardware support for LIN including break detection, autobaud, address identity filtering, checksum calculation, and block length checking
• Supports common RS-232 and LIN baud rates:
1000, 1200, 2400, 4800, 9600, 19,200, 20,000,
38,400, 57,600, and 115,200 with system clock =
16MHz.
SPI Interface
The MAXQ7667 supports 4-wire SPI interface communication with 8-bit or 16-bit data streams operating in
either master mode or slave mode. The SPI interface
allows synchronous half-duplex or full-duplex serial
data transfers to a wide variety of external serial
devices using MISO, MOSI, SS, and SCLK signals.
Collision detection is provided when two or more masters attempt a data transfer at the same time. See
Section 9 of the
MAXQ7667 User’s Guide
.
General-Purpose Digital I/O Ports
Two 8-bit digital I/O ports (P0._ and P1._), with dedicated one or more alternative functions, are available as
general-purpose I/Os (GPIOs) under the control of the
integrated MAXQ20. Set each I/O within each port individually as an input or output. The GPIOs incorporate a
Schmitt trigger receiver and a full CMOS output driver
(Figure 13). Each GPIO configures as an input with
pullup to DVDDIO at power-up. When programmed as
an input, each I/O is configurable for high-impedance,
weak pullup to DVDDIO or pulldown to DGND. When
programmed as an output, writing to the port output
register (PO) controls the output logic state. The outputs source or sink at least 1.6mA. Configure the drive
strength for each I/O within each port to high or low
using the pad drive strength register for optimum EMI
performance. All the I/O ports have interrupt capability
that wake up the device while in stop mode and have
protection circuitry to DVDDIO and DGND.
Supply-Voltage Regulators
The MAXQ7667 requires three different power-supply
voltages. DVDDIO, nominally +5V, allows interfacing to
standard 5V logic on all the digital I/Os including the
LIN/UART, JTAG, and SPI ports. DVDD, nominally
+2.5V, powers all the high-speed digital circuits. AVDD,
nominally 3.3V, powers the analog circuits.
External power supplies or internal voltage regulators
provide each of the supply voltages. The internal voltage regulators provide 3.3V and 2.5V supplies from the
5V DVDDIO input. Obtain the 5V supply from a higher
external voltage supply by using a few external components. The MAXQ7667 includes an internal error amplifier used to regulate the voltage on DVDDIO by driving
the gate or base of an external pass transistor. Refer to
the
Connect bypass capacitors at each power-supply input
as close as possible to the device. Use a bypass
capacitor less than 0.47µF on DVDDIO. For most applications, 0.1µF bypass capacitors are adequate.
Supply Brownout Monitor
Power supplies DVDD, AVDD, and DVDDIO each
include a brownout monitor/supervisor that alerts the
µC when their corresponding supply voltages drop
below the interrupt threshold. Activate each brownout
monitor independently using the corresponding
brownout enable bits: VDBE, VIBE, and VABE.
Reset
In reset mode, no instruction execution occurs and all
inputs/outputs return to their default states. Code execution resumes at address 8000h (in the utility ROM)
once the reset condition is removed.
Four different sources reset the MAXQ7667: POR,
watchdog timer reset, external reset, and internal system reset.
During normal operation, force RESET low for at least
four system clock cycles for an external reset. Set the
ROD bit in the SC register, while the SPE bit in the ICDF
register is set, for an internal system reset. See Section
16 of the
MAXQ7667 User’s Guide
.
Power-On Reset (POR)
The MAXQ7667 includes a DVDD voltage supervisor to
control the µC POR. On power-up, internal circuitry
pulls RESET low and resets all the internal registers.
RESET is held low for the duration of the power-on
delay after V
DVDD
rises above the DVDD reset threshold. The internal RC oscillator starts up and software
execution begins at the reset vector location 8000h
immediately after the device exits POR while RESET is
I/O PAD
DVDDIO
P0._
100ΩK
100ΩK
DGND
DGND
EIE0._
EIES0._
DETECT
CIRCUIT
INTERRUPT
FLAG
PS0._
PR0._
PD0._
PO0._
SF DIRECTION
SF ENABLE
SF OUTPUT
PI0._ OR
SF INPUT
FLAG
MUX
MUX
MAXQ7667
Figure 13. Port 0 Digital I/O Basic Circuitry. Port 1 Circuitry is the Same as Port 2.
not externally forced low. An internal POR flag indicates
the source of a reset. Ramp up the DVDD supply at a
minimum rate of 60mV/ms to keep the device in POR
until DVDD fully settles.
Watchdog Timer
The primary function of the watchdog timer is to watch
for stalled or stuck software. The watchdog timer performs a controlled system restart when the µP fails to
write to the watchdog timer register before a selectable
timeout interval expires. The internal 13.5MHz RC oscillator drives the MAXQ7667’s watchdog timer.
Figure 14 shows the watchdog timer functions as the
source of both the watchdog interrupt and watchdog
reset. The watchdog interrupt timeout period is programmable to 212, 215, 218, or 221cycles of the RC
oscillator resulting in a nominal range of 273µs to
139.8ms. The watchdog reset timeout period is a fixed
512 RC clock cycles (34µs). When enabled, the watchdog generates an interrupt upon expiration; then, if not
reset within 512 RC clock cycles, the watchdog asserts
RESET low for eight RC clock cycles.
Hardware Multiplier/Accumulator
A hardware multiplier supports high-speed multiplications. The multiplier completes a 16-bit x 16-bit multiplication in a single clock cycle and contains a 48-bit
accumulator. The multiplier is a peripheral that performs seven different multiplication operations:
• Unsigned 16-bit multiplication
• Unsigned 16-bit multiplication and accumulation
• Unsigned 16-bit multiplication and subtraction
• Signed 16-bit multiplication
• Signed 16-bit multiplication and negation
• Signed 16-bit multiplication and accumulation
• Signed 16-bit multiplication and subtraction
MAXQ Core Architecture
The MAXQ20 µC is an accumulator-based Harvard
memory architecture. Fetch and execution operations
complete in one clock cycle without pipelining because
the instruction contains both the op code and data. The
µC streamlines 16 million instructions per second
(MIPS). Integrated 16-level hardware stack enables fast
subroutine calling and task switching. Manipulate data
quickly and efficiently with three internal data pointers.
Multiple data pointers allow more than one function to
access data memory without having to save and
restore data pointers each time. The data pointers automatically increment or decrement following an operation, eliminating the need for software intervention.
Instruction Set
The instruction set consists of a total of 33 fixed-length
16-bit instructions that operate on registers and memory locations. The highly orthogonal instruction set allows
arithmetic and logical operations to use any register
along with the accumulator. System registers control
functionality common to all MAXQ µCs, while peripheral
registers control peripherals and functions specific to
the MAXQ7667. All registers are subdivided into register modules.
The architecture is transport-triggered. Writes or reads
from certain register locations potentially have side
effects. These side effects form the basis for the higher
level op codes defined by the assembler, such as
ADDC, OR, JUMP, etc. The op codes are implemented
as MOVE instructions between system registers. The
assembler handles all the instruction encoding.
Memory Organization
In addition to the internal register space, the device
incorporates several memory areas:
• 16Kwords of flash memory for program storage
• 2Kword of SRAM for storage of temporary variables
• 4Kwords utility ROM
• 16-level, 16-bit-wide hardware stack for storage of
program return addresses and general-purpose use
Use the internal memory-management unit (MMU) to
map data memory space into a predefined program
memory segment for code execution from data memory.
Use the MMU to map program memory space as data
space for access to constant data stored in program
Figure 14. Watchdog Functional Diagram
RC CLOCK
(13.5MHz)
DIV 2
12
DIV 2
3
DIV 2
3
DIV 2
3
WD1
WD0
RWT
12
2
2152182
TIME
TIMEOUT
WDIF
RESET
21
EWDI
EWT
INTERRUPT
WTRF
RESET
MAXQ7667
16-Bit, RISC, Microcontroller-Based,
Ultrasonic Distance-Measuring System
memory. Access physical memory segments (other
than the stack and register memories) as either program memory or data memory, but not both at once.
By default, the memory is arranged in a Harvard architecture, with separate address spaces for program and
data memory. The configuration of program and data
space depends on the current execution location.
• When executing code from flash memory, access
the SRAM and utility ROM in data space.
• When executing code from SRAM, access the
flash memory and utility ROM in data space.
• When executing code from the utility ROM, access
the flash memory and SRAM in data space.
Utility ROM (see Section 18 of
the MAXQ7667 User’s Guide)
The utility ROM is a 4K x 16 block of internal ROM
memory that defaults to a starting address of 8000h.
The utility ROM consists of subroutines called from
application software. The subroutines include:
• In-system programming (bootloader) over the
JTAG or UART interface
• In-circuit debug routines
• Test routines (internal memory tests, memory
loader, etc.)
• User-callable routines for in-application flash programming and code space table lookup
Following any reset, execution begins in the utility ROM.
The ROM software determines whether the program
execution immediately jumps to the start of the userapplication code (located at address 0000h) or to one
of the special routines mentioned above. Call the routines within the utility ROM using the application software. Refer to the
MAXQ7667 User’s Guide
for more
information on the utility ROM contents.
Password protect in-system programming, in-application programming, and in-circuit debugging functions
using a password-lock (PWL) bit. The PWL bit is implemented in the SC register. When the PWL bit is set to
one (POR default), the password is required to access
the utility ROM, including in-circuit debug and in-system programming routines that allow reading or writing
of internal memory. When the PWL bit is cleared to
zero, these utilities are fully accessible without the
password. The password is automatically set to all ones
following a mass erase.
Data Memory
The 2K x 16 internal data SRAM maps into either program or data space. The contents of the SRAM are
maintained during stop mode and across non-POR
resets, as long as DVDD remains within the operating
voltage range.
A data memory cycle requires only one system clock
period to support fast internal execution. This allows a
complete read or write operation on SRAM in one clock
cycle. The MMU handles data memory mapping and
access control. Read or write to the data memory with
word or byte-wide commands.
Stack Memory
The MAXQ7667 provides a 16 x 16 hardware stack to
support subroutine calls and system interrupts. A 16-bit
wide internal hardware stack provides storage for program return addresses and general-purpose use. The
stack is used automatically by the processor when the
CALL, RET, and RETI instructions are executed and
interrupts serviced.
Register Set
Sets of registers control most functions. These registers
provide a working space for memory operations as well
as configuring and addressing peripheral registers on
the device. Registers are divided into two major types;
system registers and peripheral registers. The register
set common to most MAXQ-based devices, also known
as the system registers, includes the ALU, accumulator
registers, data pointers, interrupt vectors and control,
and stack pointer. The peripheral registers define additional functionality. Tables 1 and 3 show the MAXQ7667
register set.
Programming
Two different methods program the flash memory: insystem programming and in-application programming.
Both methods afford great flexibility in system design
as well as reduce the life-cycle cost of the embedded
system. The MAXQ7667 password protects these features to prevent unauthorized access to code memory.
In-System Programming
An internal bootstrap loader reloads the device over a
simple JTAG or UART interface allowing cost savings in
system software upgrade. During power-up, the
MAXQ7667 first checks for activity on the JTAG port. If
no activity is present, the device checks if a passwordprotected program is present. If the password is set,
the application code executes. The application codes
initiate reprogramming. If the password is not set, the
MAXQ7667 monitors the UART for an autobaud character (0x0D). If this character is received, the device
sets its serial baud rate and initiates a boot loader procedure. If 0x0D is not received after five seconds, the
device begins execution of the application code.
The following bootloader functions are supported:
•Load
• Dump
• CRC
• Verify
• Erase
In-Application Programming
The in-application programming feature allows the µC
to modify its own flash program memory while simultaneously executing its application software. This allows
on the fly software updates in mission-critical applications that cannot afford downtime. Erase and program
the flash memory using the flash programming functions in the utility ROM. Refer to Section 18 of the
MAXQ7667 User’s Guide
for a detailed description of
the utility ROM functions.
Stop Mode
Power consumption reaches its minimum in stop mode
(STOP = 1). In this mode, the external oscillator, internal RC oscillator, system clock, and all processing
halts. Trigger an enabled external interrupt input or
directly apply an external reset on RESET to exit stop
mode. Upon exiting stop mode, the µC either waits for
the external high-frequency crystal to complete its
warmup period or starts execution immediately from its
internal RC oscillator while the crystal warms up.
Interrupts
Multiple interrupt sources quickly respond to internal
and external events. The MAXQ architecture uses a
single interrupt vector (IV) and single interrupt-service
routine (ISR) design. Enable interrupts globally,
individually, or by module. When an interrupt condition
occurs, its individual flag is set even if the interrupt
source is disabled at the local, module, or global level.
Clear interrupt flags within the interrupt routine to avoid
repeated false interrupts from the same source.
Provide an adequate delay between the write to the
flag and the RETI instruction using application software
to allow time for the interrupt hardware to remove the
internal interrupt condition. Asynchronous interrupt
flags require a one-instruction delay and synchronous
interrupt flags require a two-instruction delay.
When an enabled interrupt is detected, software jumps
to a user-programmable interrupt vector location. The
IV register defaults to 0000h on reset or power-up.
Once software control transfers to the ISR, use the
interrupt identification register (IIR) to determine if the
source of the interrupt is a system register or peripheral
register. The specified module identifies the specific
interrupt source. The following interrupt sources are
available:
A variety of highly versatile, affordably priced development tools for this µC are available from Maxim and
third-party suppliers, including:
– Compilers
– Evaluation kit
– Integrated development environments (IDEs)
– JTAG-to-serial converters for programming and
debugging
A partial list of development tool vendors can be
found at www.maxim-ic.com/MAXQ_tools.
Technical support is available at https://support.maxim-
ic.com/micro.
Additional Documentation
Designers must have the following documents to fully
use all the features of this device. This data sheet contains pin descriptions, feature overviews, and electrical
specifications. Errata sheets contain deviations from
published specifications. The user’s guides offer
detailed information about device features and operation. The following documents can be downloaded from
www.maxim-ic.com/microcontrollers.
• This MAXQ7667 data sheet, which contains electrical/timing specifications and pin descriptions.
• The MAXQ7667 revision-specific errata sheet
(www.maxim-ic.com/errata).
• The
MAXQ7667 Family User's Guide
, which contains
detailed information on core features and operation,
including programming.
Package Information
For the latest package outline information and land patterns, go
to www.maxim-ic.com/packages
16-Bit, RISC, Microcontroller-Based,
Ultrasonic Distance-Measuring System
Maxim cannot assume responsibility for use of any circuitry other than circuitry entirely embodied in a Maxim product. No circuit patent licenses are
implied. Maxim reserves the right to change the circuitry and specifications without notice at any time.
40
____________________Maxim Integrated Products, 120 San Gabriel Drive, Sunnyvale, CA 94086 408-737-7600