Blackfin BF533 EZ-KIT Control The O in I/O - PowerPoint PPT Presentation

1 / 24
About This Presentation
Title:

Blackfin BF533 EZ-KIT Control The O in I/O

Description:

The O in I/O Activating a FLASH memory output line Part 3 New instruction recap Tutorial Blackfin BF533 I/O * Agenda Processors need to send out control ... – PowerPoint PPT presentation

Number of Views:38
Avg rating:3.0/5.0
Slides: 25
Provided by: Micha591
Category:

less

Transcript and Presenter's Notes

Title: Blackfin BF533 EZ-KIT Control The O in I/O


1
Blackfin BF533 EZ-KIT ControlThe O in I/O
  • Activating a FLASH memory output linePart 3
    New instruction recap Tutorial

2
Agenda
  • Processors need to send out control signals (high
    / low 1 / 0 true / false)
  • General purpose input / output GPIO on processor
    chip (16)
  • FLASH memory chip has additional I/O ports
    connected to Ez-Lite KIT LEDs
  • Making the FLASH memory I/O port control the
    Ez-KIT LEDs
  • The new Blackfin assembly language instructions
    needed

3
LEDs connected to FLASH port
BACKFORWARDRIGHTLEFT??? CONTROL ON Might be
connected to other thingsDONT CHANGEBEHAVIOUR
4
Activating LEDs -- REVIEW
SOME LAB. 1 FUNCTIONS ARE NOW IN C
  • Get the FLASH to work correctly
  • InitFlashCPP( )
  • Get the Port to work correctly as output for pins
    PB5 ? PB0, leaving other pins unchanged
  • InitFlashPortCPP( )
  • Write the value we want to LEDs
  • WriteFlashLEDASM( int value)
  • Read back the value the LEDs show
  • int ReadFlashLEDASM( )

5
Blackfin Memory Map
  • If P0 is 0x20001000thenR0 P0 readsa
    value fromFLASH BANK 0
  • If R0 is 6 andP0 is 0x1000 thenP0 R0
    placesa value intoSDRAM

6
InitFlashCPP( ) -- REVIEW
SOME LAB. 1 FUNCTIONS ARE NOW IN C
  • Get the FLASH to work correctly
  • May be many processes running on the Blackfin.
    All these processes may want to use InitFlashCPP(
    )
  • InitFlashCPP( )
  • If FLASH memory already configured
    return without initializing
  • Else
  • configure Memory Bank control
    register
  • THEN configure Global control
    (turns on the FLASH)

7
Set the Bank control register
  • Kit documentation recommends 0x7BB0

7 cyclesnot 15 11 not 15 B 1011 2 cycles 3
cycles
IGNORE 4 cycles
8
Set General Control Register
  • Documentation says set to 0xF for this
    particular FLASH chip

ENABLE ALL
9
Key issues -- REVIEW
SOME LAB. 1 FUNCTIONS ARE NOW IN C
  • InitFlashCPP( )
  • Does not sound too big a deal
  • Set pointer to EBIU_AMBCTLO
  • Then value 0x7BB07BB0
  • Then use pointer value
  • Then make sure write occurs NOW as this
    processor can delay doing writes until
    convenient
  • Do the same for the other 32 bit registers

10
Obvious problem value needed EBIU_AMBCTL0 ?
Code review2 obviouserrors SAME ERRORS ARE
POSSIBLE IN C VERSION
11
Corrected code still fails
No in a define statement No spaces in
number Spell check 0 not O DEFECTS in code
process Pair programming cost 3 5
12
MIPS and Blackfin behave same
  • You cant load a 32-bit register with a 32-bit
    immediate value using one instruction
  • WRONG R0 0x7BB07BB0
  • Must load low 16-bit of register R0.L
    0x7BB0
  • Then load high 16-bits of register R0.H
    0x7B00
  • You handle P0 0xFFC00A04
  • REMEMBER C can introduce similar errors, but
    with different detail

