Atmel AT85C51SND3B User Manual

AT85C51SND3B Firmware
..............................................................................................
User’s Guide
Section 1
Introduction ........................................................................................... 1-1
Section 2
Firmware Features................................................................................ 2-3
2.1.1 Features .............................................................................................2-3
2.1.2 Configuration ......................................................................................2-3
2.2 Device USB...............................................................................................2-3
2.2.1 Features .............................................................................................2-3
2.2.2 Configuration ......................................................................................2-4
2.3 Host USB ..................................................................................................2-4
2.3.1 Features .............................................................................................2-4
2.3.2 Configuration ......................................................................................2-4
2.4 Audio Player..............................................................................................2-4
2.4.1 Features .............................................................................................2-4
2.4.2 Configuration ......................................................................................2-5
2.5.1 Features .............................................................................................2-5
2.5.2 Configuration ......................................................................................2-5
2.6 Image Viewer ............................................................................................2-5
2.6.1 Features .............................................................................................2-5
2.6.2 Configuration ......................................................................................2-5
2.7 Settings .....................................................................................................2-5
2.7.1 Features .............................................................................................2-6
2.7.2 Configuration ......................................................................................2-6
2.8 Update ......................................................................................................2-6
2.8.1 Features .............................................................................................2-6
2.8.2 Configuration ......................................................................................2-6
2.9 File System ...............................................................................................2-6
2.9.1 Features .............................................................................................2-6
2.9.2 Configuration ......................................................................................2-7
2.10 Nand Flash................................................................................................2-7
2.10.1 Features .............................................................................................2-7
2.10.2 Configuration ......................................................................................2-7
2.11 MMC® SD® Cards .....................................................................................2-7
2.11.1 Features .............................................................................................2-7
2.11.2 Configuration ......................................................................................2-8
2.12 Display ......................................................................................................2-8
AT85C51SND3Bx Firmware User’s Guide 1
7691A–MP3–08/07
Table of Contents
2.12.1 Features .............................................................................................2-8
2.12.2 Configuration ......................................................................................2-8
2.13 Keyboard...................................................................................................2-8
2.13.1 Features .............................................................................................2-8
2.13.2 Configuration ......................................................................................2-8
2.14 Power Manager.........................................................................................2-8
2.14.1 Features .............................................................................................2-8
2.14.2 Configuration ......................................................................................2-8
2.15 Clock Manager ..........................................................................................2-9
2.16 System ......................................................................................................2-9
2.16.1 Features .............................................................................................2-9
2.16.2 Configuration ......................................................................................2-9
Section 3
Source Files Organization .................................................................. 3-11
3.1 Directory Physical Structure....................................................................3-11
3.1.1 snd3b-dvk-x_y_z Directory ...............................................................3-11
3.1.2 _isp_modules Directory ....................................................................3-11
3.1.4 drivers Directory ...............................................................................3-12
3.1.5 lib_mcu Directory ..............................................................................3-12
3.1.6 lib_mem Directory.............................................................................3-13
3.1.7 lib_system Directory .........................................................................3-13
3.1.8 mmi Directory ...................................................................................3-13
3.1.10 Tools directory ..................................................................................3-14
3.2 Directories Logical Organization .............................................................3-14
Section 4
Code & Data Management ................................................................. 4-15
4.1 Principle ..................................................................................................4-15
4.1.1 Custom memory organisation...........................................................4-15
Section 5
Architecture......................................................................................... 5-21
5.1 Overview .................................................................................................5-21
5.2 Architecture .............................................................................................5-22
5.3 KERNEL..................................................................................................5-23
5.3.2 The Tasks.........................................................................................5-24
5.3.3 The Inter-Task Communication ........................................................5-24
5.3.4 MMI Manager task ............................................................................5-26
5.4 MMI Applications.....................................................................................5-28
5.4.1 Application IDs..................................................................................5-28
2 AT85C51SND3Bx Firmware User’s Guide
7691A–MP3–08/07
Table of Contents
5.4.2 Generic Modules ..............................................................................5-28
5.4.3 Useful Functions and Macro-functions .............................................5-29
5.4.4 Automatic Screen Refreshing...........................................................5-30
5.4.5 Automatic display .............................................................................5-31
5.4.6 Software Timers ...............................................................................5-31
5.4.7 Keyboard Management ....................................................................5-32
5.5 Services ..................................................................................................5-34
5.5.1 Player service ...................................................................................5-34
5.5.2 Recorder Service ..............................................................................5-35
5.5.3 Explorer service ................................................................................5-35
5.5.4 Ebook service ...................................................................................5-36
5.6 Modules ..................................................................................................5-37
5.6.1 USB Interface ...................................................................................5-37
5.6.2 Player Interface ................................................................................5-38
5.6.3 Recorder Interface ............................................................................5-39
5.6.4 Viewer Interface................................................................................5-40
5.6.6 Explorer Interface .............................................................................5-41
5.6.7 Update Interface ...............................................................................5-42
5.7 Debug trace text......................................................................................5-43
Section 6
Firmware Configuration ...................................................................... 6-45
6.1 Overview .................................................................................................6-45
6.2 Configuration Files ..................................................................................6-47
6.2.1 Control Access .................................................................................6-47
6.2.2 Audio Features .................................................................................6-47
6.2.3 Clock.................................................................................................6-49
6.2.4 File System.......................................................................................6-49
6.2.5 Setting ..............................................................................................6-50
6.2.6 Keyboard ..........................................................................................6-50
6.2.7 LCD Display......................................................................................6-53
6.2.8 MMC / SD Card ................................................................................6-54
6.2.9 MMI Applications ..............................................................................6-55
6.2.10 Nand-Flash Memory .........................................................................6-56
6.2.11 Power Management .........................................................................6-56
6.2.12 Scheduler module.............................................................................6-57
6.2.13 USB Module .....................................................................................6-58
6.2.14 Firmware update...............................................................................6-59
AT85C51SND3Bx Firmware User’s Guide 3
7691A–MP3–08/07
Section 1

