please dont rip this site

SX MultiMediaCard (MMC) Interface

Introduction

This application note presents programming techniques for reading and writing via a simple three-pin SPI interface (and optional fourth pin card select output) to an external MMC card. The MMC is ideal for small form-factor applications because it is less than half the size of a regular half-size PCMCIA card such as compactflash and can contain up to 64Meg of data and is removable, stackable and PC configurable.

In this implementation, the data stored on the MMC is streamed into the SX using a circular buffer and sent out as a mono or stereo audio signal through a pair of pulse-width-modulated (PWM) outputs. The hardware also offers the option of reading an incoming audio signal using a sigma-delta analog-to-digital converter which uses the same PWM output RC network in reverse and converts the incoming analog (audio) signal to a bitstream input.

How the circuit and program work

The analog output circuit is a simple resistor capacitor network on each PWM port pin. This RC combination acts as a digital-to-analog (D/A) output by integrating the changing bitstream signal coming from the SX. The output is then AC-coupled to provide an AC audio signal output.

The interrupt code segment contains both the ADC input and PWM output code segments, as well as a circular buffer that is filled with data from the MMC streaming in through a main-line MMC block read subroutine via the SPI port pins. The main line code also contain an MMC command interpreter subroutine that performs all required functions for accessing the MMC, such as initialization, reading, writing, etc.

A circular buffer is required because the MMC can only be read in block read mode of 512 bytes per block when using the SPI protocol to access the card. Therefore, data from an entire block cannot be stored on the card. With an oscillator frequency of 50MHz, the SPI bit-read loop is optimized to 9 cycles, permitting a read transfer rate of slightly over 600k bytes/sec. Data is read in considerably faster than it is output to the PWMs, however there are significant delays between blocks while reading the CRC bytes and setting up the next block, etc. The buffer allows for a streamlined synchronous output through the PWM with the aid of a frequency timer virtual peripheral in the interrupt code loop. The timer triggers at a fixed interval which is the sample output rate. Upon each trigger, the next data byte is fed from the circular buffer to the PWM output.

As for using the RC networks as ADC inputs, this is described in a separate application note and should be referenced in conjunction with the frequency limitations. This method for D/A and A/D conversion is effective for signals whose highest frequency component is lower than half of the lowest frequency possible by the PWM virtual peripheral. The sample output period of the PWM cycle (in turbo mode) is calculated as follows:

period (sec) = prescaler * RETIW value / osc. frequency

So, for an 8-bit output signal, the PWM needs up to 256 interrupt passes to completely settle to the intended voltage. At a crystal frequency of 50 MHz, with a prescaler of 1, and with an RETIW value of 46, the highest frequency possible by the PWM output is:

frequencypwm = 1 / period * 256 *2 = 50 MHz / (1 * 46 * 256 ) = 4.25 kHz

By this we can also see that the ADC will be able to monitor signals at or below fadc_max @ 3kHz (since the interrupt period is increased by 20 if the ADC is added). At frequencies above these, not only will the PWM and ADC begin to provide inaccurate information, but there will also be increasing switching noise in the circuit.

Since timing is critical for accurate readings, all efforts should be made to make sure that any code executed in the interrupt prior to the ADC code section maintains a uniform execution rate at all times.

The RC network on each analog input/output pin also acts as a low pass filter with a corner frequency of 3.4kHz (R=4.7KW, C=0.01uF). This has been optimized to help reduced the high frequency noise generated by the bitstream switching and the single bit resolution voltage steps. The additional capacitor on each audio output acts a high pass filter and also converts the outgoing signal from DC to AC.

Modifications and further options

With some programming, the SPI and MMC command interpreter subroutines could be changed and the MMC could then be accessed in MMC mode (for SanDisk MMC). This mode would then allow data streaming for read/write operations which would remove the limitations of the block transfers.

More of the MMC functions may be implemented in the command interpreter subroutine and then accessed accordingly. Only the most obvious ones have been implemented here.

