ADSP-BF59x Blackfin Processor Hardware Reference
12-51
Two Wire Interface Controller
Listing 12-2. Slave Mode Setup
#include <defBF527.h>
/*BF527 is used here as an example—change as appropriate.*/
#include "startup.h"
#define file_size 254
#define SYSMMR_BASE 0xFFC00000
#define COREMMR_BASE 0xFFE00000
.GLOBAL _main;
.EXTERN _TWI_ISR;
.section L1_data_b;
.BYTE TWI_RX[file_size];
.BYTE TWI_TX[file_size] = "transmit.dat";
.section L1_code;
_main:
/***********************************************************
TWI Slave Initialization subroutine
***********************************************************/
TWI_SLAVE_INIT:
/***********************************************************
Enable the TWI controller and set the Prescale value
Prescale = 10 (0xA) for an SCLK = 100 MHz (CLKIN = 50MHz)
Prescale = SCLK / 10 MHz
P1 points to the base of the system MMRs
P0 points to the base of the core MMRs
***********************************************************/
R1 = TWI_ENA | 0xA (z);
W[P1 + LO(TWI_CONTROL)] = R1;
/***********************************************************
Slave address
program the address to which this slave will respond to.
this is an arbitrary 7-bit value
***********************************************************/
R1 = 0x5F;
Summary of Contents for ADSP-BF59x Blackfin
Page 64: ...Development Tools 1 22 ADSP BF59x Blackfin Processor Hardware Reference...
Page 74: ...Processor Specific MMRs 2 10 ADSP BF59x Blackfin Processor Hardware Reference...
Page 244: ...Programming Examples 6 40 ADSP BF59x Blackfin Processor Hardware Reference...
Page 700: ...Programming Examples 16 78 ADSP BF59x Blackfin Processor Hardware Reference...
Page 738: ...Boundary Scan Architecture B 8 ADSP BF59x Blackfin Processor Hardware Reference...