Introduction

The AT85C51SND3Bx is a low power single-chip highly-integrated digital audio decoder/encoder for applications such as audio players, recorders, cell phones, toys…
The AT85C51SND3Bx MP3 Player firmware is part of the AT85DVK-07 development kit or th e AT8 5 RF D- 07 ref er e nc e des i gn ded i ca te d to t he AT 8 5C 51 SN D3 Bx microcontroller.
This document is the User’s Guide of the AT85C51SND3Bx MP3 Player firmware.
The topics covered are:
the functional features and options that the firmware brings
how the firmware source code files are organized
the firmware architecture
how to configure the firmware
the MMI layer
The AT85C51SND3Bx firmware described in this document has been developed to run on the AT85DVK-07 as well as the AT85RFD-07.
For more information on the AT85DVK-07 development board, refer to the documents “AT85DVK-07 Hardware User’s Guide” and “AT85DVK-07 Demonstration Firmware User’s Manual”, available on the Atmel web site. For more information on the AT85RFD-07 development board, refer to the documents “AT85RFD-07 Hardware User’s Guide” and “AT85RFD-07 Demonstration Firmware User’s Manual”, available on the Atmel web site.
AT85C51SND3Bx Firmware User’s Guide 1-1
7691A–MP3–08/07
Section 2

Firmware Features

The following sections describe the AT85C51SND3Bx firmware features and options. Some of the firmware options are not supported by the AT85DVK-07 (e.g. image viewer) or by AT85RFD-07 (e.g. MMC support).

2.1 MMI Manager

2.1.1 Features Application management

2.1.2 Configuration Applications names

2.2 Device USB

2.2.1 Features USB 2.0, High and Full Speed Transfer