The fourth MMC interface pin is to power down the card when it is not in use. If this power saving feature is not required. This pin on the MMC may be tied directly to Vdd freeing up an extra port pin on the SX.



 

Bill of Materials:

MMC plug-in SX Experimentor

Jun-00

 

Rev. 1.2A

 

Qty

Ref. #

Part #

Manufacturer

Description

Supplier

Phone #

Cost

Total

1

MMC

MMC-4/16/32

SanDisk

Sandisk MultiMediaCard

SanDisk

408-548-0137

?

 

1

IC1

74HC125M

Any

SOT-8 quad tri-state buffer

Digikey#TC74HC125AFN-ND

800-344-4539

0.56

0.56

2

J1

1393635-2

Amp

MMC SMT socket (non-stackable)

Amp

800-522-6752,#4

?

 

1

R1-3

P220KGCT-ND

Any

220ohm SMT-0603 resistor

Digikey

800-344-4539

0.076

0.076

2

LED1

ZMG53W

SunLED

green LED, SMT-0603

SunLED

852-345-0021

0.12

0.24

1

LED2

ZUR53W

SunLED

yellow LED, SMT-0603

SunLED

852-345-0021

0.12

0.12

2

LED3-4

ZMR53W

SunLED

red LED, SMT-0603

SunLED

852-345-0021

0.12

0.24

1

J2

S2012-02-ND/A1911-ND

Any

2-pin header

Digikey

800-344-4539

0.11

0.11

1

shunt

929950-00-ND

3M (any)

.100 shorting shunt (2-pin female)

Digikey

800-344-4539

0.1

0.1

1

PCB

Any

Printed Circuit Board

Alberta Printed Circuits

403-250-3406

?

 

Total:

0.676

 

Bill of Materials:

SX Audio Plug-in DSP Experimentor

Jun-00

 

Rev. 1.0a

 

Qty

Ref. #

Part #

Manufacturer

Description

Supplier

Phone #

Cost

Total

1

IC1

TLV2451CDB

Texas Instr.

Low-power quality SOT-23 op-amp

Newark (Allied Elec.:800-433-5700)

408-988-7300

1

1

2

J2,J3

981

Keystone

3.5 mm SMT stereo (mono=#983) phono jack

Keystone

800-221-5510

0.8

1.6

1

J1

S2012-06-ND

Any

6-pin header

Digikey

800-344-4539

0.35

0.35

1

R2

317-2091-1M

Panasonic/Any

1M trimmer thruhole pot with knob

Mouser (Digikey#P3Q6105-ND)

800-346-6873

0.9

0.9

1

R1

P10KGCT-ND

Any

10Kohm SMT-0603 resistor

Digikey

800-344-4539

0.076

0.076

2

C1,2

100R15X105MV4

Any

1uF SMT-0805 metal film capacitor

Johanson

818-364-6100

0.59

1.18

2

C1,2

100R15X103MV4

Any

.01uF SMT-0805 metal film capacitor

Johanson (Digikey#PCF1076-CT)

818-364-6100

0.042

0.084

1

MIC1

P9970-ND

Any

Piezo-electric through-hole microphone

Digikey

800-344-4539

0.9

0.9

1

PCB

Any

Printed Circuit Board

Alberta Printed Circuits

403-250-3406

?

 

Total:

5.09

 

Questions:


file: /Techref/scenix/contest/52wavmmc.htm, 20KB, , updated: 2010/2/4 23:51, local time: 2024/12/23 01:00, owner: kan-MMM-UA4,
TOP NEW HELP FIND: 
3.147.77.51:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://sxlist.com/Techref/scenix/contest/52wavmmc.htm"> Ubicom SX52 MultiMediaCard (MMC) FLASH memory Interface</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to sxlist.com!


Site supported by
sales, advertizing,
& kind contributors
just like you!

Please don't rip/copy
(here's why

Copies of the site on CD
are available at minimal cost.
 

Welcome to sxlist.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .