Skip to main content

bluetooth.fifoinfo()

Returns information about the Bluetooth sub-system’s FIFOs

Availability

Device
Only available on the imp004m and imp006 (impOS 42)

Returns

Table — Bluetooth LE FIFO details

Description

This method returns information about the FIFOs used to communicate with a Bluetooth LE-enabled imp’s Bluetooth sub-system.

Note This method is of primary interest to customers working with the imp004m. The imp006 uses a dedicated UART for Bluetoothl; this UART is not exposed to Squirrel and is therefore not configurable by the application.

The call returns a table with the following keys:

  • rxfifo
  • txfifo
  • filteredfifo
  • advertfifo

The first two are related to the UART assigned for use by the bluetooth object when it is configured. filteredfifo and advertfifo are internal buffers whose sizes are chosen based on the UART RX FIFO size (set by the imp004m programmer before using Bluetooth; see bluetooth.open()).

Each of the above keys’ value is itself a table, with the following keys:

Key Value Type Description
size Integer The size of the FIFO in bytes
fill Integer The number of bytes the FIFO currently contains
highwatermark Integer The maximum number of bytes the FIFO has ever contained

On boot, the value of highwatermark will be reset to zero. It will also be reset to zero if the FIFO is resized. This value, together with fill, can be used to help you determine whether the Bluetooth LE FIFOs are correctly sized. For instance, an imp may receive many Bluetooth LE adverts from nearby devices, not only the one(s) it is interested in connecting to. Receiving an advert from a specific device is not deterministic but statistical, so a large FIFO may be required in order to guarantee the imp receives a sufficient volume of adverts to be reasonably certain it has seen (or not) an advert from the target device. However, too large a FIFO can cause memory and performance issues, so it is handy to be able to examine FIFO utilization during testing; bluetooth.fifoinfo() makes this possible.