BS66FV340/350/360 Application and Development in Touch with Voice Products AN0398E V1.10 1 / 24 December 11, 2016 BS66FV340/350/360 Application and Development in Touch with Voice Products D/N: AN0398E Introduction As an extension to the BS66F340/350/360 series, Holtek has also produces these Enhanced Touch Key Voice Flash MCUs, the BS66FV340/350/360. These devices integrate the new version enhanced Touch Key Engine (V3.2), which with its hardware acceleration circuit, has enhanced the Touch Key algorithm efficiency. The integrated 16-bit D/A converter and audio power amplifier meet the demands for high-quality voice and provide users with integrated touch key and voice product solutions. Additionally, the speaker output is controlled by an internal digital volume control function instead of using external variable resistors. With their high level of functional integration, these devices can have a master control MCU, touch keys and voice functions completely implemented within the same MCU. By using the SPI interface to connect to external SPI Flash Memory, the voice data can be easily updated and the difficulty of handling different languages and production inventory costs can be more efficiently managed. According to their different voice application requirements, such as voice quality, voice length and voice changes, etc., users can flexibly select different SPI Flash Memory capacities. The BS66FV3x0 series can be used in products which include both touch keys and voice functions, such as home appliances, normal consumer products, health care products, etc. Some of the special characteristics of the devices can be seen in their combination of touch key and voice functions within an MCU, their industrial quality specification of -40°C~85°C operating temperature, operating voltage range of 2.2V~5.5V, Flash Program Memory capacity of 4K/8K/16K words, SRAM Data Memory capacity of 512/768/1024 bytes, touch keys pin-shared with I/O ports, I²C, SPI and UART interfaces, integrated high accuracy RC oscillator, four selectable Low Voltage Reset voltage options and eight selectable Low Voltage Detector voltage options. Containing 20, 24 or 28 touch keys and in addition to the advantages of the previous generation devices, these new devices have an enhanced touch detection rate and improved anti-interference abilities. Their internal LED drivers support four segments with current output control, which can drive LED displays directly without requiring additional external current-limiting resistors or transistors, reducing the number of external components and reducing costs extensively. The software controlled LCD driver extends the application area to include LCD display products.
24
Embed
BS66FV340/350/360 Application and Development in Touch ......BS66FV340/350/360 Application and Development in Touch with Voice Products AN0398E V1.10 2 / 24 December 11, 2016 The devices
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
BS66FV340/350/360 Application and Development in Touch with Voice Products
AN0398E V1.10 1 / 24 December 11, 2016
BS66FV340/350/360 Application and Development in Touch with Voice Products
D/N: AN0398E
Introduction As an extension to the BS66F340/350/360 series, Holtek has also produces these
Enhanced Touch Key Voice Flash MCUs, the BS66FV340/350/360. These devices
integrate the new version enhanced Touch Key Engine (V3.2), which with its hardware
acceleration circuit, has enhanced the Touch Key algorithm efficiency. The integrated 16-bit
D/A converter and audio power amplifier meet the demands for high-quality voice and
provide users with integrated touch key and voice product solutions. Additionally, the
speaker output is controlled by an internal digital volume control function instead of using
external variable resistors. With their high level of functional integration, these devices can
have a master control MCU, touch keys and voice functions completely implemented within
the same MCU. By using the SPI interface to connect to external SPI Flash Memory, the
voice data can be easily updated and the difficulty of handling different languages and
production inventory costs can be more efficiently managed. According to their different
voice application requirements, such as voice quality, voice length and voice changes, etc.,
users can flexibly select different SPI Flash Memory capacities. The BS66FV3x0 series can
be used in products which include both touch keys and voice functions, such as home
appliances, normal consumer products, health care products, etc.
Some of the special characteristics of the devices can be seen in their combination of
touch key and voice functions within an MCU, their industrial quality specification of
-40°C~85°C operating temperature, operating voltage range of 2.2V~5.5V, Flash
Program Memory capacity of 4K/8K/16K words, SRAM Data Memory capacity of
512/768/1024 bytes, touch keys pin-shared with I/O ports, I²C, SPI and UART interfaces,
integrated high accuracy RC oscillator, four selectable Low Voltage Reset voltage options
and eight selectable Low Voltage Detector voltage options. Containing 20, 24 or 28 touch
keys and in addition to the advantages of the previous generation devices, these new
devices have an enhanced touch detection rate and improved anti-interference abilities.
Their internal LED drivers support four segments with current output control, which can
drive LED displays directly without requiring additional external current-limiting resistors
or transistors, reducing the number of external components and reducing costs
extensively. The software controlled LCD driver extends the application area to include
LCD display products.
BS66FV340/350/360 Application and Development in Touch with Voice Products
AN0398E V1.10 2 / 24 December 11, 2016
The devices have an internal 8-channel 12-bit A/D converter for temperature, humidity or
other signal measurements, an internal RTC clock with extremely low power consumption
and an integrated EEPROM memory for storing application parameters and settings
directly. By also including Holtek’s In-Application program technology, users have a
convenient means with which to directly store a large number of data, parameters and
settings and as well as having the ability to update their application programs.
As is the case with other Holtek 8-bit MCUs, these devices have a full array of protection
features including high noise immunity, Watchdog Timer and Low Voltage Reset to
provide maximum protection when operating in electrically hostile environments. During
product development, by providing an e-Link coupled with OCDS EV devices and
together with Holtek’s new touch switch software development platform (Touch MCU
Workshop) coupled with the voice function library, users have all the tools to hand to
ensure rapid touch and voice product development. Regarding voice product
development, users can use the professional mode of the new voice development
platform (Voice MCU Workshop) to generate a voice file, which will be programmed into
the external SPI Flash Memory. These devices are available in 48-pin LQFP (7mm×7mm)
and 44-pin LQFP (10mmx10mm) package types.
BS66FV340/350/360 Main Specification Comparison Table
Note : The SPIA is a hardware SPI serial interface, which is specifically used to interface
to external SPI Flash Memory for voice data accessing and can implement a level
shift function via its VDDIO pin.
BS66FV340/350/360 Application and Development in Touch with Voice Products
AN0398E V1.10 3 / 24 December 11, 2016
Block Diagram
Application Circuits
Traditional Solution
BS66FV3x0 SoC Solution
Master MCU
SPIFlashROM
PowerAmplifier+
Touch Peripheral
MCU
Voice MCU
BS66FV3x0(SoC)
BS66FV340/350/360 Application and Development in Touch with Voice Products
AN0398E V1.10 4 / 24 December 11, 2016
Touch Project Development
Touch MCU Development Platform – Touch MCU Workshop
In order to help customers rapidly develop their touch products, Holtek provides a Touch
MCU Workshop to assist customers to quickly implement touch switch functions. The
main features are as follows:
• Customers do not need to develop the underlying touch program code themselves
• Easy to use allowing entry-level developers can get started quickly
• The touch key function can be implemented using drag and drop operations
• Based on the program framework generated by the platform, users can modify or expand their program
• Easy to add other MCU functions besides touch key function for fast application development
• Open libraries for which users can add their own MCU functional program
• Can be an assistive tool for project management
BS66FV340/350/360 Application and Development in Touch with Voice Products
• Provides program compiler and programming functions. The program can be downloaded to the MCU after successful compilation.
• Code generator − Based on the program framework generated by the platform, advanced users can
use the HT-IDE3000 to continue with project devlopment.
• Tuning Software − Provides touch key sensitivity adjustment function − Allows users to observe the other touch key condition immediately after adjusting
one touch key with the internal oscilloscope display.
Touch MCU Workshop Development Flow:
The Touch MCU Workshop software can be freely downloaded on the Holtek website for
which a Youtube video is provided to show a practical operation demo. These allow users
to quickly learn how to use the touch development platform to complete their projects.
Development Platform
Model Function
Holtek Touch MCU Workshop Development Platform for Touch MCU
Software
Model Function Note
Holtek Touch MCU Workshop Development Platform for Touch MCU Supports: Windows XP or above
16-bit DAC and Power Amplifier The BS66FV3x0 devices include a fully integrated Class AB audio power amplifier with a
high output power of 1.5W @ 5V and 10% THD+N. The pins are described below.
SP+ Power amplifier positive output SP- Power amplifier negative output AUD_IN Power amplifier input BIAS Power amplifier internal reference voltage AUD 16-bit DAC output AVDD_PA Power amplifier positive power supply AVSS_PA Power amplifier negative power supply
The 16-bit DAC and power amplifier can be easily controlled by MCU registers as shown
below.
DAEN(PLAC.0): Controls the 16-bit DAC. Setting the bit high will enable the 16-bit DAC.
PAEN(PLAC.1): Controls the Power Amplifier. Setting the bit high will enable the Power
Amplifier. The 16-bit DAC output pin is AUD. Its data registers are PLADL (Low Byte) and
PLADH (High Byte). The software uses the Timer Mode of the Timer Module to generate
a regular interrupt. For example an interrupt will be generated every 125µs for a voice
sampling frequency of 8kHz. When the interrupt time has elapsed, the voice data read
from the SPI Flash Memory will be written into the 16-bit DAC by software, then amplified
via the integrated Power Amplifier and output to drive the speakers.
SET CTMA0E ;CTM0 Comparator A match interrupt control
CLR TM0DL
CLR TM0DH
;------8kHz---------------------
MOV A,LOW(4000/8)
MOV TM0AL,A
MOV A,HIGH(4000/8)
MOV TM0AH,A
SET T0ON ;CTM0 Enable
SET MF0E ;MF0(CTM0) Enable
To avoid the annoying "pop" caused by the DAC and the audio power amplifier during
on/off operations, the Ramp up and Ramp down processes are necessary.
First initialise the DAC 16-bit data registers, known as PLADL/PLADH, to 0000H and
MUTEB=0.
Ramp up - start playing voice
Set PAEN=1 and DAEN=1, increase PLADL/PLADH from 0000H to 8000H gradually,
MUTEB=1, and then begin to play the voice.
Ramp down - stop playing voice
Adjust the current 16-bit DAC contents PLADL/PLADH to 8000H, MUTEB=0, reduce the
DAC content PLADL/PLADH from 8000H to 0000H gradually, then turn off the power
amplifier and DAC by setting PAEN=0 and DAEN=0.
As a general rule, if the Ramp up/down process takes more than 200ms, the pop sound
will not be generated.
BS66FV340/350/360 Application and Development in Touch with Voice Products
AN0398E V1.10 9 / 24 December 11, 2016
Voice Data
The voice data is stored in an external SPI Flash Memory. The stored data can be read by
the MCU via an integrated SPI interface as shown below.
The maximum operating voltage of the SPI Flash Memory is 3.6V. Therefore for
applications with 5V system power supply, an external LDO is required to drop the voltage
to 3V which is then connected to the VDDIO pin. Here the PBS05 and PBS04 bits in the
PBS0 register should be set to 10 to select the VDDIO function. The SPIA interface is
powered by the external VDDIO pin, so the SPI interface voltage is 3V.
Note: In the BS66FV3x0 voice product EFT test, the SPI clock line SCK connected to the
SPI Flash Memory is easily disturbed by EFT. Therefore during PCB Layout care must be
taken that the SCK line should be located close to the MCU and the routing length made
as short as possible.
SPI Flash Memory Capacity Selection Example:
Assume that the sampling frequency is 16kHz, the audio format is 16-bit PCM (no
compression). If a 2-minute voice needs to be stored then it requires 16k × 16-bit × 2 × 60
seconds = 30720kbits = 30Mbits. Therefore the required SPI Flash Memory capacity is
32Mbits (Ex: MX25R3235F).
BS66FV340/350/360 Application and Development in Touch with Voice Products
AN0398E V1.10 10 / 24 December 11, 2016
The following examples are the SPIA SPI_Init and RW_SPI subroutines. The MCU is in
Master Mode, the SPI Flash Memory is in Slave Mode:
;*************************************************************** ;Function Name: SPI_Init ;Objective: Hardware SPIA Intialization ;*************************************************************** SPI_Init: ;SPIA Setting CLR SASPI0 CLR SASPI1 CLR SASPI2 ;SASPI2~ SASPI0=(000): SPI master mode; SPI clock is fSYS/4 SET SAMLS ;MSB First SET SACKEG SET SACKPOLB SET SPIAEN ;Enable SPI Interface SET SACSEN ;Enable SPI CS ;------------------------------------------------------- RET RW_SPI: MOV A,WriteSPIBuf MOV SPIAD,A SZ SAWCOL JMP RW_SPI CHECKTRF: CLR WDT SNZ SATRF JMP CHECKTRF CLR SATRF MOV A, SPIAD MOV READSPIBUF,A RET Main_Start: : : ;----------------------------------------------------------- ;SPIA I/O Setting SET PCS10 CLR PCS11 ;PC4/SDOA SET PCS12 CLR PCS13 ;PC5/SCKA SET PCS14 CLR PCS15 ;PC6/SDIA SET PCS16 CLR PCS17 ;PC7/SCSAB SET PCPU7 ;PC7/SCSB PULL-HIGH ENABLE MOV A, 00001100B ORM A,SLEDC1 ;SPIA Source Current MAX, (PCPS3,PCPS2)=(1,1) ;----------------------------------------------------------- : : CALL SPI_Init MOV WRITESPIBUF, A SET SACSEN CALL RW_SPI CLR SACSEN : :
BS66FV340/350/360 Application and Development in Touch with Voice Products
AN0398E V1.10 11 / 24 December 11, 2016
Volume Control
The BS66FV3x0 devices have two volume control methods.
1. External variable resister volume control – analog method
2. Digital volume control
External Variable Resister (VR) Volume Control – analog method:
Connect an external variable resistor between the DAC output AUD and the Power
Amplifier input AUD_IN to control the volume.
Digital Volume Control:
No external variable resistor VR is required. The digital volume can be adjusted by the
USVC[6:0] bits in a range of +6dB to -32dB with each step having a 0.5dB (big) or 1dB
(small) increment. MUTEB, bit 7 in the USVC register, is the speaker mute control bit.
When this bit is cleared to 0, the speaker will be muted.
Application circuits are shown below:
• 5V Application Circuit
BIAS
AUD
AUD_IN
SP+SP-
I/O
SCOMxSSEGx
VSS AVSS_PA
PC4/SDOAPC5/SCKAPC6/SDIAPC7/SCSAB
SPI FlashROM
4
PB2/VDDIO
V33
F/W enable VDDIO function by PBS0 register
Speaker8Ω
XT2
XT1
OSC1
OSC2
RX
RS488 Transceiver
TX
I/O RS_DIR
System Crystal
32768HzRTC
TM PWM / Capture
1nF
1kΩ
Note:VR (Variable Resistor)for Volume Control
10kΩ
1mF
1μF
1nF
2.7kΩ Note:Digital Volume ControlWithout VR
VSS: Digital GroundAVSS_PA: Power Amplifier Ground
47μF
LDO
VCC(5V)HT7133-1
10μF
V33
VDD
1Ω 10μFKey1
Keyx
A/DAnalog signal
SPI Flash ROM maximumoperating voltage is 3.6V
VDD AVDD_PA
0.1μF 22μF
VCC(5V)
VDD: Digital PowerAVDD_PA: Power Amplifier Power
VDD
10μF
BS66FV340/350/360 Application and Development in Touch with Voice Products
AN0398E V1.10 12 / 24 December 11, 2016
• 5V Application Circuit
BIAS
AUD
AUD_IN
SP+SP-
I/O
SCOMxSSEGx
VSS AVSS_PA
PC4/SDOAPC5/SCKAPC6/SDIAPC7/SCSAB
SPI FLASHROM
4
PB2/VDDIO
Speaker8Ω
XT2
XT1
OSC1
OSC2
RX
RS488 Transceiver
TX
I/O RS_DIR
System Crystal
32768HzRTC
TM PWM / Capture
1nF
1kΩ
Note:VR (Variable Resistor)for Volume Control
10kΩ
1mF
1μF
1nF
2.7kΩ Note:Digital Volume ControlWithout VR
VSS: Digital GroundAVSS_PA: Power Amplifier Ground
Key1
Keyx
A/DAnalog signal
SPI Flash ROM maximumoperating voltage is 3.6V
VDD AVDD_PA
0.1μF 22μF
VCC(3.3V)
VDD: Digital PowerAVDD_PA: Power Amplifier Power
VDD
47μF
VCC(3.3V) VDD
1Ω 10μF
VDD
F/W disable VDDIOfunction by PBS0 register
10μF
BS66FV340/350/360 Application and Development in Touch with Voice Products
AN0398E V1.10 13 / 24 December 11, 2016
Taking the BS66FV340 Demo Board as an example, the actual application circuit is
described as follows:
AVDD_PA should be connected to the positive power supply directly and the AVSS_PA
should be connected to the negative power supply directly. As AVDD_PA will output a
large current when the Audio Power Amplifier is functioning, it may cause the AVDD_PA
voltage to experience rather large fluctuations. Therefore, it is necessary to connect the
external R7/C2/C3 components as a filter to prevent the MCU Power VDD from
interference.
PCB Layout Considerations:
• Give priority to the power filter capacitor which should be placed as close to the MCU as possible. Other components should also be located as close to the MCU as possible, especially the SPI clock line length should be as short as possible.
• To avoid interference caused due to instantaneous large currents generated when the Audio Power Amplifier is operating, the two power groups, VDD and AVDD_PA, should have their power sources routed separately.
• The Audio Power Amplifier power supply pin AVDD_PA should be connected to the positive power supply directly. The routing width must not be less than 12 mils.
• To avoid interference caused due to instantaneous large currents generated when the Audio Power Amplifier is functioning, the two ground groups, VSS and AVSS_PA, should be routed separately.
• The Audio Power Amplifier ground pin AVSS_PA should be connected to the negative power supply directly. The routing width must not be less than 12 mils.
• The two ground groups, VSS and AVSS_PA should be independently connected to ground using poured copper.
• Reserve enough space for VDD and VSS line routing during component placement.
• The Power Amplifier output SP+/SP- routing width must be thick and without vias if possible.
• As rectangular outlines more easily accumulate charge there exists point discharge effects. Therefore PCB stability will be adversely affected. To solve this problem it is better to use 45 degree angles or arcs.
BS66FV340/350/360 Application and Development in Touch with Voice Products
AN0398E V1.10 14 / 24 December 11, 2016
Load Customised Voice Source Files
For voice product development, users can use the professional mode of the voice
development platform (Voice MCU Workshop) to load the customised voice files, which
can be programmed into the external SPI Flash Memory. A voice function library can then
be called to implement the voice function.
The voice source file can be user-defined wav PCM file, which is loaded by using the
professional mode of the Voice MCU Workshop.
BS66FV340/350/360 Application and Development in Touch with Voice Products
AN0398E V1.10 15 / 24 December 11, 2016
The Voice MCU Workshop can be downloaded from the Holtek website. A YouTube
Introduction video is also provided for additional assistance. These allow users to quickly
learn how to use the Voice MCU Workshop to complete their projects.
Development Platform
Model Function Note
Holtek Voice MCU Workshop Development Platform for Voice MCU Can be used with ESK-66FV-100+ e-Link