[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bluetooth-dev] Howto for csr and openbt



Hi all

We have worked in the last few weeks mit CSR Casira box and openbt. In a
week we will finish our work and at the moment we are writing the
documentation. We saw, that there are different people who have or had
the same problems as we had. We decided to write a little howto for CSR
Hardware and openbt. If anybody see some mistakes, we pleased to get
them. 

Thanks

Luki and Dejan
Content Security by MailMarshal
Howto - CSR-Hardware and openbt

Lukas Valle & Dejan Miletic

lukivalle@xxxxxxx.ch, miletic.dejan@xxxxxxx.ch

Version 1.0

20.10.2001


  1. Introduction

  2. 1.1 Preface
    1.2 Copyright
    1.3 The authors
    1.4 Feedback
    1.5 Acknowledgements
  3. CSR and openbt
  4. Compilation with H4 Support
  5. Compilation with BCSP Support
  6. Use openbt
  7. Test
  8. Errors
  9. Links

  1. Introduction

  2. 1.1 Preface

    This is version 1.0 of this document. We faced a lot of problems while installing Bluetooth on Linux. We thought this information might be useful to the Linux community.

    This information is intended for Linux on the Intel platform. Much of this information may be applicable to Linux on other processors, but we have no first-hand experience or information about this. The description is based on OpenBT version 0.0.7 which was installed on a SuSE Linux 7.2 Professional with kernel version 2.4.10. It should run on most other systems and with any 2.x kernel although we haven't tested it. For the Casira-Box we used the firmware hci bc01_hci-branch-12.3_casira and the PS-Tool 1.5.

    1.2 Copyright

    Copyright © 2001 Lukas Valle and Dejan Miletic. Permission to distribute and modify this document is granted under the GNU General Public Licence.

    1.3 The authors

    Valle Lukas: Student from Univerity of Applied Sciences for Architecture, Technology, Business and Language in Winterthur (Switzerland). Finishing study computer science in November 2001. Looks for a job.

    Miletic Dejan: Student from Univerity of Applied Sciences for Architecture, Technology, Business and Language in Winterthur (Switzerland). Finishing study computer science in November 2001. I will work as SW-Engineer.

    1.4 Feedback

    We welcome any feedback, good or bad, on the content of this document. We have done our best to ensure that the instructions and information herein are accurate and reliable. Please let us know if you find any errors or omissions.

    Send comments, corrections and questions to the author at lukivalle@xxxxxxx.ch, miletic.dejan@xxxxxxx.ch

    1.5 Acknowledgements

    We would like to thank:

    Peter Kjellerstedt, Anders Torbjörn Johansson and the other developers of openbt

    Frank Kargl from Uni Ulm

    Carl Orsborn and the staff at CSR

    and the mailinglist http://mhonarc.axis.se/bluetooth-dev/maillist.html

    up


  3. CSR and openbt

  4. Get the newest openbt Project from http://sourceforge.net/projects/openbt.

    Unpack it in a directory using:
    $ tar xvf openbt-20011019.tar.gz
    Change into the directory and source the init_env file:
    $ cd openbt
    $ . init_env

    Edit openbt/Makefile and add the line

    make -C apps/bluetooth/sdp_server sdp_server

    after line 13. The Makefile should look like this:

    all:
        make -C linux/drivers/char/bluetooth
        make -C libs install
        make -C apps/bluetooth/userstack links
        make -C apps/bluetooth
        make -C apps/bluetooth/sdp_server sdp_user
        make -C apps/bluetooth/sdp_server sdp_server
    In linux/drivers/char/bluetooth/Makefile you may need to comment out the modversions.h include, depending on wether your kernel was build with modversions or not.
    #MODFLAGS  = -DMODVERSIONS -include $(INCLUDEDIR)/linux/modversions.h
    Supply the path to your kernel include files on line 55:
    # The INCLUDEDIR variable allows LSB compliant distros to be able to compile
    # the module correctly. Use 'make INCLUDEDIR=/usr/src/linux/include' where
    # /usr/src/linux/include is the directory that was used to build the kernel.
    INCLUDEDIR = /usr/src/linux/include
    Next you have to change the default configuration from ERICSSON to CSR. Therefore edit openbt/linux/include/linux/bluetooth/btconfig.h, undefine CONFIG_BLUETOOTH_ERICSSON and define CONFIG_BLUETOOTH_CSR on line 62 & 64:
     /* This sets current HW */
     #undef CONFIG_BLUETOOTH_NOINIT
     #define CONFIG_BLUETOOTH_CSR
     #undef CONFIG_BLUETOOTH_DIGIANSWER
     #undef CONFIG_BLUETOOTH_ERICSSON
     #undef CONFIG_BLUETOOTH_INFINEON_BMI
     #undef CONFIG_BLUETOOTH_GENERIC
     #undef CONFIG_BLUETOOTH_USBMODULE  /* Not implemented */
    Now you are ready for make in the openbt directory.Make will exit with following error:

    /openbt/apps/bluetooth/userstack/hci_vendor.c:1029: undefined reference to `bt_use_bcsp'

    Now go to the chapter H4 or BCSP, depend what you want to use. We recommend to start with H4.

    up


  5. Compilation with H4 Support

  6. Edit openbt/apps/bluetooth/userstack/hci_vendor.c

    Comment following Lines 1014, 1015, 1016, 1017, 1018 & 1021:

    //if (bt_use_bcsp(-1))
    //{
    //      cmd->payload[0] = baud_divider | CSR_UART_EVEN_PARITY |
    //                      CSR_UART_ONE_STOP_BIT;
    //} else {
            cmd->payload[0] = baud_divider | CSR_UART_NO_PARITY |
                            CSR_UART_ONE_STOP_BIT;
    //}
    Now you are ready for make in the openbt directory:
    $ . init_env
    $ make clean
    $ make
    $ su
    $ make install
    $ make devs
    $ exit
    Important is that you change the settings on the Casira-Board. You can work with the PS-Tool 1.5.

    Set the Host Interface to UART link running H4.

    Set the value Uart Configuration Bitfields to 168.

    up


  7. Compilation with BCSP Support

  8. Edit openbt/apps/bluetooth/userstack/hci_vendor.c

    Comment following Lines 1014,1015,1018,1019,1020 & 1021:

    //if (bt_use_bcsp(-1))
    //{
            cmd->payload[0] = baud_divider | CSR_UART_EVEN_PARITY |
                            CSR_UART_ONE_STOP_BIT;
    //} else {
    //      cmd->payload[0] = baud_divider | CSR_UART_NO_PARITY |
    //                      CSR_UART_ONE_STOP_BIT;
    //}
    Now you are ready for make in the openbt directory:
    $ . init_env
    $ make clean
    $ make INCLUDE_BCSP_SUPPORT=1
    $ su
    $ make install
    $ make devs
    $ exit
    Change the directory to openbt/apps/bluetooth/experimental/
    $ make clean
    $ make INCLUDE_BCSP_SUPPORT=1
    Important is that you change the settings on the Casira-Board. You can work with the PS-Tool 1.5.

    Set the Host Interface to UART link running BCSP.

    Set the value Uart Configuration Bitfields to 6.

    up


  9. Use openbt

  10. There are some command-line tools in the directory apps/bluetooth/experimental which can be used as a replacement of the btd. As these tools are more up-to-date and some errors have been fixed there, we strongly advise to use these.

    You should copy openbt/linux/drivers/char/bluetooth/bt.o to your modules directory (usually /lib/modules/<kernelversion>/pcmcia/). Next you may want to insert

    alias char-major-124    bt
    in /etc/modules.conf and do a depmod -a to get the module loaded automatically. Otherwise you have to do an insmod bt.o manually.

    Next you need to know on what serial device your card is bound. In case of an serial device, this is easy. Just look what port you connected that device to. In case of an pcmcia card, cardinfo should give you more information. When using USB, perhaps usbview may help you. Due to a lack of USB Bluetooth devices, we haven't tested that yet.

    up


  11. Test for Sender and Receiver

  12. Load the Modul on both sides:

    insmod openbt/linux/driver/char/bluetooth/bt.o

    Change to Directory:

    cd openbt/apps/bluetooth/experimental

    Start the Stack on both sides:

    ./bti

    If you don't get any errormessages during the next seconds, the stack should work. For more Information look into /var/log/messages

    Sender starts the Inquiry and return the address from the receiver device. For example 00:02:5b:ff:06:ae

    ./btinq

    Now you can set up an RFCOMM-Connection to the receiver:

    ./btcon -d /dev/ttyBT0 -p disable -a 00:02:5b:ff:06:ae -S 2

    You will see the Message Connect, if the connection has been established.

    Now you can try to send a few data over the link.

    Receiver:

    cat /dev/ttyBT0

    Sender:

    echo hallo > /dev/ttyBT0

    Now you should see the hallo on the receiver side. Everything seems to work fine and you can disconnect the link.

    ./btdisc -d /dev/ttyBT0 -D 2

    Shut down the stack with

    ./bti

    up


  13. Errors

  14. Here a little table about errors we got during installation an what we have done to resolve them.

    /usr/src/linux/include/linux/modversions.h no such file or directory openbt/Makefile include directory on line 55 is probobly wrong. Try

    $ locate modversions.h

    and change to this directory.

    /usr/i486-suse-linux/bin/ld: cannot find -lreadline You don't have readline. Download and install it.

    Source Code: ftp://ftp.cwru.edu/pub/bash/readline-4.2.tar.gz

    User Manual: http://cnswww.cns.cwru.edu/php/chet/readline/readline.html

    Web Page: http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html

    Unpack:

    $ tar -xvzf readline-4.2.tar.gz

    Change directory:

    $ cd readline-4.2
    $ ./configure
    $ make
    $ su
    $ make install
    $ make clean
    $ exit
    /usr/i486-suse-linux/bin/ld: cannot find -ltermcap Copy Files to the correct location:
    $su
    $ cp /usr/lib/termcap/* /usr/lib/
    $ exit
    undefined reference to bt_dfu_mode Edit File

    openbt/apps/bluetooth/userstack/hci.c:

    Comment line 1902 & 1903

    // if (bt_dfu_mode(-1))
    //     return 0;
    init_phys() not implemented Change Directory

    $ cd openbt/apps/bluetooth/userstack/

    Edit File btd.c on line 3296:

    else if (!strncmp(vendor, "CSR", 3));

    sdp_server: no such file or directory Change Directory
    $ cd /openbt/apps/bluetooth/sdp_server
    $ make
    $ su
    $ cp sdp_server /usr/sbin/
    $ exit
    $ make install
    After make devs you see an error message

    mknod -m 0666 /dev/ttyBT0 c 124 0

    mknod: `/dev/ttyBT0': File exist already

    make: *** [devs] Error 1

    $ su
    $ rm /dev/ttyBT* 
    $ make devs
    $ exit
    Could not open proc file: No such file or directory

    Could not open /dev/ttyBTC

    You forgot to load the bt.o modul

    $ insmod openbt/linux/drivers/char/bluetooth/bt.o

    Stack failed to initalize in BCSP-Mode We are not sure, what exactly the problem is, but we have made gog experience with the following procedure:
    Open Casira-Box
    Disconnect the Powercable
    Insert the Powercable
    Press Reset-Button on the board
    Start bti again

    up
  15. Links

  16. Help http://developer.axis.com/doc/software/index.shtml#SW_DEVBOARD

    Mailinglist: http://mhonarc.axis.se/bluetooth-dev/maillist.html.
    up