www.beck-ipc.com

BT0x - Examples


     Documentation Index

Examples

Beck IPC provides several source code examples as templates for building own customized BT0x applications for the IPC@CHIP® targets SC1x3/SC2x and SC243.
For the modules BT03/4 the library version 1.04 (or higher) is required.
Applications compiled with earlier library versions needs to be recompiled with the new library.

The archive BT0x_Vxx.zip contains three different main folders:

DOC:
Contains this documentation.

Paradigm24 for SC1x3/SC2x:
In addition to the several examples, this archive also contains the subfolder BTLIB.
This directory provides at its subdirectories:
BT0x library btlib.lib
C-Header files

ONE-Workbench for SC243:
For IPC@CHIP® target SC243 the BTLIB library, header files and the documentation must be installed into the ONE-Workbench by using the "software update mechanism".
The "software update mechanism" of the ONE-Workbench is explained at the "Getting started document" of the DB240 evaluation board, available at BECK IPC download center.

Description:

  • BTDemo: Example for searching devices, services and connection establishing
  • BTDUN: Using the Dial-up-networking (DUN) profile
  • BTTerm: Terminal connection via Bluetooth
  • BTConnButton: Use of the FB60-BT0x connection button
  • BTConnDSR: Using the DSR PIO to establish a connection
  • BTInquiry: Find Bluetooth devices in range.
  • BTMulti: Establishing multiple connections to other Blutooth devices.
  • BTDrv: Universal Bluetooth driver


  • BTDemo: Example for searching devices, services and connection establishing

    BTDemo demonstrates the use of the SPP profile. It searches for Bluetooth devices in range and their available services.
    It is possible to connect to a mobile phone and send a SMS with the state of the switches of DB240 / DK60 / DB54. The Demo was tested with Nokia 6230i and 6361 mobile phones.
    A detailed description of BTDemo can be found in the FK60-BT0x "Getting Started" manual (Bluetooth getting started).

       

    Top of list
    Index page

    BTDUN: Using the Dial-up-networking (DUN) profile

    BTDUN demonstrates the possibilities of the DUN profile. It connects the BT0x to a mobile phone (tested with Nokia 6230i and 3161) and uses it for establishing a PPP Internet connection.

    First, the BT0x is initialized and the pin "1234" is set. After that, it connects to the mobile phone with the Bluetooth identifier "0015de21bd52" (you have to change that in source code).
    The mobile phone connects to a German Internet-Serviceprovieder (freenet) by dialling 22243. Please change that to your local provider if required.
    After the IP-connection is set up, it downloads a HTML-page from www.qotd.org and extracts a random quote.
     


    Top of list
    Index page

    BTTerm: Terminal connection via Bluetooth

    BTTerm demonstrates a terminal connection from a PC to the IPC@CHIP.
    First, the BT0x is initialized and the pin "1234"is set. After that, it changes to DATA-Mode and waits for incoming connections. The stdio-functions are installed and an additional terminal channel is provided via Bluetooth.

    Create a virtual COM-Port on your PC (with a Bluetooth adapter!) that connects to the BT0x. Because there are may different Bluetooth adapters and Bluetooth stacks available it is not possible to describe the procedure here. Please refer to the manual of your PC Bluetooth adapter. Please assure that you use the same RS232 settings for the PC and the BT0x.

    After that, you can connect with a PC Terminal application (TeraTerm or the Terminal of the Beck chiptool) via that virtual COM port to the IPC@CHIP and work on the console.
     



    Top of list
    Index page

    BTConnButton: Use of the FB60-BT0x connection button

    The FB60-BT0x has a connect button that can be used for connecting to a remote Bluetooth device.

    The Bluetooth device address of the remote device is specified first (here: 0012f304fbac, please change!). After changing to AT mode the number of remote peers is set to "1" with btWriteNoOfRemotePeers() and the remote peer is set with btWriteDefaultRemotePeer(). Next the DTR is initialized with btWriteDtrDsrSettings(), so a connection can be verified later with the btIsConnected() API call.

    In the next step the BT0x is switched to data mode. If the remote Bluetooth device is configured correctly the BT0x will connect to it after pressing the connect button. The application ends after successful connection.


    Top of list
    Index page

    BTConnDSR: Using the DSR PIO to establish a connection

    According to the connect button in the example BTConnButton it is also possible to let the BT0x automatically connect by activating the DSR PIO.
    In BTConnDSR a remote device is defined too. The DSR functionality is set with btWriteDtrDsrSettings() and the parameter BT_USE_FOR_CONNECTION_CONTROL.

    The BT0x will try to connect on activating the DSR PIO (low) and disconnect on deactivating the DSR PIO (high).

    The function btConnectWithDSR_PIO() activates the DSR PIO. After a connection is established the application terminates.


    Top of list
    Index page

    BTInquiry: Find Bluetooth devices in range

    This application demonstrates the use of the btInquiry function, it finds all Bluetooth devices in range. After the inquiry, the names of the devices are retrieved with btNameDiscovery.


    Top of list
    Index page

    BTMulti: Establishing multiple connections to other Blutooth devices

    This applications demonstrate the usage of the Multipoint firmware. For further details, please download the Application Note "Bluetooth Multipoint" from http://www.beck-ipc.com.

    BT01/02: You need btlib V1.01 or higher and the Multipoint firmware. Up to 7 clients simultaneously are supported
    BT03/04: No special firmware required. Up to 3 clients simultaneously are supported.



    Top of list
    Index page

    BTDrv: Universal Bluetooth driver

    Universal Bluetooth driver. Use the BT0x with existing applications and replace the serial connection with Bluetooth without changing the source code. Three examples are provided, two of them show using Bluetooth with CoDeSys.

    For further details, please download the Application Note "Universal Bluetooth driver" from http://www.beck-ipc.com.

    Usually the programmer uses the Bluetooth library provided with the BT0x examples to integrate Bluetooth support into an application. But there are different applications (e.g. CoDeSys) that can not or should not be changed or extended. However there are scenarios where those applications should use the Bluetooth interface instead of the serial port. For those cases this driver initializes the Bluetooth module (that in fact is connected to a serial port of the IPC@CHIP®), configures the serial port and terminates. After that the Bluetooth module is in a transparent data mode. An application can still use the standard fossil API commands for the serial port and use the serial Bluetooth connection. The application does not have to be changed.
    This method is very fast and no permanent driver creating CPU load is needed. The BT0x itself provides the possibility to ensure a permanent connection. The driver is provided in source code and can be extended for your special needs.



    Top of list
    Index page

    End of document