Note: * is a required field.
[Please fill in during the registration stage↓]
* Brief introduction of the work:
Based on the limited resources of the STC8A microcontroller, the real-time reading and playback of the TF card FAT16 file system file is realized.
The IO simulated I2S protocol is used to play 44.1K dual-channel 16bit audio files to achieve smooth playback and continuous streaming.
1. The self-reading FAT16 file system is realized.
2. The audio DA uses the high-quality ES9023P.
3. The IO simulated I2S interface is realized.
[Please fill in during the competition stage↓]
* 1. Details of the work;
100% of the PCB design of this production uses the EasyEDA editor, and the software is compiled using Keil3.
You can search for examples of using STM32F7 to drive ES9023P on Baidu. In this production, I use an 8-bit 8051 core microcontroller (minimum main frequency 27MHz) to achieve the same work.
After multiple optimizations using methods such as embedded assembly code, the I2S protocol is realized to play 44.1K dual-channel 16bit audio files to achieve smooth playback and continuous streaming. Almost squeezed out the performance of STC8A8K microcontroller.
Choice of audio DA:
To make a player for WAV audio files, I tried 8-bit PWM, 10-bit PWM, TDA1543, STA339BW, ES9023P on the audio DA. After listening for a while, I chose ES9023P.
This audio DA has excellent performance (The _ES9023_ is a 24-bit stereo audio DAC with an integrated 2Vrms op-amp driver, Zero detect output), and its own negative pressure transmitter can output audio directly to the ground (the audio output coupling capacitor is omitted, and the effect is very good when listening to headphones).
Choice of volume control:
I tried to use I2C to control the professional volume control chip PT2259, PWM drive light-emitting LED to illuminate the linear optocoupler, and the microcontroller to process data in real time, but the effect was not satisfactory.
Finally, a dual audio potentiometer (giving up the automatic control of the volume) was used to achieve manual adjustment of the volume, and the highest cost performance was found.
Choice of file system:
After trying FATFS and it failed to meet the speed requirements, I installed the standard FAT16 file system to implement a read-only driver (giving up the function of supporting long file names).
The entire production process took more than half a year from preparation, original component selection, multiple PCB revisions, performance optimization to finalization.
In the end, the ROM and RAM occupancy was very low (STC8A8K has 64KB ROM and 8K RAM), and we can consider adding functions later.
Program Size: data=49.6 xdata=2638 const=2496 code=6544
Note: A 128*32 OLED display was used during debugging. In the final version, the hardware has deleted the OLED, but the software still retains the OLED driver.
* 2. Describe the challenges faced by the work and the problems solved;
Use a low-cost, low-performance 8-bit microcontroller to achieve efficient reading of the FAT16 file system, and use ordinary IO software to simulate the I2S protocol to play 44.1K dual-channel 16-bit audio files to achieve smooth playback and continuous streaming.
The stability and accuracy of the playback frequency of 44.1KHz.
The above functions can be achieved with a minimum main frequency of 27MHz. After optimization through embedded assembly, the performance of the STC8A8K microcontroller is almost exhausted.
* 3. Describe the key points involved in the hardware and software parts of the work;
1. Use SPI to drive the TF card and implement a self-written FAT16 read-only file system
. I have tried to use FATFS, but it cannot achieve continuous streaming. I have implemented a dedicated self-read FAT16 file system.
2. Use ordinary IO software to simulate and implement the I2S interface (44.1K dual-channel 16bit)
3. Use software interrupt technology (software triggers unused hardware low-voltage interrupt LVD to fill the playback data stream in the interrupt service program).
4. The microcontroller and DA use independent LOD power supplies and solid-state capacitors.
* 4. List of materials for the work;
see the attachment "BOM\_LiChuang Electronic Design Competition (WAV player based on STC8A)\_20190907140659"
5. Upload pictures of the work; (The PCB must have the competition logo and take a photo and upload it. If not, it will be deemed as giving up the competition)
![Photo of the actual WAV player based on STC8A.jpg]

6. Demonstrate your work and record it into a video and upload it; (The video content must include: work introduction; function demonstration; performance test; close-up of the competition logo on the PCB. If not, it will be deemed as giving up the competition)
See the attachment "WAV player explanation V2_rotated"
7. Open source documents.
See the attachment "wavplayer\_20190608es9023p\_v4\_tiny"