Chapter 9 Rapid GPIO (RGPIO)

 

align

16

 

 

00510: 4fef fff4

send_16b_spi_message_rgpio:

# allocate stack space

lea

-12(%sp),%sp

00514: 48d7 008c

movm.l

&0x8c,(%sp)

# save d2,d3,d7

00518: 3439 0080 0582

mov.w

RAM_BASE+message2,%d2

# get 16-bit message

0051e: 760f

movq.l

&15,%d3

#

static shift count

00520: 7e10

movq.l

&16,%d7

#

message bit length

00522: 207c 00c0 0003

mov.l

&RGPIO_DATA+1,%a0

#

pointer to low-order data byte

00528: 203c 0000 ffff

mov.l

&0xffff,%d0

#

data value for _ENB and _DIR regs

0052e: 3140 fffd

mov.w

%d0,-3(%a0)

#

set RGPIO_DIR register

00532: 3140 0001

mov.w

%d0,1(%a0)

#

set RGPIO_ENB register

00536: 223c 0001 0000

mov.l

&0x10000,%d1

#

d1[17:16] = {clk, cs}

0053c: 2001

mov.l

%d1,%d0

#

copy into temp reg

0053e: e6a8

lsr.l

%d3,%d0

#

align in d0[2:0]

00540: 5880

addq.l

&4,%d0

#

set clk = 1

00542: 1080

mov.b

%d0,(%a0)

# initialize data

00544: 6002

bra.b

L%1

 

 

 

align

4

 

 

00548: 3202

L%1:

%d2,%d1

# d1[17:15] = {clk, cs, data}

mov.w

0054a: 2001

mov.l

%d1,%d0

# copy into temp reg

0054c: e6a8

lsr.l

%d3,%d0

# align in d0[2:0]

0054e: 1080

mov.b

%d0,(%a0)

# transmit data with clk = 0

00550: 5880

addq.l

&4,%d0

# force clk = 1

00552: e38a

lsl.l

&1,%d2

# d2[15] = new message data bit

00554: 51fc

tpf

 

# preserve 50% duty cycle

00556: 51fc

tpf

 

 

 

00558: 51fc

tpf

 

 

 

0055a: 51fc

tpf

%d0,(%a0)

# transmit data with clk = 1

0055c: 1080

mov.b

0055e: 5387

subq.l

&1,%d7

# decrement loop counter

00560: 66e6

bne.b

L%1

 

 

00562: c0bc 0000 fff5

and.l

&0xfff5,%d0

# negate chip-select

00568: 1080

mov.b

%d0,(%a0)

# update gpio

0056a: 4cd7 008c

movm.l

(%sp),&0x8c

# restore d2,d3,d7

0056e: 4fef 000c

lea

12(%sp),%sp

# deallocate stack space

00572: 4e75

rts

 

 

 

Figure 9-11. GPIO SPI Code Example

The resulting SPI performance, as measured in the effective Mbps transmission rate for the 16-bit message, is shown in Table 9-12.

Table 9-12. Emulated SPI Performance using GPIO Outputs

Peripheral Bus-mapped GPIO

RGPIO

 

 

 

 

 

SPI Speed @

Relative

SPI Speed @

Relative

CPU f = 50 MHz

Speed

CPU f = 50 MHz

Speed

 

 

 

 

2.063 Mbps

1.00x

3.809 Mbps

1.29x

 

 

 

 

MCF51QE128 MCU Series Reference Manual, Rev. 3

Freescale Semiconductor

205

Get the latest version from freescale.com

Page 205
Image 205
Freescale Semiconductor MCF51QE128RM Emulated SPI Performance using Gpio Outputs, SPI Speed @ Relative CPU f = 50 MHz, 29x