Escolar Documentos
Profissional Documentos
Cultura Documentos
QuickSenseStudio-UG
For a detailed description of the QuickSense Firmware API or the Serial Interface, see AN366: QuickSense Firmware API. For a more detailed description of active/inactive thresholds, see AN367: Understanding Capacitive Sensing Signal to Noise Ratios. For a discussion on baselining in the QuickSense Firmware API, see AN418: Baselining in the QuickSense Firmware API.
Note: QuickSense Studio and QuickSense Firmware API version 2.xx support multiple compilers.
Rev. 0.2
Rev. 0.2
QuickSenseStudio-UG
The QuickSense Studio project build flow describing the possible paths for project development using the QuickSense Studio programs is shown in Figure 3. These steps are described in detail below and in 3. "Detailed QuickSense Studio Program Descriptions" on page 9.
Rev. 0.2
QuickSenseStudio-UG
2.1. Step 1: Creating a New Project
The Set Up pane in QuickSense Studio allows the developer to define the project and a target MCU. Once this information has been determined, the QuickSense Studio launcher will customize the available programs in the rest of the categories based on whats applicable to the target MCU.
Rev. 0.2
QuickSenseStudio-UG
2.2. Step 2: QuickSense Firmware API Customization
Once a project and device have been defined in the Set Up frame, the Configure frame can be used to create the QuickSense Firmware API files appropriate for the application.
Rev. 0.2
QuickSenseStudio-UG
Figure 7. Using the QuickSense Configuration Wizard with the Hardware Configuration Wizard
The firmware generated by the QuickSense Configuration Wizard includes the necessary QuickSense Firmware API code as well as code in the main function to enable the API processes for all defined data classes. For example, if a project is created with channels, groups, and thresholds enabled, then the main function will automatically enable the corresponding processes.
Rev. 0.2
QuickSenseStudio-UG
The project can be edited, built, and debugged using the Silicon Labs IDE. If the project is intended only to measure and report channel values and no further modification is necessary, the Silicon Labs Quick Builder can be used to build the project and download it to the target MCU. If the project is already built, the Flash Utility can be used to download the firmware to the target MCU. For more information on using these programs, see 3. "Detailed QuickSense Studio Program Descriptions" on page 9.
Note: Some compilers may have code size limitations. The QuickSense Firmware API version 2.xx supports multiple compilers and all development and evaluation kits include a pre-built Intel HEX file. See AN366: QuickSense Firmware API for more information.
Rev. 0.2
Rev. 0.2
QuickSenseStudio-UG
3.1.1. Global Settings The Global Settings tab of the QuickSense Configuration Wizard shown in Figure 11 provides options for the basic, overall functionality of the firmware. 3.1.1.1. Save Values The Save Group Values and Save Threshold Values options determine whether the raw measured data for groups and thresholds are saved. For group values, saving the data may not be necessary if only the state of the group (for example, position) is important and not the intermediate measured values. Thresholds may not be important if the measured object does not have on/off states like a button and instead has interpreted data like a position coordinate. These options are enabled by default. The CS0 Sample Rate and IR Sample Rate are the approximate rate at which the hardware takes a measurement in milliseconds. Depending on the available microcontroller bandwidth, there may be a small delay between the sampling timeout and the actual measurement. 3.1.1.2. Events For both switches and groups, events can be defined for a specific action. When an event occurs, a function within the Firmware API is called. The Switch Events options are as follows:
DisabledNo function calls on switch events. RisingFunction call on rising switch edges only. FallingFunction call on falling switch edges only. Rising and FallingFunction call on both switch edges. The Group Events options are as follows:
DisabledNo function calls on group events. RisingFunction call on rising group edges and group active events. FallingFunction call on falling group edges and group active events. Rising and FallingFunction call on both group edges and group active events. Active OnlyEvents will only trigger when the group is active.
3.1.1.3. Serial Interface The QuickSense Firmware API Serial Interface allows the hardware to communicate with the QuickSense Studio calibration programs like the Performance Analysis Tool. The Serial Interface is enabled by default. The Board ID can be used to identify the board as a particular type of hardware. The QuickSense Firmware API demos like the Music Keyboard have a pre-defined Board ID. These pre-defined Board IDs can be found in the PerformanceAnalysisTool.ini file installed in the same directory as the Performance Analysis Tool (C:\SiLabs\MCU\QuickSense_Studio\Software\PerformanceAnalysisTool\ by default). The default Board ID is 0xFF or 255. The Default Update Frequency parameter determines how often the Serial Interface sends data if a Periodic transfer mode is selected. 3.1.1.4. Transfer Info If Send Enumeration Information is enabled, the Serial Interface will transmit basic information describing the system (how many switches and groups, for example) when requested by the host. This is useful for systems where the hardware the host is talking to may change. However, in fixed systems where the host is always talking to the same device, disabling this option reduces the projects code size. The method the Serial Interface uses to determine when to transfer data can be selected using the Transfer Mode options. The Serial Interface will transfer data periodically at a rate defined by Default Update Frequency in the Serial Interface section using the Periodic option. The Update option will only send data if a switch or group sta-
10
Rev. 0.2
QuickSenseStudio-UG
tus has changed. The Demand option will send data when requested by the host. In both the Update and Demand options, the Default Update Frequency has no effect. The Transfer Type options determine what data is set when the Serial Interface makes a data transfer. With the Selected option, data will only be transferred for selected channels. For Selected and Updated option, data will be transferred if channels are selected and the data or state has changed since the last transmission.
Note: The "Selected" transfer type is not a subset of the "Selected And Updated" transfer type. If the application requires both "Selected" and "Selected and Updated" transfer types, the "Selected" type must be explicitly chosen in addition to Selected and Updated.
3.1.2. Measurements The Measurements tab of the QuickSense Configuration Wizard provides options for global QuickSense Firmware API measurements settings.
xn y n 1 y n = ------------------------------------ + y n 1 2m
Rev. 0.2
11
QuickSenseStudio-UG
In this equation, x(n) represents the current sample, y(n) represents the current result, and y(n-1) represents the previous result. This setting in the QuickSense Configuration Wizard changes the m exponent in the equation. The higher the exponent, the less weight is given to new samples fed into the averager. For more details, see AN366: QuickSense Firmware API. 3.1.2.4. Si1120 Settings The STX Max High Time is the longest the STX pin on the Si1120 is asserted during IR measurements. Deasserting this pin causes the Si1120 to stop IR measurement for that specific irLED. This value should be set for the application such that the STX pin can be asserted for the shortest amount of time to save power. This value is specified in microseconds and the valid range is 500 to 2200 rounded to the nearest 100 s. 3.1.3. Peripherals Once the Global Settings and Measurements options have been set for a particular application, the Peripherals tab provides a graphical interface for allocating control pins for external peripheral devices, like the Si1102. The UART pins are gray to indicate that these pins are unavailable for external device control or communication lines. These UART pins are available for use if the Serial Interface is disabled in the Global Settings tab.
12
Rev. 0.2
QuickSenseStudio-UG
Once a channel has been added, click on the Port I/O diagram to allocate the control channels to GPIO pins.
Figure 16. Moving an Allocated GPIO Pin for an External Peripheral Device
The MD pin is not necessarily required for all applications, so assigning this pin is optional. The "Single Prox Channel" checkbox indicates that the application only requires a single Infrared Proximity channel, so the IR signal pins do not need to be multiplexed. In this case, a pin does not need to be assigned to IR in the Channels/Thresholds tab.
Rev. 0.2
13
QuickSenseStudio-UG
14
Rev. 0.2
QuickSenseStudio-UG
Rev. 0.2
15
QuickSenseStudio-UG
16
Rev. 0.2
QuickSenseStudio-UG
3.1.5. Groups In order to add groups in the Groups tab, there must be Capacitive Sensing or Infrared Proximity channels allocated using the Channels/Thresholds tab. These channels must be of the Disabled/Group Threshold Detection type.
Rev. 0.2
17
QuickSenseStudio-UG
18
Rev. 0.2
QuickSenseStudio-UG
3.1.6. Code The Code tab of the QuickSense Configuration Wizard provides a window into the QuickSense Firmware API files modified by the program.
Rev. 0.2
19
QuickSenseStudio-UG
3.2. Silicon Labs Hardware Configuration Wizard (Configuration Wizard 2) (Optional)
The Hardware Configuration Wizard (Configuration Wizard 2) program is a general-purpose utility that helps accelerate development by automatically generating initialization source code to configure and enable the on-chip resources needed by most design projects. In just a few steps, the wizard creates complete startup code for a specific Silicon Labs MCU. If opened using QuickSense Studio, Configuration Wizard 2 will have knowledge of any peripheral-specific settings generated using the QuickSense Configuration Wizard. The default initializations created by the QuickSense Configuration Wizard can be augmented with additional hardware configuration using Configuration Wizard 2. To modify the Firmware API project files generated by the QuickSense Configuration Wizard:
1. Generate a project using the QuickSense Configuration Wizard. 2. Open Hardware Configuration Wizard (Configuration Wizard 2) using the QuickSense Studio launcher program. 3. Add any extra peripheral settings required by the application. It's not recommended to modify the oscillator speed, UART baud rate, and Timer 0/1 settings to maintain QuickSense Serial Interface compatibility. Note: Any modifications or extra peripheral configurations made with Configuration Wizard 2 may require debugging using the Silicon Labs IDE. 4a. Keep the initial hardware configurations intact in "QS_DeviceInit.c", save the additional hardware settings in a new file, and add this new file to the QuickSense Firmware API project. Detailed instructions on how to do this can be found in Section 3.3.2.1. "Opening the QuickSense Firmware API Project" on page 21. -or4b. Save the initial and additional hardware settings to a file named "QS_DeviceInit.c" (Note: This will replace the initial hardware configurations generated by the QuickSense Configuration Wizard).
The hardware initialization file (QS_DeviceInit.c) should be updated whenever any changes to peripheral settings are made using the Configuration Wizard 2.
20
Rev. 0.2
QuickSenseStudio-UG
3.3. Silicon Labs IDE
The Silicon Labs IDE integrates a source-code editor, a source-level debugger, and an in-system Flash programmer.
Pentium-class host PC running Microsoft Windows 2000 or newer One available USB port 3.3.2. Using the Silicon Labs IDE with the QuickSense Firmware API The following sections discuss how to open the QuickSense Firmware API with the IDE, build the source code, and download it to the target device. 3.3.2.1. Opening the QuickSense Firmware API Project 1. If the Silicon Labs IDE is opened using QuickSense Studio, the project specified in the Set Up section will be automatically opened. Otherwise, select ProjectOpen Project and navigate to the QuickSense Firmware API project. 2. (Optional) To create any new files to add to the project, select FileNew File to open an editor window. Create your source file(s) and save the file(s) with a recognized extension, such as .c, .h, or .asm, to enable color syntax highlighting. 3. (Optional) To add these new files, right-click on QuickSense_API in the Project Window. Select Add files to project. Select files in the file browser and click Open. Continue adding files until all project files have been added. 4. (Optional) For each of the new files in the Project Window that you want assembled, compiled and linked into the QuickSense Firmware API project, right-click on the file name and select Add file to build. Each file will be assembled or compiled as appropriate (based on file extension) and linked into the build of the absolute object file. Note: If a project contains a large number of files, the Group feature of the IDE can be used to organize. Right-click on QuickSense_API in the Project Window. Select Add Groups to project. Add pre-defined
Rev. 0.2
21
QuickSenseStudio-UG
groups or add customized groups. Right-click on the group name and choose Add file to group. Select files to be added. Continue adding files until all project files have been added. 3.3.2.2. Building and Downloading the QuickSense Firmware API Project for Debugging 1. Once all additional source files have been added to the target build, build the project by clicking on the Build/Make Project button in the toolbar or selecting ProjectBuild/Make Project from the menu. Note: After the project has been built the first time, the Build/Make Project command will only build the files that have been changed since the previous build. To rebuild all files and project dependencies, click on the Rebuild All button in the toolbar or select ProjectRebuild All from the menu. 2. Before connecting to the target device, several connection options may need to be set. Open the Connection Options window by selecting OptionsConnection Options... in the IDE menu. First, select the USB Debug Adapter option. Next, the correct Debug Interface must be selected. See the appropriate kit or data sheet documentation to determine the proper Debug Interface selection for the microcontroller in the application. Once all the selections are made, click the OK button to close the window. 3. Click the Connect button in the toolbar or select DebugConnect from the menu to connect to the device. 4. Download the project to the target by clicking the Download Code button in the toolbar. Note: To enable automatic downloading if the program build is successful select Enable automatic connect/download after build in the ProjectTarget Build Configuration dialog. If errors occur during the build process, the IDE will not attempt the download. 5. Save the project when finished with the debug session to preserve the current target build configuration, editor settings and the location of all open debug views. To save the project, select ProjectSave Project from the menu. 3.3.2.3. Downloading an Intel HEX Firmware Image The QuickSense Evaluation Kit installer packages install the firmware source code as well as a pre-built Intel HEX image that can be downloaded directly into the board. The firmware source code and an example IDE project is located in the relevant kits installation directory (C:\SiLabs\MCU\QuickSense_Studio\Kits\<kit_name>\Firmware\). The pre-built HEX image is located in the C:\SiLabs\MCU\QuickSense_Studio\Kits\<kit_name>\Firmware\Release\ directory. An Intel HEX file can also be created from a calibrated boards firmware image as described in Section 3.3.2.4.. To update or refresh the HEX image in a board: 1. 2. 3. 4. 5. 6. 7. 8. Connect the USB Debug Adapter or Debug port on the target hardware to the PC using a USB cable. Launch the Silicon Labs IDE, and click on OptionsConnection Options. Select USB Debug Adapter and then select the Debug Adapter from the list. Select the appropriate debug interface (C2 in most cases) and press OK. Connect to the board by pressing the Connect icon, or using the keyboard shortcut Alt+C. Click on the Download icon, or use the keyboard shortcut Alt+D. In the download dialog window, click Browse. Change to Files of Type Intel Hex (*.hex) and then browse to the appropriate folder to select the HEX file to be downloaded. 9. Click Open then Download. 10. To run the new image, either press Go in the IDE or disconnect from the board (keyboard shortcut Alt+C). It is necessary to disconnect from the board in the IDE if the Performance Analysis Tool will be used to view data later.
22
Rev. 0.2
QuickSenseStudio-UG
3.3.2.4. Creating a Calibrated Final Firmware Image Intel HEX File using the IDE After a board has been calibrated and completely configured, an Intel HEX firmware image file can be created using the Silicon Labs IDE. This image can then be downloaded to other boards in a production setting. To create this firmware image, perform the following steps: 1. Open the Silicon Labs IDE. A project does not have to be open. 2. Before connecting to the target device, several connection options may need to be set. Open the Connection Options window by selecting OptionsConnection Options... in the IDE menu. First, select the USB Debug Adapter option. Next, the correct Debug Interface must be selected. See the appropriate kit or data sheet documentation to determine the proper Debug Interface selection for the microcontroller in the application. Once all the selections are made, click the OK button to close the window. 3. Click the Connect button in the toolbar or select DebugConnect from the menu to connect to the device. 4. Go to ToolsUpload Memory to File.
Rev. 0.2
23
QuickSenseStudio-UG
9. Go to the following KnowledgeBase article and download the ASC2HEX_V1.1.zip attachment: http://portal.knowledgebase.net/article.asp?article=174726&p=4120. This attachment will include an ASCII to binary converter (ASC2HEX.exe) and a binary to .HEX converter (BIN2HEX.exe). 10. Navigate to the directory where the attachment was saved. Unzip the file and run the ASCII to HEX utility (ASC2HEX.exe). In the program, use Browse to navigate to the file created in Step 8 using the IDE. Press OK. This will create a binary program of the same filename. 11. Run the binary file through the binary to .HEX converter (BIN2HEX.exe). This can be done by dragging and dropping the binary file on the BIN2HEX.exe executable or calling the executable from the command line (Usage: BIN2HEX C:\firmware_image.bin). 12. The binary to .HEX converter output file name is limited to eight characters, so the .HEX file should be renamed as desired. The file is now a calibrated .HEX file that can be downloaded to other boards.
24
Rev. 0.2
QuickSenseStudio-UG
3.6. QuickSense Performance Analysis Tool
The QuickSense Performance Analysis Tool can be used to view values, save threshold values, calibrate, and log data in real-time from a device running the QuickSense Firmware API.
Rev. 0.2
25
QuickSenseStudio-UG
Each button has a color box surrounding the checkbox. This is the color used to display the data of the corresponding channel on the graph. The color associated with a particular channel can be modified at any time by right-clicking on the button in the Board Representation window. The text shown on the button in the Board Representation window is the channel number followed by the most recent value acquired for the channel the button represents. The color of the text is red if the button is inactive and green if the button is active. To display a channel using the generic Board Representation window, check the checkbox next to the button. To select the button so the threshold values are displayed, press the portion of the button with the raw data value.
26
Rev. 0.2
QuickSenseStudio-UG
Once a button has been selected, press the green play button under Acquisition to start graphing. This play button will become a pause button that can be used to stop graphing.
Rev. 0.2
27
QuickSenseStudio-UG
3.6.3.2. Auto Adjust The Threshold Auto Adjust feature is available if a channel is selected and the program is actively graphing the channels real-time values. To use the Auto Adjust feature, press the Selected button and follow the instructions. For a new board, the Auto Adjust feature may provide a good starting point for the threshold values. The thresholds can then be manually adjusted as necessary. This feature is only available with the Periodic transfer mode. 3.6.3.3. Save The Threshold Save feature can be used to save the adjusted thresholds back to the hardware. In the Save options under Threshold Settings, pressing Selected will save the values for the currently selected channel. Pressing All will save the thresholds for all channels. Any changes made in the Performance Analysis Tool to the thresholds of a channel without saving will be lost the next time the program connects to the hardware. 3.6.3.4. Revert The Revert options reset the displayed thresholds with the ones saved in the hardware. Pressing Selected will reload the threshold settings for the selected channel and pressing Displayed will reload the threshold settings for all displayed channels. Any changes made to the threshold without saving will be lost when the Revert options are used. 3.6.3.5. Erase The Threshold Erase feature will reset the thresholds in the hardware back to their default states (100% for Inactive to Active and 0% for Active to Inactive). Pressing Selected erases the hardwares threshold settings for the selected channel and pressing All erases the hardwares threshold settings for all channels. 3.6.4. Interacting with Groups A group is the set of channels creating a single element, such as a scroll wheel or a slider. Each group type has a window with a visual representation of the latest states of the groups defined for the hardware. Upon connecting to the hardware, these windows are opened if the Performance Analysis Tool detects one or more valid groups of that type.
28
Rev. 0.2
QuickSenseStudio-UG
3.6.5. Performance Analysis Tool Settings Menu Options The Settings Menu has additional graphing options available.
Rev. 0.2
29
QuickSenseStudio-UG
30
Rev. 0.2
QuickSenseStudio-UG
Show Baseline This option toggles the Active and Inactive Baselines on the graph. For detailed information on baselining in the QuickSense Firmware API, see AN418: Baselining in the QuickSense Firmware API. This option is on by default. 3.6.5.2. Data Logging Selecting this option opens the Data Logging Settings dialog. The dialog controls settings for the log file size, log file name, and filters the channels whose data will be logged.
The contents of the data logging file are readable at any time and modifiable when the user selects a different file or disconnects from the hardware. The data streamed to the log file is saved as text with a Tab Separated Values format. Up to six sets of information are saved, in the following order, depending on the filter options chosen:
1. Time stamp 2. Raw data (optional) 3. Threshold state (optional) 4. Active and Inactive Baselines (optional) 5. Threshold level (optional) 6. Group state data (including gestures, where applicable) (optional)
Rev. 0.2
31
QuickSenseStudio-UG
3.6.5.3. Sampling Frequency This option sets the frequency in Hz at which the hardware sends data to the Performance Analysis Tool using the QuickSense Firmware API serial interface. This value is only relevant if the Periodic Data Transfer mode is used. The range of sampling frequencies supported is determined by the hardware. 3.6.5.4. Buffer Size This option modifies the size of the data acquisition buffer used by the Performance Analysis Tool. The acquisition buffer is shared by all the channels present on a system. The size is specified in MB and the default value is 1 MB. This option is only available when the Performance Analysis Tool is not connected to hardware. 3.6.5.5. Data Transfer
32
Rev. 0.2
QuickSenseStudio-UG
3.6.5.6. Baseline Update Period This option modifies the period in seconds at which the hardware recomputes the Active and Inactive Baselines. This parameter is global to the hardware (the same update period is used for all channels) and it is stored in the hardware. This parameter can only be set when an acquisition is not acquiring data.
Rev. 0.2
33
QuickSenseStudio-UG
The channel numbers correspond to the button and group elements on the hardware based on the listed order in the arrays QS_Config.c file. The first element in these arrays is element 0 (Channel or Group 0).
34
Rev. 0.2
QuickSenseStudio-UG
Rev. 0.2
35
QuickSenseStudio-UG
3.8. QuickSense XY Display Utility
The QuickSense XY Display Utility provides a drawing pad for multi-dimensional pad (nD Pad) groups in the QuickSense Firmware API. For more information on this group type, see AN366: QuickSense Firmware API. For these group types, the coordinate transmitted by the QuickSense Firmware API Serial Interface is displayed on the drawing pad. The displayed coordinates location is displayed in the lower left-hand corner.
Figure 48. QuickSense XY Display Utility with the One-Dimensional IR Slider Evaluation Kit
To connect to a device, use the DeviceSettings menu option to select the device and the program will automatically connect. The connection status can also be manually controlled using the DeviceConnect menu. The connected device will be displayed in the lower left-hand corner. Once a device is connected, the device should begin transmitting location information to the XY Display Utility. In the case of the Infrared Slider, the relative one-dimensional position should be displayed. 3.8.1. View Menu The View menu provides several options for the XY Display Utility drawing pad:
36
Rev. 0.2
QuickSenseStudio-UG
NOTES:
Rev. 0.2
37
QuickSenseStudio-UG
CONTACT INFORMATION
Silicon Laboratories Inc. 400 West Cesar Chavez Austin, TX 78701 Tel: 1+(512) 416-8500 Fax: 1+(512) 416-9669 Toll Free: 1+(877) 444-3032 Please visit the Silicon Labs Technical Support web page: https://www.silabs.com/support/pages/contacttechnicalsupport.aspx and register to submit a technical support request.
The information in this document is believed to be accurate in all respects at the time of publication but is subject to change without notice. Silicon Laboratories assumes no responsibility for errors and omissions, and disclaims responsibility for any consequences resulting from the use of information included herein. Additionally, Silicon Laboratories assumes no responsibility for the functioning of undescribed features or parameters. Silicon Laboratories reserves the right to make changes without further notice. Silicon Laboratories makes no warranty, representation or guarantee regarding the suitability of its products for any particular purpose, nor does Silicon Laboratories assume any liability arising out of the application or use of any product or circuit, and specifically disclaims any and all liability, including without limitation consequential or incidental damages. Silicon Laboratories products are not designed, intended, or authorized for use in applications intended to support or sustain life, or for any other application in which the failure of the Silicon Laboratories product could create a situation where personal injury or death may occur. Should Buyer purchase or use Silicon Laboratories products for any such unintended or unauthorized application, Buyer shall indemnify and hold Silicon Laboratories harmless against all claims and damages. Silicon Laboratories, Silicon Labs, and QuickSense are trademarks of Silicon Laboratories Inc. Other products or brandnames mentioned herein are trademarks or registered trademarks of their respective holders.
38
Rev. 0.2