Bosch XDK110 Getting Started page 17

Cross-domain development kit
Hide thumbs Also See for XDK110:
Table of Contents

Advertisement

Extension Bus Advanced Guide | XDK110
Code 16 shown an example of the first configuration of SPI with the
Code 16. SPI Extension Bus configuration
BSP_ExtensionPort_Connect();
BSP_ExtensionPort_ConnectSpi();
BSP_ExtensionPort_SetSpiConfig(BSP_EXTENSIONPORT_SPI_BAUDRATE, UINT32_C(2000000), NULL);
BSP_ExtensionPort_SetSpiConfig(BSP_EXTENSIONPORT_SPI_MODE, BSP_EXTENSIONPORT_SPI_MODE0,
NULL);
BSP_ExtensionPort_SetSpiConfig(BSP_EXTENSIONPORT_SPI_BIT_ORDER,
BSP_EXTENSIONPORT_SPI_MSB_FIRST, NULL);
BSP_ExtensionPort_Connect()
First, the function
disable all pins on the Extension Bus. Afterwards, the function
PB4, PB3 and PB5 on the Extension Bus to be used as MISO, MOSI and Clock pins.
BSP_ExtensionPort_SetSpiConfig()
Afterwards,
order. As for this outline, a baud rate of 9600, the SPI mode 0 and the bit order with the most significant bit first is chosen.
Now the initialization of the SPI module at the driver level can begin. For that, a global variable of the type
SemaphoreHandle_t
as shown in Code 17 need to be declared.
Code 17. Global variables for the SPI module initializaton
HWHandle_T
SpiHandle = NULL;
static
SemaphoreHandle_t
The global variable of the type
global variable of the type
Afterwards, the implementation of the function callback for the SPI initialization can begin. For that, a callback function as
shown in Code 18 is used.

spiCompleteSync = NULL;
HWHandle_t
will be used to store all SPI related configuration and initialization data. The
SemaphoreHandle_t
will be used for the control logic for sending and receiving data.
BSP_ExtensionPort.h
is called to enable the power control on the Extension Bus and to
BSP_ExtensionPort_ConnectSpi()
is called to configure the baud rate, the SPI mode and the SPI bit
17 24
.
configures the SPI pins
HWHandle_T
|
and

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents