Bluetooth QuickStart Kit Version 1.
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.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 3 Table of Contents 1.1 Contents ......................................................................................... 4 1.2 Using Bluetooth QuickStart Kit in Products................................ 4 1.2.1 1.3 Software License ........................................................................... 5 1.4 Product Registration ..................................................................... 5 1.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 4 1 Introduction Thank you for buying Embedded Artists’ Bluetooth QuickStart Kit based on the LPC2106 ARM7™ microcontroller from Philips and cb-OEMSPA-13i industrial Bluetooth module from connectBlue. The Bluetooth QuickStart Kit contains a pre-designed platform, both hardware and software, with all necessary infrastructure functionality for using Bluetooth in industrial applications.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 5 Modifications to the design for OEM production can easily be done. Contact Embedded Artists for further information about design and production services. 1.2.1 Design and Production Services Embedded Artists provide design services for custom designs, either completely new or modification to existing boards.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 6 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.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 7 • Software platform code base is easily ported and extended to other hardware, including other processor families. • Many sample applications included in order to lower the threshold to get you started. • Complete development environment is included (compiler, linker, make, editor, etc.) • − Based on GCC. − Other compilers also supported, like Keil and IAR. The user can easily add own applications and experiment with the technology.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 8 internal parameters in the system. Communication with the (arbitrary) embedded system can be done via the RS232 serial channel. Bluetooth QuickStart Kit PDA ANY System Expose Application Control Laptop Stationary Ethernet WWW 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.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 9 are many interesting business possibilities when integrating diagnostic functions in a system, like better maintenance and a profitable after market. 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.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 10 3 Bluetooth Use-Cases This chapter provides a description of typical use-cases when using Bluetooth in industrial applications. 3.1 Typical Industrial Bluetooth Use-Cases There are basically two different use-cases for industrial Bluetooth applications: • User Interface In this case, Bluetooth is used to access a system wirelessly in order to control different parameters and/or to retrieve information.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 11 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. In remote control the information direction is the opposite; from the central place to the remote system.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 12 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. Figure 6 below illustrates a typical system with motor diagnostics. Operator Stations Vibration too high.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 13 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: • Easy local access to the system • No need to physically connect to the system • Manuals and logs are always available on the system 3.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 14 incoming connection requests to the LAN Access Profile, the LAP role must be enabled in that specific device. It is possible to enable several instances of the LAP role in order to allow several parallel connections through the LAP. A device must take the DT role in order to connect to other devices supporting the LAP role. The data transfer takes place over PPP and TCP/IP, which encapsulate the actual user data.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 15 4 Compiling and Running Application Programs This chapter provides a description of how to develop, compile, and download applications into the Bluetooth QuickStart Board. 4.1 File Structure The pre-designed software platform is delivered as a library along with a number of header files that declare the different API:s. See BApplication Program Interface (API) for a detailed API description.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 16 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’ */ # name of the program NAME = mySampleApp Name of final program. PROJECT_ROOT = .
Bluetooth QuickStart Kit Version 1.0 - User’s Guide • Page 17 Keil uVision (DKARM version) This is another complete development environment, but from Keil. It includes an editor, project manager, a complete compiler build environment, and a debugger. An evaluation version can be downloaded from Keils homepage. The DKARM-version is based on the GCC compiler (currently version 3.3.1 of GCC). It is this version of the compiler that can be used for application development. 4.2.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 18 The installation files for both programs can be found on the accompanying CDROM. • JTAG For specific information about program download (i.e., Flash programming) with a JTAG interface, consult the manual for the specific JTAG interface that is used (e.g., J-link from Segger, Ulink from Keil, or Wiggler from MacRaigor). Set switch SW2 in the position that enables the automatic program download feature.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 19 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. It also sends anything typed on the keyboard back to the Bluetooth QuickStart Board.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 20 5 Schematic and Measurements 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.
Bluetooth QuickStart Kit Version 1.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 22 5.2 Board Interfaces The Bluetooth QuickStart Kit board has a number of external interfaces as illustrated in Figure 17 below. MMC/SD memory Female Power card connector Status indicating 9-pos DSUB jack (bottom side) RGB LEDs 2.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 23 Power jack Center pin = 4-6 V DC, at least 150 mA. Outer shield = +4-6V DC Ground 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. Always use the power supply that comes with the Bluetooth QuickStart Kit. Reset LED Reset is typically active 120 mS.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 24 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 Green = Module is OK This RGB LED is controlled from the Bluetooth module and indicates current status.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 25 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 J3 J4 J5 J6 J8 J10 Figure 18 – Jumper Description The table below explains the different jumpers.
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. Page 26 Jumper shorted = Pin P0.22 act as RS232-CTS signal. P0.22 must be an output. Jumper open = Pin P0.22 is free to be used for other tasks (default position) If used, signal P0.22 is the CTS signal and P0.22 must be an output.
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.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 28 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. [1] connectBlue Serial Port Adapter, 2nd Generation, User Manual http://www.connectblue.com/files/spa2_documentation/ cb_serial_port_adapter_gen2_user_manual_2_11.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 29 [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.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 30 A connectBlue’s Serial Port Adapter Wizard The Bluetooth QuickStart Board is designed to work with connectBlue’s Serial Port Adapter Wizard program – a program that helps you to configure the Bluetooth module for your specific needs. Normally the Bluetooth module communicates over a serial channel with the LPC2106 microcontroller.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 31 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. B.1 Preemptive Real-Time Operating System API B.1.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 32 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. OS_ERROR_NULL - A NULL pointer was supplied to the function where it was not allowed. B.1.4 osSemGive void osSemGive( tCntSem* pSem ) This function gives a counting semaphore, i.e.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 33 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. OS_ERROR_ISR - The function was called from an interrupt service routine. B.1.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 34 [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. [out] pPid - The returned process identification descriptor (pid). [in] prio - The priority of the process.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 35 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. Parameters: [in] pid - The process to resume. Possible error situations (what can be identified in an error code): OS_OK - The function completed successfully.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 36 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. 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.
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.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 38 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. What actually happens is that the pData pointer in the buffer structure is returned. Parameters: [in] pBuf - buffer that contains received data.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 39 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. Possible error situations (what can be identified in an error code): TCP_OK - no error TCP_LISTEN_ERROR - This error is returned if the control block wasn't in CLOSED state when tcpListen was called B.2.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 40 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. [in] len - length of data in bytes. [in] err - TCP_OK, TCP_REMOTE_CLOSE, TCP_ERROR. B.2.7 tcpBufProcessed void tcpBufProcessed( tTcpTcb* pTcb, tBuf* pBuf ) This function must be called when received data has been processed.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 41 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. TCP_NOT_CONNECTED - connection is not established. TCP_OUT_OF_BUF - the stack is out of buffers. TCP_LEN_ZERO - the specified length parameter is zero. B.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 42 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. Parameters: [in] pTcb - an allocated TCB that will be bound to a specific port. [in] pIPAddr – the IP address to bind to.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 43 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. [in] pBuf - processed buffer. B.2.16 udpSend tS8 udpSend( tUdpTcb* pTcb, tIPAddr* pDestIP, tU16 destPort, tU8* pData, tU16 len, void (*pBufSent)(void* pData) ) This function sends data through a connection.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 44 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. "GET") for a specific connection and request. Parameters: [in] pConn - control block for the connection. Returns: The request method or NULL if none available. B.3.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 45 #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. Parameters: [in] pConn - control block for the connection. Returns: The query string or NULL if none available. B.3.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 46 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. This variable is not manipulated by the Web Server, but can be used to implement a state machine in an EGI function.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 47 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; otherwise FALSE. B.3.12 comPrintChar tBool comPrintChar( tConnect* pConn, tU8 ch ) Print a character to the output buffer. Parameters: [in] pConn - Control block for the connection. [in] ch - The character to print.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 48 [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 void comEndHeaders( tConnect* pConn ) End the headers section of a response to the client. This function must be called in order to end the headers section correctly.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 49 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. Returns: TRUE if the function could be registered properly; otherwise FALSE. B.3.19 symLocal tSymTable* symLocal( tConnect* pConn ) Return a handle to the local symbol table.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 50 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. Returns: TRUE if the variable could be allocated. The parameters will be de-allocated if allocation failed and de-allocation routines are defined. B.3.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 51 [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. Returns: TRUE if there was a symbol in the table; otherwise FALSE. B.3.24 symNext tBool symNext( tU8** ppSym, void* ppAddr, tSymType* pType, tSymState* pState ) Get the next symbol in a symbol table.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 52 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. Note that pHandle must only be used if FAT_OK is returned. Parameters: [in] pPath - The absolute path of the file to open.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 53 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 Returns: FAT_OK if the test could be determined, otherwise an error code Possible error situations (what can be identified in an error code): FAT_OK - The function completed successfully.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 54 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. Parameters: [in] handle – A handle to the file.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 55 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. The pDir parameter will be updated.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 56 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. The name will be encoded in Unicode (two bytes per character). Note: The returned ppFilename must NOT be modified or freed.
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 – The file system has not been initialized.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 58 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. These strings are then parsed and executated at different times in the PPP state machine.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 59 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. Parameters: [in] pDev - device structure [in] pStartStr - start command string B.5.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 60 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. Parameters: [in] pDev - device structure Returns: TRUE if the processing started; FALSE if a command string is already being processed. B.5.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 61 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. The function 'pppRemoteUser' is used to register user IDs and passwords that clients can use to authenticate themselves.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 62 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. B.6.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 63 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. Parameters: [in] pKey – the registry key associated with the value. This must be a unique value. [in] keyLen – the length of the key in bytes.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 64 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. Parameters: [in] pKey – the registry key to be removed [in] keyLen – the length of the key in bytes. Returns: REG_RESULT_OK if the key was successfully removed.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 65 B.8 I2C API B.8.1 i2cCheckStatus tS8 i2cCheckStatus( void ) Checks the I2C status.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 66 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. Returns: I2C_CODE_OK or I2C status code (see i2cCheckStatus) B.8.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 67 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 – the data to transmit [in] len – number of bytes to transmit Returns: I2C_CODE_OK – The function completed successfully I2C_CODE_ERROR – an error occurred B.8.
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 – number of bytes to read Returns: I2C_CODE_OK – the function completed successfully I2C_CODE_ERROR – an error occurred B.9.2 eepromWrite tS8 eepromWrite( tU16 addr, tU8* pData, tU16 len ) Read data from the eeprom.
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.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 70 C 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.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 71 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. • sample_applet/www/applet.html – this is the HTML file that will be downloaded from the web server to start the applet. • sample_applet/www/FlexiGauge.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 72 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. If the key isn’t found a new default value will be written to the registry.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 73 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 , where could be, e.g., 192.168.2.230 and could be, e.g., 2020. 2. Everything written to the telnet client will be sent to the TCP server and displayed in the console. Files • sample_tcpserver/sample.c – this file contains the code for the sample application.
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 74 • 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. C.3 Stack Size Tips Setting stack sizes to correct values can be difficult. It is important to have them as small as possible in order to save RAM.