Programming Examples
13-46
ADSP-BF59x Blackfin Processor Hardware Reference
P0.L = lo(SPI_RDBR);
R0 = W[P0] (z); /* Dummy read of SPI_RDBR kicks off transfer */
Post Transfer and Next Transfer
Following the transfer of data, the SPI generates an interrupt, which is ser-
viced if the interrupt is enabled during initialization. In the interrupt
routine, software must write the next value to be transmitted prior to
reading the byte received. This is because a read of the
SPI_RDBR
initiates
the next transfer.
Listing 13-3. SPI Interrupt Handler
SPI_Interrupt_Handler:
Process_SPI_Sample:
P0.H = hi(SPI_TDBR);
/* SPI transmit register */
P0.L = lo(SPI_TDBR);
R0 = W[P1++](z);
/* Get next data to be transmitted */
W[P0] = R0.l;
/* Write that data to SPI_TDBR */
Kick_Off_Next:
P0.H = hi(SPI_RDBR);
/* SPI receive register */
P0.L = lo(SPI_RDBR);
R0 = W[P0] (z);
/* Read SPI receive register (also kicks off
next transfer) */
W[P2++] = R0;
/* Store received data to memory */
RTI;
/* Exit interrupt handler */
Stopping
In order for a data transfer to end after the user has transferred all data,
the following code can be used to stop the SPI. Note that this is typically
done in the interrupt handler to ensure the final data has been sent in its
entirety.
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...