This module allows customers to easily develop their own MMI applications.
– execute
– kill
Mailbox management
– send command to system drivers
– get event from system drivers or MMI applications
– forward event to MMI applications
Software timers
Animated icons
MMI events creation
This module is the USB mass-storage driver.
Class provide : Mass Storage, HID, CDC.
Mass Storage Class :
– rate performance :
typical, 10MB/s read - 8MB/s write on NandFlash
up to 12MB/s on MMC V4 / SD / SD HC
– Supported hosts : Win XP, Win 2K, Mac OSx, Linux
– Secure disk option content through password management
AT85C51SND3Bx Firmware User’s Guide 2-3
7691A–MP3–08/07
Firmware Features

2.2.2 Configuration Connection Speed

– authorize high or full speed (depending on the host)
– authorize only full speed
enable/disable USB Class used (Mass Storage, HID, CDC)
USB device information (vendor ID, product ID, manufacturer name, ...)
– product name
– serial number
Class description (Class name, ...)
enable/disable Disk Password Management (for Mass Storage Class)

2.3 Host USB

This module is the USB host driver.

2.3.1 Features Reduced host implementation

USB 2.0 full speed transfer with USB device
USB class provide:
– HUB
– Mass-storage (e.g. Udisk, multi-card reader)
– HID
– CDC

2.3.2 Configuration enable/disable USB class supported

2.4 Audio Player

This module allows the end-user to play some audio stream.

2.4.1 Features Audio stream

– MP1, MP2, MP3
– WMA
– WAV (PCM, G711, G726)
Stream management
– play
– pause
– stop
– next track
– previous track
– fast Forward
– fast Rewind
– repeat A/B
– speed Adjust (MP1, MP2, MP3 only)
2-4 AT85C51SND3Bx Firmware User’s Guide
7691A–MP3–08/07
Stream Information
– synchronized play time
– bit rate
– sampling frequency
– number of channels
Tags
– ID3 v1.0, v1.1
– ID3 v2.2 and v2.3
Stereo volume control
Sound effects:
– bass boost
– spatial sound
Adjustable 3-band EQ
– Classic, Pop, Jazz, Rock…

2.4.2 Configuration DAC Output Selection

– internal
– external
Firmware Features
External DAC interface

2.5 Audio Recorder

2.5.1 Features Recording (codec G726)

2.5.2 Configuration line in gains (analog & digital)

2.6 Image Viewer

2.6.1 Features Supported Image Format:

2.6.2 Configuration None

This module allows the end-user to play and record audio streams.
Input line in and micro
micro gains (analog & digital)
This module allows the end-user to display images.
– BMP
– JPEG
Automatic Resize

2.7 Settings

AT85C51SND3Bx Firmware User’s Guide 2-5
This module allows the user to manage user data in the setting segment located in the customer or reserved data area of the Nand Flash.
7691A–MP3–08/07
Firmware Features

2.7.1 Features Management

– load
– save
– update from a file

2.7.2 Configuration Opened Settings structure content

Update file name

2.8 Update

This module allows the end-user to perform firmware update of its player.

2.8.1 Features Firmware, codecs, display, fonts update

No PC tool install required for end-user
Power failure resistant
Update file generated by the Atmel In System Programming tool

2.8.2 Configuration Enable/disable update module

Enable/disable update auto-start at power-up
If update auto-start is enable then configuration of “File Location” on Nand Flash or
MMC/SD card.
enable/disable file erase after update (always enable in case of update auto-start)

2.9 File System

This module allows management of the file system present in the Nand Flash memory the MMC/SD card, the USB host disk, or through SIO, SPI….

2.9.1 Features FAT12, FAT16, FAT32

ASCII and/or Unicode
More than one file/disk opened at a time
File management
– file information
– I/O access
– create
– copy
– paste
– delete
– rename
Directory management
– directory information
– enter
– go to root
– exit
2-6 AT85C51SND3Bx Firmware User’s Guide
7691A–MP3–08/07
– create
– delete
– rename
Disk management
– disk Information
– format: FAT12, FAT16, FAT32

2.9.2 Configuration Supported file systems

Maximum number of files to manage at same time
Cache optimization
Firmware Features

2.10 Nand Flash

This module is the Nand Flash memory library.

2.10.1 Features Support Nand Flash SLC small or large blocks (16KB or 128KB)

