none
Bluetooth module with serial connection RRS feed

  • Question

  • Hi all,

    we are adding to our board based on iMX25 micro a HCI BT module communicating via serial port.

    Which sw module i have to check into the OsDesign? Now I include the Universal Loadable Module but i also see a Integrated UART driver ....

    How can i tell the module which is the serial port ?

    Thanks


    SteMMo
    Wednesday, June 9, 2010 2:41 PM

Answers

  • Adding bluetooth stack with universal loadable is enough (SYSGEN_BTH). it is containing all the transport drivers but it will select the UART as a transport media. if you enable Integrated UART (SYSGEN_BTH_UART_ONLY), it won't work. There are some inconsistencies in selecting the BT transport driver component selection. if your BT transport device is USB or SD , you can enable that component alone.  but for UART better you can enable the universal loadable driver. the universal loader check the pnp devices like USB BT device or SD BT device. if not will load the builtin driver based on the priority. In the priority list, first one is UART. see the following register settings for UART HCI driver this is available in \WINCE600\PUBLIC\COMMON\OAK\FILES\common.reg


    ; @CESYSGEN IF CE_MODULES_BTHUART
    IF BSP_BLUETOOTH_BUILTIN_UART
    [HKEY_LOCAL_MACHINE\Software\Microsoft\Bluetooth\Transports\BuiltIn\1]
        "driver"="bthuart.dll"
        "flags"=dword:4
        "name"="COM2:"
        "baud"=dword:1c200
        "resetdelay"=dword:1388
    ENDIF
    ; @CESYSGEN ENDIF

    Also set the BSP_BLUETOOTH_BUILTIN_UART variable to 1 in your <platform name>.bat file or in the OSDesign properties environment variable lists.

    By default bthuart will use the COM2 as a default port for UART. Either you have to configure your physical serial port driver to COM2 or you can overide the above registry setting by assigning your physical serial port driver index in platform.reg.

    Good Luck

     

     


    vinoth.R http://vinoth-vinothblog.blogspot.com http://www.e-consystems.com
    • Marked as answer by SteMMo Friday, June 11, 2010 10:49 AM
    Friday, June 11, 2010 10:21 AM