13
More readable code
Selfdocumenting code I do defineand then
cut-and-pastethe label
14
WriteFlashLEDASM(long in_value)
STILL IN BF533 ASSEMBLY CODE
  • Write 1 (on) or 0 (off) to the Port to
    activate LEDs connected to pins PB5 ? PB0,
    leaving other pins unchanged.

15
WriteFlashLEDASM(long in_value)
STILL IN BF533 ASSEMBLY CODE
  • Read LED data register into processor data
    register (makes a copy)
  • Keep top 2 bits (AND operation) of copy
  • Keep bottom 6 bits of in-par 32-bit in_value
  • OR the two processor data registers
  • Write modified copy back into LED data
    register
  • PROBLEM byte read and writes

16
Now identify the registers to use
STILL IN BF533 ASSEMBLY CODE
  • In_par is in R0
  • We can use R1, R2 and R3 without saving registers
    to the stack

17
Add in the code we understand
STILL IN BF533 ASSEMBLY CODE
Fixed typo Still anothersyntaxproblem
18
8 bit and 32 bit writes
  • P0 R0 32-bit write (4 bytes)
  • Places all 32-bits of processor data register
    into long word (32 bit) address starting at
    memory location P0
  • If P0 0x1000 then place 32-bit value at
    memory location 0x1000
  • BP0 R0 8-bit write
  • Places bottom 8-bits of processor data register
    into byte (8 bit) address starting at memory
    location P0

19
8 bit and 32 bit reads
  • R0 P0 32-bit read (4 bytes)
  • Places all 32-bits of long word (32 bit)
    address starting at memory location P0 into
    processor data register
  • If P0 0x1000 then place 32-bit value at
    memory location 0x1000
  • R0 BP0 (Z) 8-bit read
  • Places byte (8 bit) address starting at memory
    location P0 into bottom 8-bits of processor
    data register and puts 0 into the top 24 bits
    of register
  • Must convert 8-bit read operation into a 32
    bit store in register operation

20
Add byte read and write operations
Is this correct for keeping top 2 bits of an
8-bit value? DEFECT if not corrected Still
syntaxproblems ERRORS Fix as exercise
21
InitFlashPortCPP() to complete
NOW IN C
  • Set direction to 1 on lower pins leaving other
    direction values unchanged around 12 lines Read
    direction byte register into processor data
    register (makes a copy)
  • Set another processor data register to 0x3F
  • OR the two data registers (HOW?)
  • Write modified copy back into direction byte
    register

22
InitFlashCPP( ) -- Exercise
  • InitFlashCPP( )
  • If FLASH memory already configured
    return without initializing
  • Else
  • configure Memory Bank control
    register
  • THEN configure Global control
    (turns on the FLASH)
  • -- 21 instructions many
    cut-and-paste-modify

IF CLOCK ACTIVATED THEN ASSUME ANOTHER PROCESS
HAS ALREADY SET THE FLASH AND on BIT 0 of
EBIU_AMGCTL register followed by IF set then
JUMP
23
  • Work in pairs for the solutions
  • These exercises will form part of take-home quiz
    1
  • IF-THEN-ELSE SYNTAX
  • Do bits 7 to 4 of register R0 contain 12???
  • R0 ????
  • R1 0x000000F0 // MASK
  • R2 0x000000C0 // Expected value
  • R1 R0 R1 // KEEP old value
  • CC R1 R2 // Check to see if 12 is
    there
  • IF CC JUMP IS_TRUE
  • IF !CC JUMP IS_FALSE

24
This slide is not in the course notes
25
This slide is not in the course notes
26
This slide is not in the course notes
27
Agenda
  • Processors need to send out control signals (high
    / low 1 / 0 true / false)
  • General purpose input / output GPIO on processor
    chip (16)
  • FLASH memory chip has additional I/O ports
    connected to Ez-Lite KIT LEDs
  • Making the FLASH memory I/O port control the
    Ez-KIT LEDs
  • The new Blackfin assembly language instructions
    needed
Write a Comment
User Comments (0)
About PowerShow.com