10MB read / 7MB write with 1 Nand Flash
Physical system area
– code with redundancy
– codecs with redundancy
– pictures
– fonts
Logical data area
– proprietary wear-levelling algorithm with ECC management
– settings segment: user reserved data
– secure disk segment: mass storage disk for Data disk security management
– data disk segment: mass storage disk

2.10.2 Configuration Nand Flash auto-detection (average performance)

Nand Flash part number (best performance)
Number of devices: 1, 2, 4

2.11 MMC® SD® Cards

This module is the memory card library.

2.11.1 Features MMC cards:

– V3 in 1-bit mode at 20 MHz
– V4 in 4-bit mode at 24 MHz
SD cards:
– SD 4-bit mode at 24 MHz
– SD HC 4-bit mode at 24 MHz
AT85C51SND3Bx Firmware User’s Guide 2-7
7691A–MP3–08/07
Firmware Features

2.11.2 Configuration Enable/disable

Bus format:
– automatic: depends on card type
– 1-bit

2.12 Display

2.12.1 Features

2.12.2 Configuration Interface configuration to fit display controller

2.13 Keyboard

2.13.1 Features Matrix choice leads to dedicated hardware schematic

2.13.2 Configuration Matrix size:

This module is the display management library.
– type: I80/6800
– timings
This module is the keypad driver.
Automatic event generation:
– key press
– key release
– key repeat
– key long press
– from 4 keys up to 12 keys
Keypad timings:
– debounce
– auto-repeat start
– auto-repeat interval
– long press

2.14 Power Manager

2.14.1 Features Dynamic power management

2.14.2 Configuration Power source:

This module is the system power driver.
Battery level information
Power on/off
– DC-DC, Regulator…
– voltage
Power off
2-8 AT85C51SND3Bx Firmware User’s Guide
7691A–MP3–08/07
Firmware Features

2.15 Clock Manager

This module is the system clock driver
Oscillator Frequency
Clock Type:
– crystal
– oscillator

2.16 System

2.16.1 Features Memory mapping configurable (code & data)

Code swap between SND3 and Nand Flash (use system area code)
Store a large constant data in the NandFlash (use system area font and display)

2.16.2 Configuration Memory mapping

Banking code space
AT85C51SND3Bx Firmware User’s Guide 2-9
7691A–MP3–08/07

3.1 Directory Physical Structure

The AT85C51SND3Bx MP3 player firmware source code is composed of several files. This section describes the directory organization of the firmware package.
Section 3

Source Files Organization

3.1.1 snd3b-dvk-x_y_z Directory

3.1.2 _isp_modules Directory

The snd3b-dvk-x_y_z directory contains the firmware package where x_y_z is the firm­ware version.
.................ISP files: codec, picture_, font
.............................................user’s system configuration files
.............................................user’s MMI peripherals high-level API source code
.............................................Atmel MCU peripherals drivers source code
.............................................Atmel high-level memory storage drivers source code
.............................................Atmel system services source code
.............................................user’s MMI applications source code
.............................................Atmel system modules source code
.............................................code hex and object files
.............................................Atmel firmware tools
.............................................versions history
.............................................Atmel system core configuration
.............................................end user license agreement
.............................................target code download tool for debug mode
.............................................the C language main() function of the firmware
.............................................peripherals option. Used as compilation switches
.............................................Keil project option file
.............................................player.uv2: Keil project file
.............................................basic description and basic getting started
The _isp_modules directory contains the files used for In System Programming.
................codec binary files
.............................................font binary files
.............................................pictures binary files
.............................................ISP tool project file
AT85C51SND3Bx Firmware User’s Guide 3-11
7691A–MP3–08/07
Source Files Organization
3.1.3 conf Directory The conf directory contains header files allowing user to configure the Atmel libraries. Its
content is detailed in Section 6.
............conf_access.h: configuration of the memory access interfaces
.............................................conf_audio.h: configuration of the audio part (HW and SW)
.............................................conf_clock.h: configuration of the oscillator frequency
.............................................conf_explorer.h: configuration of the FAT and the navigator
.............................................conf_kbd.h: configuration of the keyboard (HW and SW)
.............................................conf_lbd.h: configuration of the LCD (HW and SW)
.............................................conf_lbd.h: configuration of the SD/MMC interface
.............................................conf_mmi.h: configuration of the MMI behavior
.............................................conf_nf.h: configuration of the nand-flash
.............................................conf_power.h: configuration of power (HW and SW)
.............................................conf_scheduler.h: scheduling of the tasks
.............................................conf_update.h: configuration of the firmware upgrade
.............................................conf_usb.h: configuration of the USB interface