All replies

  • Adding bluetooth stack with universal loadable is enough (SYSGEN_BTH). it is containing all the transport drivers but it will select the UART as a transport media. if you enable Integrated UART (SYSGEN_BTH_UART_ONLY), it won't work. There are some inconsistencies in selecting the BT transport driver component selection. if your BT transport device is USB or SD , you can enable that component alone.  but for UART better you can enable the universal loadable driver. the universal loader check the pnp devices like USB BT device or SD BT device. if not will load the builtin driver based on the priority. In the priority list, first one is UART. see the following register settings for UART HCI driver this is available in \WINCE600\PUBLIC\COMMON\OAK\FILES\common.reg


    ; @CESYSGEN IF CE_MODULES_BTHUART
    IF BSP_BLUETOOTH_BUILTIN_UART
    [HKEY_LOCAL_MACHINE\Software\Microsoft\Bluetooth\Transports\BuiltIn\1]
        "driver"="bthuart.dll"
        "flags"=dword:4
        "name"="COM2:"
        "baud"=dword:1c200
        "resetdelay"=dword:1388
    ENDIF
    ; @CESYSGEN ENDIF

    Also set the BSP_BLUETOOTH_BUILTIN_UART variable to 1 in your <platform name>.bat file or in the OSDesign properties environment variable lists.

    By default bthuart will use the COM2 as a default port for UART. Either you have to configure your physical serial port driver to COM2 or you can overide the above registry setting by assigning your physical serial port driver index in platform.reg.

    Good Luck

     

     


    vinoth.R http://vinoth-vinothblog.blogspot.com http://www.e-consystems.com
    • Marked as answer by SteMMo Friday, June 11, 2010 10:49 AM
    Friday, June 11, 2010 10:21 AM
  • Hi Vinoth,

    I am using

    Texas Instruments BRF6300 Bluetooth controller chip. As you said I have enabled "Bluetooth Stack with Universal Loadable Driver".  I want to use serial over bluetooth. I used com10: as the name in HKEY_LOCAL_MACHINE\Software\Microsoft\Bluetooth\Transports\BuiltIn\1 in the common.reg.

    But I am not able to open that port. Also I have found the similar entries in platform.reg.

    ;-- Bluetooth driver -----------------------------------------------------------

    ; @XIPREGION IF PACKAGE_OEMDRIVERS

    ; @CESYSGEN IF CE_MODULES_BTD

    IF BSP_BLUETOOTH

    [-HKEY_LOCAL_MACHINE\Software\Microsoft\Bluetooth\Transports\BuiltIn\1]

    [HKEY_LOCAL_MACHINE\Software\Microsoft\Bluetooth\Transports\BuiltIn\1]

    "Name"="SPI1:"

    "Driver"="brf6300.dll"

    "ResetGpio"=dword:37

    "WakeUpOnStart"=dword:0

    ; 'NumInquiryResponses' will limit the number of devices results

    ; Without this, there can be Scan timeouts as CE trys to detect

    ; to many devices.

    "NumInquiryResponses"=dword:5

    ; Enable handsfree/headset profile support

    [HKEY_LOCAL_MACHINE\Software\Microsoft\Bluetooth\HandsfreeProfileOn]

    [HKEY_LOCAL_MACHINE\Software\Microsoft\Bluetooth\hci]

    [HKEY_LOCAL_MACHINE\Software\Microsoft\Bluetooth\Debug]

    "mask" = dword:0003

    "console"=dword:0

    ENDIF BSP_BLUETOOTH

    ; @CESYSGEN ENDIF CE_MODULES_BTD

    ; @XIPREGION ENDIF PACKAGE_OEMDRIVERS

    Is this making any problem?

    Could you please help me?

    

    Best Regards

    Chris

    Wednesday, May 25, 2011 11:08 PM
  • As per your registry entries in platform.reg file, it is not a serial port interface, the BRF6300 is interfaced with SPI bus.

    brf6300.dll is the custom SPI HCI driver for the CIP BRF6300.

    How you are saying this is a serial port interface(COM:)?


    Vinoth.R http://vinoth-vinothblog.blogspot.com http://www.e-consystems.com

    Thursday, May 26, 2011 8:01 AM
  • Thanks Vinoth.

    When I went through the driver source for brf6300 source, I found this entry and thats why i thought it is behaving like a serial port. You are right, it is a SPI HCI driver. Also, I went through registry after building the kernel, I could see the "[HKEY_LOCAL_MACHINE\Software\Microsoft\Bluetooth\Transport\BuiltIn\1]" entry from common.reg is OVERWRITTEN by the same entry from platform.reg. Also, I found that "[HKEY_LOCAL_MACHINE\Software\Microsoft\Bluetooth\HCI]" is emtpy.

    Shall I change the "[HKEY_LOCAL_MACHINE\Software\Microsoft\Bluetooth\Transport\BuiltIn\1]" entry in common.reg as "[HKEY_LOCAL_MACHINE\Software\Microsoft\Bluetooth\Transport\BuiltIn\2]"?

    Regards

    Chris

    //------------------------------------------------------------------------------

    // Device registry parameters

    static

    const DEVICE_REGISTRY_PARAM g_deviceRegParams[] = {

     

    0, L

    "SPI1:"

    },

    {

    L

    "Script", PARAM_STRING, FALSE, offset(HCI_CONTEXT, startScript),

    0, L

    "brf61_%d.%d.%d.bts"

    }, {

    L

    "Baud", PARAM_DWORD, FALSE, offset(HCI_CONTEXT, baud),

    fieldsize(HCI_CONTEXT, baud), (VOID*)115200

    {

    L

    "Name", PARAM_STRING, FALSE, offset(HCI_CONTEXT, comPortName),
    Thursday, May 26, 2011 4:04 PM
  • Since yours is SPI, Nothing harm in keeping the "[HKEY_LOCAL_MACHINE\Software\Microsoft\Bluetooth\Transport\BuiltIn\1]" for your SPI HCI driver in platform.reg.

    Do you have any additional serial port BT devices in your device? Why do you want to change it as 2 from 1?


    Vinoth.R http://vinoth-vinothblog.blogspot.com http://www.e-consystems.com
    Thursday, May 26, 2011 5:38 PM
  • No. I have only one brf6300 BT device in my OMAP35xx.

    Since [HKEY_LOCAL_MACHINE\Software\Microsoft\Bluetooth\HCI] is empty and the HCI_OpenConnection in hciuart.xxx is trying to get the portname from [HKEY_LOCAL_MACHINE\Software\Microsoft\Bluetooth\HCI].

    -Chris

    Thursday, May 26, 2011 7:09 PM
  • Hi Vinoth,

    I rebuild the kernel. Below is the steps I followed:

    1. I kept "[HKEY_LOCAL_MACHINE\Software\Microsoft\Bluetooth\Transport\BuiltIn\1]" in both common.reg and platform.reg.

    2. Added [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\BTHCI] in project.reg as per the documentation for brf6300 which we got from TI.

    3. Changed "name"="com5:" in [HKEY_LOCAL_MACHINE\Software\Microsoft\Bluetooth\Transport\BuiltIn\1] which is under common.reg as we are already assinged "com2:" to an inbuilt uart driver.

    4. Enabled "Bluetooth Stack with Universal Loadable Driver" though the catelog.

    5. Added BSP_BLUETOOTH_BUILTIN_UART and SYSGEN_BTH_UTILS as envinornment variables and assigned the value :1".

    Now I loaded the kernel and notices the following:

    1. btpair and Bluetooth Manager detects the available bt devices and able to pair.

    2. btloader install -> succeeded.

    3. btloader load -> Fails. (hDevice=0x0000000 GetLastError = 0x000000964 (2404))

    I am paring the bt device after executing "btloader start card".

    4. btloader start card -> succeeded (Result = 1).

    [HKEY_LOCAL_MACHINE\Software\Microsoft\Bluetooth\HCI] is having same entries of "[HKEY_LOCAL_MACHINE\Software\Microsoft\Bluetooth\Transport\BuiltIn\1] from platform.reg.

    Ex: "Name"="SPI1:", "Driver"="brf6300.dll", "ResetGpio"=55, "WakeupOnStart"=0, NumInquiryResponses=5.

    I couldn;t open "com5:" and also I couldn;t see COM5: in any of the keys under [HKEY_LOCAL_MACHINE\Drivers\Active].

    Could you please help me ?

    I am appreciating your help.

    Regards

    Chris


    Thursday, May 26, 2011 7:47 PM
  • I found that in order to create a serial connection to another device (ie BT printer) I had to run another example app (i think Printui) from MS that setup a serial port connection over BT so I could use the COM7 handle that it created and print. There is also a way in dot net to not have to bother with setting up a full serial port handle before communicating over BT, I'm pretty sure the inthehand.net libraries has good bt support, at least we are using them for this purpose.
    Friday, May 27, 2011 12:59 AM
  • Hi Barak,

    I am trying to use PrintUI. When I inquire, it is listing all the BT devices and also displays an error message "Bluetooth hardware error -1". If I  select my BT deivce and press OK button, getting an popup window to select the channel. What is this channel?

    I am entering channel as 1 but getting an error message "Failed to register COM port, Error = 2404". Also I am having an error message "<device Name> stopped on COM7:".

    I tried with pairing and without pairing my device. But getting the same errors.

    Am I missing or doing something wrong? Could you please help me?

    Regards

    Chris


    Chris
    Friday, May 27, 2011 11:41 PM
  • Finally, Serial over bluetooth works!!!. Thanks to Vinoth and Barak.
    Chris
    Monday, June 6, 2011 4:47 PM
  • Chris,

    So what did you do to get it working?

    ------------------------------------------------------

    Andrew

    Thursday, June 30, 2011 3:08 PM
  • Andrew,

    COM7: is used by an another device. So, I changed the DEFAULT_PRINTER_PORT = L"COM5:" in printui.cxx.


    Chris
    Tuesday, July 5, 2011 11:27 PM