Serial manager and FSCI configuration
For creating an embedded application that communicates with the Bluetooth Low Energy Host Stack using the serial interface, the following steps must be done:
Serial manager initialization
The function that must be called for Serial Manager initialization is located in SerialManager.h:
/* Init serial manager */
SerialManager_Init();
Parent topic:Serial manager and FSCI configuration
FSCI configuration and initialization
By default, the FSCI module is disabled. It must be enabled by setting gFsciIncluded_c
to 1
. Also, gFsciLenHas2Bytes_c
must be set to 1
because Bluetooth Low Energy Host Stack interface commands and events need serial packets bigger than 255 octets.
For more information on the following configuration parameters, refer to the FSCI chapter of the Connectivity Framework Reference Manual.
To configure the FSCI module, the following parameters can be set on both the Bluetooth Low Energy Application project and the Bluetooth Low Energy FSCI blackbox:
/* Enable/Disable FSCI */
#define gFsciIncluded_c 1
/* Enable/Disable FSCI Low Power Commands*/
#define gFSCI_IncludeLpmCommands_c 0
/* Defines FSCI length - set this to FALSE is FSCI length has 1 byte */
#define gFsciLenHas2Bytes_c 1
/* Defines FSCI maximum payload length */
#define gFsciMaxPayloadLen_c 1660
/* Enable/Disable Ack transmission */
#define gFsciTxAck_c 0
/* Enable/Disable Ack reception */
#define gFsciRxAck_c 0
/* Enable FSCI Rx restart with timeout */
#define gFsciRxTimeout_c 1
#define mFsciRxTimeoutUsePolling_c 1
/* Use Misra Compliant version of FSCI module */
#define gFsciUseDedicatedTask_c 1
/* FSCI task size */
#if defined(DEBUG)
#define gFsciTaskStackSize_c 4600
#else
#define gFsciTaskStackSize_c 2600
#endif
To perform the FSCI module initialization, the following code can be used:
/* Define fsci serial manager handle */
#if defined(gFsciIncluded_c) && (gFsciIncluded_c > 0)
extern serial_handle_t g_fsciHandleList[gFsciIncluded_c];
#endif /*gFsciIncluded_c > 0*/
void BluetoothLEHost_AppInit(void)
{
/* Init FSCI */
FSCI_commInit( g_fsciHandleList );
/* Register BLE handlers in FSCI */
fsciBleRegister(0);
...
}
Parent topic:Serial manager and FSCI configuration
FSCI handlers (GAP, GATT, and GATTDB) registration
For receiving messages from all the Bluetooth Low Energy Host Stack serial interfacing layers (GAP, GATT, and GATTDB), a function handler must be registered in FSCI for each layer:
fsciBleRegister(0);
Parent topic:Serial manager and FSCI configuration
Parent topic:Creating a Bluetooth LE application when the Host Stack runs on another processor