You are here

SPI Frames

A frame is a single portion of data sent through SPI bus. Some of the DLN adapters support adjustable frame size. The frame data are transferred starting from the most significant bit and up to the least significant bit.

spi-frames.png

In case the frame size is set to 8 bits or less, only one byte is needed to store the frame data. If the frame size is lesser than 8 bits, the least significant bits of the byte will be transferred, while extra (most significant) bits will be discarded, regardless of their content. The DlnSpiMasterReadWrite() function can be called to transmit array of 8-bit and smaller frames.

In case a frame size is 9-16 bits, two bytes are needed to store the frame data. You can allocate an array of up to 128 16-bit integers. These integers must be stored inside the array in Little Endian format. This shouldn't cause a problem, since Little Endian format is used for data storage by most of modern computers. If the frame size is less than 16 bits, 2-byte integers will be used. The least significant bits of the integer will be transferred, while extra (most significant) bits will be discarded, regardless of their content.

The size of the frame does not limit the size of the buffer to be transferred. DlnSpiMasterReadWrite() (DlnSpiMasterReadWrite16()) function accepts buffer sizes of up to 256 bytes. You can call the function several times to send a larger buffer.

Splitting the data transfer into frames allows to set delays and configure SS line release between the frames. By default no delays are set and SS line remains asserted all the time.

Rating: 
Average: 3 (5 votes)

User login