3.1.4 drivers Directory The drivers directory contains the user’s MMI peripherals high-level API source code.

.............................user’s external DAC drivers
.............................................user’s FM receiver drivers
.............................................user’s LCD display drivers
.............................................user’s high-level API source code to display MMI graphical objects

3.1.5 lib_mcu Directory The lib_mcu directory contains the AT85C51SND3Bx core and peripherals drivers

source code.
.....................Audio Processor driver
.............................................Clock Manager driver
.............................................Data Flow Controller driver
.............................................Interrupt controller driver
.............................................Keyboard drivers
.............................................Display interface driver
.............................................MultiMediaCard drivers
.............................................Nand Flash Controller driver
.............................................Power management driver
.............................................Parallel Slave Interface driver
.............................................Serial I/O port driver
.............................................Memory space management driver
.............................................Timers driver
.............................................Universal Serial Bus controller driver
.............................................WatchDog Timer driver
.............................................Generic macro-functions define to get rid of compiler specificities
.............................................Routines of debug trace and assert
.............................................Routines of debug trace and assert
.............................................AT85C51SND3Bx SFR registers description file
.............................................AT85C51SND3Bx SFR registers description file
.............................................Include file to enable and put traces
Note: mcu_drv.h file defines a list of masks related to peripherals controller and provides a list
of macro-functions that maps SFR and pages. The AT85C51SND3Bx implements a SFR pagination mechanism which allows mapping of high number of peripherals in the SFR space. Four pages are accessible through the PPCON register.
3-12 AT85C51SND3Bx Firmware User’s Guide
7691A–MP3–08/07
Source Files Organization

3.1.6 lib_mem Directory The lib_mem directory contains the Atmel high-level memory storage drivers source

code.
.....................MMC/SD memory card driver
.............................................Nand-Flash memory driver

3.1.7 lib_system Directory The lib_system directory contains the Atmel system service source code.

......................automatic display of time-depending graphical objects
.............................................code banking load & swap source code
.............................................inter-process communication library source code
.............................................memory manipulation routines
.............................................boot sequence source code
.............................................software timer library
.............................................unicode management library
.............................................miscellaneous C language manipulation routines

3.1.8 mmi Directory The mmi directory contains the user’s MMI application source code.

Note: This directory content may vary from reference-design firmware to development-kit
firmware.
.......................MMI module template
.............................................dummy application required for code banking mechanism
.............................................MMI equalizer control application
.............................................MMI file system explorer application
.............................................MMI games application
.............................................MMI default application
.............................................MMI display images (fonts & pictures)
.............................................MMI information & system status display application
.............................................MMI keyboard high-level driver
.............................................MMI lyrics display application
.............................................MMI mass-storage application
.............................................MMI audio player application
.............................................MMI playlist management application
.............................................MMI radio application
.............................................MMI recorder MMI control
.............................................MMI contextual menu application
.............................................MMI setting management module
.............................................MMI shared functions
.............................................MMI start-up application
.............................................MMI status control application
.............................................MMI firmware update application
.............................................MMI image viewer application
.............................................MMI volume control application
AT85C51SND3Bx Firmware User’s Guide 3-13
7691A–MP3–08/07
Source Files Organization
drivers directory
lib_system directory lib_mem directory
lib_mcu directory
modules directory
mmi directory
AT85C51SND3B chip
Customer MMI
firmware
Atmel System
firmware
3.1.9 modules directory The modules directory contains the Atmel system libraries source code.
...............audio controller library
.............................................memory access and data transfer libraries
.............................................FAT file system library
.............................................MMI manager library
.............................................audio player library
.............................................power management library
.............................................audio recorder library
.............................................firmware scheduler library
.............................................firmware update library
.............................................USB management library
.............................................Picture viewer library

