Embedded Artists Bluetooth QuickStart Kit User Manual

Version 1.0

Advertisement

Quick Links

Version 1.0 - User's Guide
Bluetooth QuickStart Kit
Copyright 2004-2005 © Embedded Artists AB
Bluetooth QuickStart Kit
User's Guide
A Quick Way to Start Using and Integrate
Bluetooth in YOUR Application...
Builds on InfraBed™ technology
EA2-USG-0402 Rev A

Advertisement

Table of Contents
loading

Summary of Contents for Embedded Artists Bluetooth QuickStart Kit

  • Page 1 Version 1.0 - User’s Guide Bluetooth QuickStart Kit Copyright 2004-2005 © Embedded Artists AB Bluetooth QuickStart Kit User’s Guide A Quick Way to Start Using and Integrate Bluetooth in YOUR Application… Builds on InfraBed™ technology EA2-USG-0402 Rev A...
  • Page 2 Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 2 Embedded Artists AB Friisgatan 33 SE-214 21 Malmö Sweden info@EmbeddedArtists.com http://www.EmbeddedArtists.com Copyright 2004-2005 © Embedded Artists AB. All rights reserved. No part of this publication may be reproduced, transmitted, transcribed, stored in a retrieval...
  • Page 3: Table Of Contents

    Bluetooth QuickStart Kit Version 1.0 - User’s Guide Copyright 2004-2005 © Embedded Artists AB Table of Contents Contents ... 4 Using Bluetooth QuickStart Kit in Products... 4 1.2.1 Design and Production Services ... 5 Software License ... 5 Product Registration ... 5 Other QuickStart Boards and Kits...
  • Page 4: Contents

    Extensive documentation is included in order to lower the threshold of start using the kit even further. You can start to develop and include your own application on day 1. The LPC2106 microcontroller from Philips is used on the board. It is part of Philips new ARM7TDMI-based family of high-performance microcontrollers.
  • Page 5: Design And Production Services

    CD-ROM. By registering as a customer of Embedded Artists and as a Bluetooth QuickStart Kit user you will always have access to the latest information and new material (e.g., new sample applications).
  • Page 6: Software Platform

    Bluetooth QuickStart Kit Version 1.0 - User’s Guide 2 Bluetooth QuickStart Kit This chapter provides a description of the Bluetooth QuickStart Kit; the platform (software and hardware aspects), features, and typical usage. 2.1 Software Platform The Bluetooth QuickStart Kit includes a pre-designed software platform that integrates a mayor part of the needed infrastructure for advanced Bluetooth applications.
  • Page 7: Typical Usage

    Four mounting holes are 100 x 50 mm apart • Power: 5VDC, <150mA 2.3 Typical Usage The Bluetooth QuickStart Kit can be used to easily create advanced MMI (Man-Machine- Interfaces) based on Internet technologies: • Use the web server to expose information and parameters that can be controlled.
  • Page 8 Bluetooth QuickStart Kit Version 1.0 - User’s Guide internal parameters in the system. Communication with the (arbitrary) embedded system can be done via the RS232 serial channel. ANY System Application Stationary Figure 2 – Typical Bluetooth QuickStart Application Scenario In the scenario above, the Bluetooth QuickStart Board is used to create an advanced user interface to the embedded system.
  • Page 9 Remote administration and remote control gives the prerequisites of lower working expenses, lower total system costs, and a profitable after market. The Bluetooth QuickStart Kit allows you to experiment and develop these kinds of applications. Copyright 2004-2005 © Embedded Artists AB...
  • Page 10: Typical Industrial Bluetooth Use-Cases

    The following sections will describe a couple of typical advanced industrial Bluetooth use- cases, all of which can be built by using the Bluetooth QuickStart Kit. Motor applications are used to illustrate the industrial function, but can of course be any industrial building component.
  • Page 11: Remote Control

    Bluetooth QuickStart Kit Version 1.0 - User’s Guide 3.3 Remote Control Remote control is almost the same as remote access. The only difference is the direction of the information. In remote access the information mainly flows from the remote system to (typically) a central place.
  • Page 12: Local Service

    Bluetooth QuickStart Kit Version 1.0 - User’s Guide decisions must be made quickly. Trends can be discovered when analyzing the data, for example that a bearing is about to break down but will hold for another two months. Maintenance can in such cases be planned in advance to minimize the operation costs.
  • Page 13: Bluetooth Profiles

    Bluetooth QuickStart Kit Version 1.0 - User’s Guide A field engineer, or similar, can then easily access all relevant documents directly on site. The system becomes more self-contained since all relevant documents “follow” the system. The benefits are also in this case numerous: •...
  • Page 14: Connectblue's Modules

    • LAN Access Server This is the normal operating mode when using the Bluetooth QuickStart Kit. The board behaves as a web server that can be accessed from LAN clients that connect to the LAN server. The system waits for clients (i.e., web browsers) to connect.
  • Page 15: File Structure

    Your_application Figure 10 – Bluetooth QuickStart Kit File Structure A number of sample applications are included in the Bluetooth QuickStart Kit. These are placed in the different sample_xxx subdirectories. It is recommended to study these examples for a better understanding of the platform and how to create custom applications.
  • Page 16: Program Development

    Bluetooth QuickStart Kit Version 1.0 - User’s Guide application and a makefile. The makefile contains directives of how to compile and link the complete application. A typical makefile is listed in Figure 11 below. * Example makefile that creates a program called ‘mySampleApp’...
  • Page 17: Infrabed

    RS232 channel. This allows the program download to be fully automated. o Philips provides a utility program for In-System Flash (ISP) programming called LPC2000 Flash Utility. o Alternatively, there is a program called LPC21ISP that can be used. Source code is available.
  • Page 18: Philips Lpc2000 Flash Utility

    4.3.1 Philips LPC2000 Flash Utility Philips LPC2000 Flash Utility program looks like Figure 12 below. Figure 12 – Philips LPC2000 Flash Utility Screenshot Configure the dialog as shown above. The program will control the RS232 signals DTR and RTS if the appropriate checkbox is checked, and hence provide fully automated program download.
  • Page 19 Bluetooth QuickStart Kit Version 1.0 - User’s Guide Figure 13 – LPC21ISP Portable Command Line ISP Screenshot A typical program download sequence may look like in Figure 14 below. As seen, the first part is the actual program download phase. Then this is done, the program switches to being a terminal (the second part) and the messages from the application program are displayed.
  • Page 20: Schematic

    The chapter describes the Bluetooth QuickStart Kit board schematic and measurements. 5.1 Schematic The Bluetooth QuickStart Kit board schematic is drawn in Figure 15 and Figure 16 below. Figure 15 – Bluetooth QuickStart Board Schematic Drawing Page 1 Copyright 2004-2005 © Embedded Artists AB...
  • Page 21 Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 21 Figure 16 – Bluetooth QuickStart Board Schematic Drawing Page 2 Copyright 2004-2005 © Embedded Artists AB...
  • Page 22: Board Interfaces

    Bluetooth QuickStart Kit Version 1.0 - User’s Guide 5.2 Board Interfaces The Bluetooth QuickStart Kit board has a number of external interfaces as illustrated in Figure 17 below. Status indicating RGB LEDs Bluetooth module Bluetooth factory reset switch Figure 17 – Bluetooth QuickStart Board Interface Description Table 1 below explains each board interface in more detail.
  • Page 23: Bluetooth Module

    Bluetooth QuickStart Kit Version 1.0 - User’s Guide Power jack 4-6 V DC, at least 150 mA. The power input is protected against reverse polarity, but the board may still be damaged if reverse polarity is applied. Also, never exceed +6V DC because the on-board voltage regulator will then be damaged.
  • Page 24: Bluetooth Modules

    Bluetooth QuickStart Kit Version 1.0 - User’s Guide OEMSPA-13i datasheet for details about functionality. This push-button should normally never be used, and it is only active during power-up of the Bluetooth module. RGB LED #1 This RGB LED is controlled from the Bluetooth module and indicates current status.
  • Page 25: Board Jumpers

    Bluetooth QuickStart Kit Version 1.0 - User’s Guide 5.4 Board Jumpers There are six jumpers and one switch on the board. These are illustrated in Figure 18 and explained in Table 3 below. Automatic bootloader enabled Automatic bootloader not enabled Figure 18 –...
  • Page 26 Bluetooth QuickStart Kit Version 1.0 - User’s Guide J6 – CTS The application program has the option of controlling the RTS/CTS signals on the RS232 serial channel, if needed. If used, signal P0.22 is the CTS signal and P0.22 must be an output.
  • Page 27: Board Measurements

    Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 27 5.5 Board Measurements The board is 108 x 58 mm and Figure 19 below illustrates the mounting hole positions. The four mounting holes are 3.5 mm wide and 50 x 100 mm apart.
  • Page 28 Bluetooth QuickStart Kit Version 1.0 - User’s Guide 6 Further Information The Bluetooth module from connectBlue and the LPC2106 microcontroller from Philips are complex products and there exist a number of document with a lot of information. The following documents are recommended as a complement to this document.
  • Page 29 Bluetooth QuickStart Kit Version 1.0 - User’s Guide [17] Embedded Artists’ Reference Documentation: TCP/IP Protocol Stack http://www.embeddedartists.com/download/pdf/refDoc_tcpip.pdf [18] Embedded Artists’ Reference Documentation: Embedded Web Server http://www.embeddedartists.com/download/pdf/refDoc_web.pdf Especially observe document [7]. There exist a number of bugs in the processor that is important to be aware of.
  • Page 30 (is normally shorted) when connectBlue’s Serial Port Adapter Wizard program is used. Also observe that the Bootloader switch must be placed in position: “automatic bootloader not enabled”. Observe that the Bluetooth QuickStart Kit assumes that the Bluetooth module is configures with the following parameters: •...
  • Page 31 Bluetooth QuickStart Kit Version 1.0 - User’s Guide B Application Program Interface (API) This appendix describes the QuickStart library API in detail. The description is divided into functional sections. Please refer to appendix C for sample applications that illustrate how the API can be used in practical applications.
  • Page 32 Bluetooth QuickStart Kit Version 1.0 - User’s Guide Returns: TRUE if semaphore was taken and FALSE if timeout or error. Possible error situations (what can be identified in an error code): OS_OK - The function completed successfully. OS_ERROR_ISR - The function was called from an interrupt service routine.
  • Page 33 Bluetooth QuickStart Kit Version 1.0 - User’s Guide B.1.7 osPid tU8 osPid( void ) This function returns the process identification descriptor for the running process. Returns: The process identification descriptor of the currently running process. Possible error situations (what can be identified in an error code): OS_OK - The function completed successfully.
  • Page 34 Bluetooth QuickStart Kit Version 1.0 - User’s Guide [in] pProc - The process entry function. [in] pStk - A pointer to the stack area to use. The stack area must be allocated before the process is created. [in] stkSize - The size of the stack area in bytes.
  • Page 35 Bluetooth QuickStart Kit Version 1.0 - User’s Guide void osSuspend( void ) This function suspends the currently running process. Another process can resume it by a call to osResume. B.1.15 osResume void osResume( tU8 pid ) This function resumes a suspended process. It is valid to do resume on a process that has not been suspended.
  • Page 36 Bluetooth QuickStart Kit Version 1.0 - User’s Guide Parameters: [in] pSem - A pointer to an initialized semaphore structure. [in] timeout - After timeout ticks the operation will timeout. If a timeout of zero is specified the function will never timeout.
  • Page 37 Bluetooth QuickStart Kit Version 1.0 - User’s Guide void m_os_ena_int( void ) This macro enables interrupts. B.1.22 m_os_dis_int void m_os_dis_int( void ) This macro disables interrupts. Copyright 2004-2005 © Embedded Artists AB Page 37...
  • Page 38 Bluetooth QuickStart Kit Version 1.0 - User’s Guide B.2 TCP/IP API B.2.1 m_buf_get_data The macro m_buf_get_data is defined as: #define m_buf_get_data( pBuf ) func( pBuf ) Where func is a function with the following prototype: void* func( tBuf* pBuf ) This is a macro that retrieves a pointer to the data within the buffer.
  • Page 39 Bluetooth QuickStart Kit Version 1.0 - User’s Guide B.2.4 tcpListen tS8 tcpListen( tTcpTcb* pTcb ) Set the control block in listen mode (i.e. server) Parameters: [in] pTcb - an allocated and bound TCB Returns: One of the error codes specified below.
  • Page 40 Bluetooth QuickStart Kit Version 1.0 - User’s Guide Parameters to (*pRecv): [in] pTcb - control block for the connection. [in] pBuf - pointer to the buffer containing data. A pointer to the actual data can be retrieved by using the m_buf_get_data function.
  • Page 41 Bluetooth QuickStart Kit Version 1.0 - User’s Guide Parameters: [in] pTcb - control block for an established connection. [in] pData - data to send [in] len - length of data Returns: One of the following error codes: Possible error situations (what can be identified in an error code): TCP_OK - no errors TCP_NULL_POINTER - pTcb or pData is NULL.
  • Page 42 Bluetooth QuickStart Kit Version 1.0 - User’s Guide This function allocates a new control block. Returns NULL if there are no more control blocks available. Returns: An allocated TCB or NULL if none available. B.2.13 udpBind tS8 udpBind( tUdpTcb* pTcb, tIPAddr* pIPAddr, tU16 port ) Bind a TCB to a port.
  • Page 43 Bluetooth QuickStart Kit Version 1.0 - User’s Guide This function must be called when received data has been processed. If this function is not called the received buffer will not be de-allocated. Parameters: [in] pTcb - control block for an established connection.
  • Page 44 Bluetooth QuickStart Kit Version 1.0 - User’s Guide B.3 Web Server API B.3.1 m_get_request_method The macro m_get_request_method is defined as: #define m_get_request_method( pConn ) func( pConn ) Where func is a function with the following prototype: tU8* func( tConnect* pConn ) Get the request method (e.g.
  • Page 45 Bluetooth QuickStart Kit Version 1.0 - User’s Guide #define m_get_query_string( pConn ) func( pConn ) Where func is a function with the following prototype: tU8* func( tConnect* pConn ) Get the query string (e.g. "x=10&y=34") for a specific connection and request.
  • Page 46 Bluetooth QuickStart Kit Version 1.0 - User’s Guide Parameters: [in] pConn - control block for the connection. Returns: The EGI state. B.3.8 m_set_egi_state The macro m_set_egi_state is defined as: #define m_set_egi_state( pConn ) func( pConn ) Where func is a function with the following prototype: void func( tConnect* pConn ) Set the egi state.
  • Page 47 Bluetooth QuickStart Kit Version 1.0 - User’s Guide Parameters: [in] pConn - Control block for the connection. [in] intVal - Integer value to print. Returns: TRUE if the string version of the integer could be copied to the output buffer;...
  • Page 48 Bluetooth QuickStart Kit Version 1.0 - User’s Guide [in] value - An integer header value. This parameter is only used when pHeaderStr does not end with CRLF and pValue == NULL. Returns: TRUE if the headers was sent; otherwise FALSE B.3.15 comEndHeaders...
  • Page 49 Bluetooth QuickStart Kit Version 1.0 - User’s Guide Parameters: [in] pPath - The directory path to the command hook. [in] pHandler - The EGI function. Parameters to (*pHandler): [in] pConn - Control block for the connection. Return value of (*pHandler): EGI_DONE, EGI_ERROR or EGI_SUSPEND.
  • Page 50 Bluetooth QuickStart Kit Version 1.0 - User’s Guide Parameters to (*pFreeName): [in] pName - Memory to release. Parameters to (*pFreeAddr): [in] pAddr - Memory to release. Parameters to (*pAccess): [in] pName - Name of the variable [in] pAddr - Address of the variable.
  • Page 51 Bluetooth QuickStart Kit Version 1.0 - User’s Guide [out] ppSym - The symbol name. [out] ppAddr - The address of the symbol value (pointer to pointer). [out] pType - The type of the symbol [out] pState - The current state identifier.
  • Page 52 Bluetooth QuickStart Kit Version 1.0 - User’s Guide B.4 File System API B.4.1 fatOpen tFatResult fatOpen( const tU8* pPath, const tU8* pMode, tFatHandle* pHandle ) This function attempts to open the file with the specified absolute path. If successful, the pHandle will hold the handle to the opened file.
  • Page 53 Bluetooth QuickStart Kit Version 1.0 - User’s Guide B.4.3 fatIsDir tFatResult fatIsDir( const tFatHandle handle, tBool* pIsDir ) Tests if the specified handle represents a file or folder. Parameters: [in] handle – A handle to the file. [out] pIsDir – TRUE if the entry is a directory, otherwise FALSE...
  • Page 54 Bluetooth QuickStart Kit Version 1.0 - User’s Guide This function attempts to write size bytes to the file pointed to by the handle. The offset to where the bytes will be written is specified in the handle and the offset will be updated with the number of bytes that are written.
  • Page 55 Bluetooth QuickStart Kit Version 1.0 - User’s Guide FAT_ERROR_A_FOLDER – The path points to a folder and not a file FAT_ERROR_FS_NOT_INITIALIZED – The file system has not been initialized FAT_ERROR_READ_ONLY – The file system is read-only B.4.8 fatReadDirEntry tFatResult fatReadDirEntry( const tFatHandle handle, tFatDirEntry* pFatDirEntry ) This function opens the next entry in the specified folder.
  • Page 56 Bluetooth QuickStart Kit Version 1.0 - User’s Guide Possible error situations (what can be identified in an error code): FAT_OK - The function completed successfully. FAT_ERROR_A_FOLDER – The entry did not point to a file. B.4.11 fatGetEntryName tFatResult fatGetEntryName( tFatDirEntry* pFatDirEntry, tU8** ppFilename ) Returns the name of the specified entry.
  • Page 57 Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 57 Possible error situations (what can be identified in an error code): FAT_OK - The function completed successfully. FAT_ERROR_NOT_EXISTS - There is no folder matching the pPath FAT_ERROR_A_FILE - There is a file matching the pPath FAT_ERROR_FS_NOT_INITIALIZED –...
  • Page 58 Bluetooth QuickStart Kit Version 1.0 - User’s Guide B.5 PPP API B.5.1 Link Layer (with script engine) The link layer is used between PPP and the harware device driver (e.g. a UART). This layer includes a script engine that can be used to control the link. Command strings (init, start and close) are assigned to the link.
  • Page 59 Bluetooth QuickStart Kit Version 1.0 - User’s Guide void linkSetStart( tPppDev* pDev, tU8* pStartStr ) Assign the start command string to the device. This command string will be executed when the 'linkStart' function is called. The 'linkStart' function will be called from LCP when the this-layer-started event is triggered in LCP.
  • Page 60 Bluetooth QuickStart Kit Version 1.0 - User’s Guide tBool linkClose( tPppDev* pDev ) Execute the close command string. If the close command string contains timeouts (@w or @r) this function will return before the command string has been completely processed. This function will be called by LCP when the this-layer-finished event is triggered in LCP.
  • Page 61 Bluetooth QuickStart Kit Version 1.0 - User’s Guide B.5.11 pppReqAuth void pppReqAuth( tPppDev* pDev, tBool on ) Enable/disable request authentication. It is disabled by default. A request for authentication is normally done by a server. A client must send a valid user ID and password in order for PPP to establish a connection.
  • Page 62 Bluetooth QuickStart Kit Version 1.0 - User’s Guide B.6 UART API B.6.1 uartPppBlock void uartPppBlock( void ) This function will block PPP from accessing the UART connected to the Bluetooth module. Before PPP is blocked pppClose will be called. The default behaviour is to have PPP monitoring the UART, connected to the Bluetooth module, in order to receive data from the Bluetooth link.
  • Page 63 Bluetooth QuickStart Kit Version 1.0 - User’s Guide B.7 Registry API B.7.1 regErase void regErase( void ) Erase the entire registry. B.7.2 regSetValue tRegResult regSetValue( tU8* pKey, tU8 keyLen, tU8* pValue, tU16 valueLen ) Set a value in the registry. This function is used when a new value is added to the registry or when an old value is updated.
  • Page 64 Bluetooth QuickStart Kit Version 1.0 - User’s Guide REG_RESULT_VAL_TRUNC – There was not enough space in the output buffer for the complete value. It has been truncated. B.7.4 regRemove tRegResult regRemove( tU8* pKey, tU8 keyLen ) Remove a symbol from the registry. Both key and value will be removed.
  • Page 65 Bluetooth QuickStart Kit Version 1.0 - User’s Guide B.8 I C API B.8.1 i2cCheckStatus tS8 i2cCheckStatus( void ) Checks the I2C status. Returns: 00h Bus error 08h START condition transmitted 10h Repeated START condition transmitted 18h SLA + W transmitted, ACK received...
  • Page 66 Bluetooth QuickStart Kit Version 1.0 - User’s Guide tS8 i2cRepeatStart( void ) Generates a start condition on I2C when bus is free. Master mode will also automatically be entered. Note: After a stop condition, you may need a bus free time before you can generate a new start condition.
  • Page 67 Bluetooth QuickStart Kit Version 1.0 - User’s Guide I2C_CODE_OK – The function completed successfully I2C_CODE_ERROR – an error occurred B.8.7 i2cWaitTransmit tS8 i2cWaitTransmit( void ) Wait until data has been transmitted. Parameters: [in] addr – the address to write to [in] pData –...
  • Page 68 Bluetooth QuickStart Kit Version 1.0 - User’s Guide B.9 EEPROM API B.9.1 eepromPageRead tS8 eepromPageRead( tU16 addr, tU8* pBuf, tU16 len ) Read data from the eeprom. Parameters: [in] addr – the address to read from [in] pBuf – the read data is stored in this buffer [in] len –...
  • Page 69 Bluetooth QuickStart Kit Version 1.0 - User’s Guide B.10 Time API B.10.1 clockMs tU32 clockMs( void ) Returns number of milliseconds since start-up Returns: Number of milliseconds since start-up. Copyright 2004-2005 © Embedded Artists AB Page 69...
  • Page 70: Getting Started

    This appendix contains information about how to quickly get up and running with your application development and describes the many sample applications that are included. The Bluetooth QuickStart Kit comes shipped with a demo application pre-installed. C.1 Program Installation To quickly get up and running with your program development, perform the following actions: 1) Install GNUARM (GCC v3.4.3) (program included on the CD-ROM).
  • Page 71 Bluetooth QuickStart Kit Version 1.0 - User’s Guide Files • sample_applet/led.c – this file contains code that controls the LED • sample_applet/led.h – header file with prototypes and constants needed to control the LED. • sample_applet/sample.c – this file contains the server code that interacts with the applet.
  • Page 72 Bluetooth QuickStart Kit Version 1.0 - User’s Guide C.2.4 Registry This sample application illustrates how to use the Registry, that is, persistent storage in the eeprom. The example will start by trying to read a specified key from the registry. If the key is found the value associated with this key will be printed onto the console.
  • Page 73 Bluetooth QuickStart Kit Version 1.0 - User’s Guide The functionality can be tested by using, for example, a Telnet client to connect to the server. 1. In Windows, open a command prompt and type telnet <IP-address> <port>, where <IP-address> could be, e.g., 192.168.2.230 and <port> could be, e.g., 2020.
  • Page 74 Bluetooth QuickStart Kit Version 1.0 - User’s Guide • sample_web/www/post.html – this file calls the formpost.egi. • sample_web/www/registry.shtml – this file interacts with the listreg.egi, addreg.egi and the remreg.egi. • sample_web/www/ssi.shtml – this file illustrates how SSIs can be used. It also calls the counter.egi.

Table of Contents