Cc256x vs hci commands – texas instruments wiki gas outage

##

Bluetooth systems consists of a host and a controller. The BT SIG has created a standard protocol for the host to communicate with the controller. This is called the Host Controller Interface (HCI) which is specified in the BT Core 4.1 specification Volume 2 Part E. The HCI provides a uniform command interface to a Controller. There are some commands which are not listed in the specifications and they are specific to the device itself. These commands are vendor-specific commands (VS) generally used for testing and debugging purposes. For further details on testing command sequences, refer to CC256x Testing Guide.

Most of the HCI packets consist of command packets. The host sends these command packets according to the structure detailed in the tables below and the controller sends responses through event packets back to the host. Command packets are used to configure many aspects of the Bluetooth system ranging from the link layer to the baseband layer.

HCI_VS_Write_CODEC_Config (0xFD06) Clock rate, Clock direction, Frame-sync frequency, Frame-sync duty cycle, Frame-sync edge, Frame-sync polarity, Reserved, Channel 1 data out size, Channel 1 data out offset, Channel 1 data out edge, Channel 1 data in size, Channel 1 data in offset, Channel 1 data in edge, Reserved, Channel 2 data out size, Channel 2 data out offset, Channel 2 data out edge, Channel 2 data in size, Channel 2 data in offset, Channel 2 data in edge, Reserved

The PCM clock rate in KHz. Valid values are between 64K to 4096K (for master mode) or 64K to 16M (for slave mode). It influences other parameters such as wait cycles and frequency rate calculation and therefore must be configured even if an external clock is used.

HCI_VS_Write_CODEC_Config_Enhanced (0xFD07) Clock shutdown, Clock start, Clock stop, Reserved, Channel 1 data in order, Channel 1 data out order, Channel 1 data out mode, Channel 1 data out duplication, Channel 1 TX_dup_value, Channel 1 data quant, Reserved, Channel 2 data in order, Channel 2 data out order, Channel 2 data out mode, Channel 2 data out duplication, Channel 2 TX_dup_value, Channel 2 data quant, Reserved

This command enables an RF calibration run immediately or periodically. It defines the calibration procedures required to run each time the periodic calibration is run. In standby mode, when enabling the periodic run, the calibration should start the run immediately.

This command activates the internal software-based BER meter used in Production Line Test (PLT). The VS command controls the reception frequency and the packet/connection parameters. It turns on a continuous RX and triggers the BER meter into operation.

The command configure SCO/eSCO voice path to either PCM or HCI. Once this command is issued, it is valid for all the following SCO/eSCO channels going to be created. It is used to determine the following parameters: SCO connection type – Host or CODEC TX packet length that will be used for flow control calculations. TX buffer max latency that will determine the value of Latency_Thr that determines how much time data can be in the TX buffer before it is flushed out. This parameter is applicable only if flow control is disabled. If flow control is enabled, then the host is in charge to regulate the data flow to keep the latency within limits. Once this command is used, the next ‘Read Buffer Size Command’ will return the new buffer size and an appropriate number of buffers.

Some Bluetooth devices do not support the power control feature, which allows increasing or decreasing the transmitted power level of the other devices in the connection. This command lets the user set the power level to be used during such a connection, so that the fixed power does not compress the other receiver. This is done by selecting from the 16 available power levels. The device then transmits at this level all the time. This single power can be set per modulation scheme.

HCI_VS_A3DP_Codec_Configuration (0xFD8E) Audio Source, PCM input sample frequency, PCM number of channels, SBC input sample frequency, SBC channel mode, SBC number of blocks, SBC number of subbands, SBC allocation method, SBC bit pool low boundary, SBC recommended bit pull, SBC dynamic bit pull enable, Reserved, Reserved

The PCM sample frequency rate of the input PCM bus. This parameter is valid only when the audio source is the host. When this parameter is different from the SBC input sample frequency parameter the SARC will be used for sample rate conversion.

This command must be called when the A2DP SNK has moved to open state and has established the transport A2DP channel to open an A3DP entity in the controller. It contains the protocol parameters needed for L2CAP and AVDTP packet construction. SBC and SARC parameters are applied using the HCI_VS_A3DP_CODEC_CONFIGURATION command.

This command starts the A2DP data streaming to the remote device. The host should initiate PCM audio data right after this API call. When no PCM data is accepted at the controller after this command call, no data will be sent to the peer device.

This command stops the SBC data streaming to the remote device. An input parameter determines whether the current internal buffers should be transmitted to the remotes device(s) and then flushed (soft flush), or should be flushed immediately (hard flush). That option may be needed if the stream was stopped between songs for reconfiguration, so that the song ending should be heard by the user and not flushed. A VS event is generated at the completion of the operation, if requested.

This command configures the SBC decoder parameters. This command must not be called during streaming, meaning no stream has started using the start stream command. The command refers to stream. Note that in addition to that API calls, the controller PCM codec must also be configured using the HCI_VS_Write_CODEC_Config and HCI_VS_Write_CODEC_Config_Enhanced commands.

This command must be called when the A2DP SRC has moved to open state and has established the transport A2DP channel to open an A3DP entity in the controller. It contains the protocol parameters needed for L2CAP. SBC parameters are applied using the HCI_VS_A3DP_SNK_CODEC_CONFIGURATION command.