3.1.10 Tools directory The tool directory contains the Atmel image converter as well as the project images.

.............MMI pictures and image converter tool
.............................................Windows® USB drive secure executable

3.2 Directories Logical Organization

This purpose of this view is to show the logical links between the directories.
These source file directories can be grouped into two firmware parts:
– the customer MMI firmware
– the Atmel system firmware
The customer MMI firmware is the code source you have to develop and customize from the software platform delivered with this package. Indeed, this layer is dedicated to inter­face the user with the high-level services provided by the Atmel core firmware and the AT85C51SNDA chip. See Firmware Architecture Section 5.
The Atmel system firmware is the code source you should not modify since this layer has been designed to provide full and high-performance services from a low cost chip. Only the configuration files are to set in order to configure this layer to your application requirements. See Firmware Configuration Section 6.
3-14 AT85C51SND3Bx Firmware User’s Guide
7691A–MP3–08/07
Section 4

Code & Data Management

4.1 Principle

4.1.1 Custom memory organisation

4.1.1.1 Rules xdata space size + code space size = 64KB – 512B
The SND3 chip permits:
to customise the memory organisation
to use a code swap feature (= code banking)
to store a large constant data in the NandFlash
Reminder: The C51 core use different memory space (code, data, xdata). The size of data space is 256B. The size of code space is limited at 64KB and xdata space is limited at 64KB.
The AT85C51SND3B chip uses a 64KB of RAM to store the data and code, this particu­larity permits to configure the memory size according to your needs.
code space size = code common size + code bank size*
AT85C51SND3Bx Firmware User’s Guide 4-15
7691A–MP3–08/07
Code & Data Management
64KB RAM
data
reserved
xdata
bank code
common code
256B
256B
Customizable
Customizable
Customizable
xdata space size, code common size and code bank size* shall be a modulo 512B.
Figure 4-1. Memory organisation
Note: *code bank size is optional, see “Code swap”
4-16 AT85C51SND3Bx Firmware User’s Guide
7691A–MP3–08/07
Code & Data Management
CODE_BANKING (ENABLED)
BANK_START_ADDRESS
= 64KB-512B-
XDATA_LENGTH
BankArea(0xC200,0xE5FF) PRINT(".\List\player.m51") RAMSIZE(256) DISABLEWARNING (15) BANK10(?CO?FILE(0xC200),?PR?ROUTINE?FILE,?PR?ROUTINE2?FILE) … BANK01(?CO?FILE2(0xC200),?PR?ROUTINE?FILE2,?PR?ROUTINE2?FILE2) OVERLAY( main!(?CO?MMI_LYRICS,…)) CODE( 0x0000-0xE5FF )
XDATA( 0x0000-0x17FF )
player.lin
BANK_START_ADDRESS
XDATA_LENGTH
64KB-512B-
XDATA_LENGTH
4.1.1.2 How to configure You must change the configuration in the « option.h » header file by defining following
constants:
XDATA_LENGTH
CODE_BANKING
BANK_START_ADDRESS
Note: There are no « code size » #define, because this one is automatically computed using
XDATA_LENGTH.
You must modify the UV2 project according to « option.h » header file;
Figure 4-2. options are in ‘Options for Target’ pop-up in Target tab
Figure 4-3. options are in ‘Options for Target’ pop-up in BL51 Misc tab (linker file
player.lin)
WARNING : At compile time, there are no automatic coherency check between « UV2 project option » and « option.h » (no error and no warning). The execution code may be corrupted if a difference exists.
AT85C51SND3Bx Firmware User’s Guide 4-17
7691A–MP3–08/07
Loading...
+ 43 hidden pages