ISD91200 Series Technical Reference Manual
Release Date: Sep 16, 2019
- 255 -
Revision 2.4
It can be seen from Figure 5-58 Byte Order in Memory that byte order for an array of bytes is different
than that of an array of words. Now consider if this data were to be sent to the SPI port; the user could:
3. Set TXBITLEN=8 and send data byte-by-byte SPI1_TX[0] = ucSPI_DATA[i++]
4. Set TXBITLEN=32 and send word-by-word SPI1_TX[0] = uiSPI_DATA[i++]
Both of these would result in the byte stream {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08} being
sent.
It would be common that a byte array of data is constructed but user, for efficiency, wishes to transfer
data to SPI via word transfers. Consider the situation of below figure where a int pointer points to the
byte data array.
0x05
0x08
0x07
0x06
0x01
0x04
0x03
0x02
0x08
0x05
0x06
0x07
0x04
0x01
0x02
0x03
0x20000000
0x20000004
0x20000008
0x2000000c
Byte0
Byte3
Byte2
Byte1
0x20000010
0x20000014
unsigned char ucSPI_DATA[]={0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08};
unsigned int *uiSPI_DATA = (unsigned int *)ucSPI_DATA[];
ucSPI_DATA[]
→
uiSPI_DATA[]
→
RAM Address
RAM Contents
[7:0]
[31:24]
[23:16]
[15:8]
APB Data Bus
Byte0
Byte3
Byte2
Byte1
Figure 5-59 Byte Order in Memory
Now if we set TXBITLEN=32 and sent word-by-word SPI1_TX0 = uiSPI_DATA[i++], the order
transmitted would be {0x04, 0x03, 0x02, 0x01, 0x08, 0x07, 0x06, 0x05}. However if we set
BYTEENDIAN=1, we would reverse this order to the desired stream: {0x01, 0x02, 0x03, 0x04, 0x05,
0x06, 0x07, 0x08}.
5.10.4.14
Byte Sleep Suspend
In master mode, if SPI1_CTL.BYTESLEEP is set to 1, the hardware will insert a suspend interval of
SPI1_CTL.SLEEP+2 serial clock periods between two successive bytes in a transfer word. Note that
the byte suspend function is only valid for 32bit word transfers, that is TXBITLEN=0x00.
SPICLK
MOSI
MISO
Tx0[30]
Tx0[24]
Tx0[23]
Tx0[22]
Tx0[16]
MSB
Tx0[31]
Rx0[30]
Rx0[24]
Rx0[23]
Rx0[22]
Rx0[16]
MSB
Rx0[31]
CLKP=0
CLKP=1
Byte
Sleep
1st Transfer Byte
2nd Transfer Byte
Byte
Sleep
Transfer Word
Figure 5-60 Byte Suspend Mode