Keywords: Category:
 
EzCode4K and SPI Flash Voice Playing
TIME: 2009-12-23
 
EzCode4K and SPI Flash Voice Playing
SPI is a serial peripheral interface usually called synchronous serial peripheral interface, which is a high-speed full duplex synchronous communication bus defined by Motorola. Only four lines are required on the pins of chip, therefore the number of pins on the chip is decreased while the space for PCB layout is conveniently saved. Such simple and easy-to-use communication protocols are available for increasingly chips, such as EEPROM, FLASH, real-time clock and AD converter. Wherein SPI mainly comprises lines as follows: serial clock (SCK), serial data input (SDI), serial data output (SDO) and chip select (CS).
EzCode4K, a latest comprehensive development system for AM4K IC, simplifies development processes and provides more powerful functions for user, especially function of playing plug-in SPI Flash voice files. You will see the processes in details in this application series.
The recently supported SPI Flash includes models of W25X10/20/40/80 (Winbond) and MX25L16/32/64 (Macronix).
How to design and implement SPI Flash Voice File Playing
Step 1: Build up a project file with EzCode4K, and fill in client name, project number, project name and description on Project page.
Step 2: Select model of AM4K on Option page and set SPI communication options:
1) SPI communication: enable.
2) I/O Pins specified for communication: SPI CS Pin, SPI SCK Pin, SPI SDI Pin and SPI SDO Pin must be defined on the same group of I/O Ports, shown in Fig1. Wherein PRA ports are communication ports.
Figure 1
Note: The said SPI CS Pin, SPI SCK Pin, SPI SDI Pin and SPI SDO Pin correspond to SPI CS Pin, SPI CLK Pin, SPI DIO Pin and SPI DO Pin respectively as shown in Fig1.
3) Select Voice Quality for encoding in SPI Flash writer: SPI Voice Quality.
Three levels are available for selection: Low, Mid and High.
Low: Bit/Sample = 4,
Mid: Bit/Sample = 5,
High: Bit/Sample = 6.
Wherein High represents the best voice quality but requires much more capacities. Low is worse than High and Mid in voice quality but has the least capacity occupation. You can select as required.
SPI capacity = voice seconds * sample rate * quality for encoding.
For example, a 500-seconds voice represents a sample rate of 8000 and a code quality selected of Low (4Bit/Sample), so the capacity required in SPI Flash is 500 * 8000 * 4 = 16000000bit.
Note: The value of SPI Voice Quality must be the same as that when encoding SPI Flash voice files. 

Buttons for launching SPI Encoder
Step 3: Edit SPI Flash voice file:

There is an SPI Flash voice encoder on EzCode4K shortcut toolbar as shown in Fig2.
      
Figure 2
Click the above button to open the SPI Encoder main interface as shown in Fig3.
Figure 3
“New”   -- Build up a new SPI Flash voice project file.
“Open”   -- Open an SPI Flash voice project file.
“Save”   -- Save the present SPI Flash voice project file with a postfix of SPI.
“SaveAs”   -- Save the present SPI Flash voice project file with a new file name.
“Add”   -- Add a voice file.
“Insert”   -- Insert a voice file.
“Delete”   -- Delete a voice file.
“Clear”   -- Clear all the voice files.
“Build”   -- Compile the present SPI Flash voice project file and generate a file (xxx_spi.bin). xxx_spi is the project file name.
“SPIWriter”   -- Alpha’s writer.
The compiled and generated file [. bin] will be written into SPI Flash by using a universal writer, such as a Hi-Lo writer.
In addition, Alpha also provides an SPI Flash Writers, matching with its SPI Flash Demo Board. It is quite convenient at the time of programming and debugging.
Step 4: SPI Flash Writer
1) SPI Flash writer and Demo Board (See Fig4):
  
Figure 4
2) Using SPI Flash writer
Click Fig3 to start SPI Writer buttons and open the main interface of SPI Flash Writer (See Fig5).
Figure 5
Open the reopened file (xxx_spi.bin) and download it to SPI Flash.
 
 
 
Step 5. Programme
[In_State]
Prb0      Prb1
In_1   P1         P2
[ Path ]
      PowerOn: In_1
      P1: R1=0x0, R0=0x1, SPIPlayV(R1:R0)        ;Prb0 Input
P2: R1=0x0, R0=0x2, SPIPlayV(R1:R0)        ;Prb1 Input
The attachment[4K_SPI_Demo.rar]:
AM4K_SPI_Demo.Bin                AM4K programmable file
AN4K_SPI_DEMO_SPI.Bin           SPI Voice File
Circuit Diagram Reference
Note: The said SPI CS Pin, SPI SCK Pin, SPI SDI Pin and SPI SDO Pin respectively correspond to CS Pin, CLK Pin, DIO Pin and DO Pin as shown above.
ORIGIN: Ymwen
BACK TO TOP PRINT ADD TO FAVORITE SUBMIT CLOSE
 
>>
 OTHERS
 
·Application Note of Recording Modes (EzCode4...
·Using Midi Background
·How to Use General I/O to Drive LCD?
·The Application of One Key One Note
·Making an LED fan by ALPHA MCU
·Using ALPHA IC in Serial Communication
·Application of the Action Function
·Using AM8EB for I2C Communication
 
>>
 RECOMMENDED
 
·About the Recording Duration of AMSR Series ...
·EzCode4E Solutions
·Application Note of Recording Modes (EzCode4...
·Using Midi Background
·The Control of Silicon Controlled Rectifier
·The Application of One Key One Note
·Portamento Effect in AM4F
 
 

About Us Contact Us Disclaimer


ICP Record : 08035793 Prepared Guangdong ICP