S ENSOR PERIPHERAL MODULE USER S GUIDE 1. Introduction The Silicon Labs Sensor-PMD board is made to plug into the Avnet Xilinx MicroZed and ZedBoard. It contains the Si7020 humidity and temperature sensor, as well as the Si1145 optical sensor. A software demo is available for the MicroZed board and allows the user to see five data values returned by the sensors: relative humidity (%), temperature ( F and C), ambient light (lux), UV index, and the proximity of an object. The user may place their hand on the Si7020 and observe the increase in temperature and humidity. The user can also shine light on the Si1145 and watch the increase in the UV index and the ambient light values. Additionally, the proximity value will fluctuate based on the distance an object is from the Si1145. 1.1. Features Si7020 Relative Humidity and Temperature Sensor Si1145 Optical sensor IR LED for proximity detection 6-pin SENSOR-PMD interface Small form factor (roughly 1X1 inch) Figure 1. System Block Diagram Rev. 2.1 Copyright 2014 by Silicon Laboratories AN847
1.2. Temperature and Humidity Sensing Figure 2. Silicon Labs Sensor-PMD Block Diagram The Si7020 I 2 C Humidity and Temperature Sensor is a monolithic CMOS IC, integrating humidity and temperature sensor elements, an analog-to-digital converter, signal processing, calibration data, and an I 2 C Interface. The patented use of industry-standard, low-k polymeric dielectrics for sensing humidity enables the construction of lowpower, monolithic CMOS Sensor ICs with low drift and hysteresis, and excellent long term stability. The humidity and temperature sensors are factory-calibrated and the calibration data is stored in the on-chip non-volatile memory. This ensures that the sensors are fully interchangeable, with no recalibration or software changes required. The Si7020 is available in a 3x3 mm DFN package and is reflow solderable. It can be used as a hardware- and software-compatible drop-in upgrade for existing RH/temperature sensors in 3x3 mm DFN-6 packages, featuring precision sensing over a wider range and lower power consumption. The optional factory-installed cover offers a low profile, convenient means of protecting the sensor during assembly (e.g., reflow soldering) and throughout the life of the product, excluding liquids (hydrophobic/oleophobic) and particulates. The Si7020 offers an accurate, lowpower, factory-calibrated digital solution ideal for measuring humidity, dew-point, and temperature, in applications ranging from HVAC/R and asset tracking to industrial and consumer platforms. 1.3. Proximity Sensing The Si1145/46/47 is a low-power, reflectance-based, infrared proximity, ultraviolet (UV) index, and ambient light sensor with I 2 C digital interface and programmable event interrupt output. This touchless sensor IC includes an analog-to-digital converter, integrated high-sensitivity visible and infrared photodiodes, digital signal processor, and one, two, or three integrated infrared LED drivers with fifteen selectable drive levels. The Si1145/46/47 offers excellent performance under a wide dynamic range and a variety of light sources including direct sunlight. The Si1145/46/ 47 can also work under dark glass covers. The photodiode response and associated digital conversion circuitry provide excellent immunity to artificial light flicker noise and natural light flutter noise. With two or more LEDs, the Si1146/47 is capable of supporting multiple-axis proximity motion detection. The Si1145/46/47 devices are provided in a 10-lead 2x2 mm QFN package and are capable of operation from 1.71 to 3.6 V over the 40 to +85 C temperature range. 2 Rev. 2.1
1.4. MicroZed SENSOR-PMD MicroZed is a low-cost development board based on the Xilinx Zynq -7000 All Programmable SoC. Its unique design allows it to be used as both a stand-alone evaluation board for basic SoC experimentation, or combined with a carrier card as an embeddable system-on-module (SOM). MicroZed contains two I/O headers that provide connection to two I/O banks on the programmable logic (PL) side of the Zynq-7000 AP SoC device. In stand-alone mode, these 100 PL I/O are inactive. When plugged into a carrier card, the I/O are accessible in a manner defined by the carrier card design. Thus designers can start with MicroZed in stand-alone mode as a learning platform and then easily expand its functionality as a SOM through the addition of an off-the-shelf or custom designed carrier card. This combined stand-alone/som approach can quickly move a design idea from concept to production, making MicroZed the ideal platform for SoC based applications. 2. Getting Started The Silicon Labs Sensor-PMD board has two sensors both of which are I 2 C communication based. This demo uses the MicroZed, which is available from microzed.org, to read and write to the sensors. The board comes with licenses for the Vivado design suite and Xilinx SDK, both of which are required to complete the demo. To make a project download and install the MicroZed s board definition files. The QuickStart and Getting Started guide for this can be found below. The demo will be based off of tutorials that Xilinx provides, it is recommended that you follow Tutorial 01: Build the Zynq Hardware Platform, found at the link below. This tutorial will introduce you to configuring the hardware on Zynq. An account will have to be created for the site, but the site offers vast documentation on the MicroZed. http://www.microzed.org/support/design/1519/10 Figure 3. Platform Support Site: Microzed.org Once that tutorial has been finished it is also recommended that you complete the Hello World application provided on the same site. This will give you valuable experience in writing applications on the Zynq platform. Rev. 2.1 3
2.1. Configuring FPGA The first step is to set up the hardware on the Zync processor which allows communication with the SENSOR-PMD board. To do this, launch Vivado and create a new project. Make it an RTL project, and do not select the sources at this time. For the boards, select Avnet and choose the 7010 as in shown in Figure 4. Figure 4. New Vivado Project using Avnet MicroZed 7010 Board The next step is to create a new block diagram. Select the "Add IP" link to add the first block, as shown in Figure 5. Figure 5. Add IP Block Select the ZYNQ processing system and "Run Block Automation". Figure 6. ZYNQ7 Processing System IP Block Select the "Run Block Automation" option which will automatically route the necessary supporting hardware. Figure 7. Automatically Route Blocks 4 Rev. 2.1
Add the "AXI Timer" block, as shown in Figure 8. Figure 8. AXI Timer IP Block Run the "Connection Automation", as well as the "Block Automation" if available. Now double-click on the Zynq block, which will bring up the "Customize IP" menu. Select "MIO" and expand the I/O Peripherals. Figure 9. Customize IP Block Menu Expand the I 2 C 0 I/O and set its values to the values shown in Figure 10. Figure 10. I 2 C I/O Configuration The sensors are designed to work with I 2 C lines that are pull-up so be sure to set pull-up as enabled. Select "OK". Then create the HDL wrapper by right-clicking on your block diagram in the sources menu and selecting "Create HDL Wrapper". Rev. 2.1 5
Figure 11. Create HDL Wrapper At this point we are ready to run Synthesis, then Implementation, and finally to Generate the Bitstream. Once all of the above is complete, we can export the hardware set up to the Xilinx SDK, which will make it easier to build an application and will include necessary libraries based on our block diagram peripherals. To export, open the implemented design and go to "File" "Export" Hardware". Figure 12. Export Hardware Definition File 6 Rev. 2.1
Select "OK". The directory where the project is saved will contain an.sdk directory, and in this directory there will be a hardware definition file (.hdf). Once the above is complete, you can begin developing with the SENSOR-PMD. 2.2. Xilinx SDK Application Now that the hardware is defined, you can now prepare the software tools. To do this, launch Xilinx SDK. Create a new project and select "Hardware Platform Specification" (shown in Figure 13). Figure 13. New SDK Project using Avnet MicroZed 7010 Board Name the project and select the "Browse" button. Locate the hdf file that you just created in Vivado. Figure 14. Import Hardware Definition File Rev. 2.1 7
Now it is time to create a board support package (BSP). Go to "File" "New" "Board Support Package". Ensure the hardware platform is set to the hardware project you just created. Figure 15. Create Board Support Package This is the stage where you can create an application to run on the board. To do so, select "File" "Import" "Existing Project into Workspace". Figure 16. Import Existing Software Files Search for the top directory of the provided project and select "OK". 8 Rev. 2.1
Figure 17. Select Provided Software Project Now you must set the imported project to use the hardware you have just made. Right-click on the project and select "Properties". Then click on "Project References" and check the board support package that was just created. Figure 18. Properties Project References Save everything and select the "Configure FPGA" button. Figure 19. Configure FPGA Button Rev. 2.1 9
Next, right-click on the application and choose "Run As" "Run Configurations". Figure 20. Run Configurations Add a new configuration and under the Application tab, set the target to be the.elf file located under the Debug directory, where the project is saved. Figure 21. Application Tab Target.elf File Select the tab for STDIO Connection, check the option to "Connect STDIO to Console", and select the port your device is connected to. The port can be found by going to the PC s device manager and expanding the com port. Set the BAUD rate to 115200, select "Apply", and then run. Figure 22. Configure STDIO Console 10 Rev. 2.1
After building and running you will begin to see data displayed in the console of SDK. 3. Using the Demo Figure 23. SDK Terminal Output Once everything is running, you will be able to hold your finger on the Si7020 and watch the temperature and humidity rise. You can also hover your hand above the Si1145 to see the proximity value change. This value represents the strength of the reflected IR signal. The closer your hand (or any object), the stronger the reflected IR signal will be. This value can be used to create an algorithm that can calculate distance, thresholds, or anything else a proximity sensing application might need. Note: Performance of the Si1145 is not optimized without adding an O-Ring to block the IR between the Si1145 and the IRLED. Si1145 optical sensing performance can be improved by using optical blocking between the Si1145 and the IRLED. For more details reference AN498: Si114x Designer s Guide www.silabs.com/support%20documents/technicaldocs/an498.pdf 4. Programming the QSPI Flash In order for the application to run when the board powers on, you must load your code to the quad serial peripheral interface (QSPI) flash on the Mizrozed. To do this, you need three files: The wrapper.bit file, generated in Vivado, a first stage boot loader (FSBL), and your application s.elf. The wrapper.bit file is in our Vivado project under the <project name>.runs directory. You must create the FSBL, which is a simple task. In SDK, select "File" "New" "Application Project". Name this Silabs_SENSOR-PMD_FSBL to indicate that it is the FSBL. Click "Next", select Zynq FSBL as the template, and choose "Finish". If you get a BSP library error trying to make the FSBL, go to your BSP, open the system.mss, click on the "Modify this BSP s Settings", and add the xilffs library by checking the box. Rev. 2.1 11
Figure 24. Select ZYNQ First Stage Boot Loader (SBL) You need to tell the FSBL where your code lies. Under the application code, in this case, it s the project Sensor- PMD_prox_RHT, under the src directory, there is a linker script lscript.ld. Open this and view the DDR address. In the case below it has a base address of 0x00100000 and a size of 0x3FF00000. Copy this line, and go to the linker script that is in the FSBL you have just created. Click on "Add Memory" and add the line you have just copied. Now the boot loader knows what address space our application requires. Figure 25. Define Memory Space for Linker The next step is to actually create the boot file. To do this, click on Xilinx Tools and select Create Zynq Boot Image. To create the image you need three files in this specific order: 1. FSBL.elf file 2. wrapper.bit file 3. application.elf file 12 Rev. 2.1
Add the three files as shown in Figure 26. Figure 26. Add 3 Files to Create Zynq Boot Image Figure 27 illustrates a close-up of the three files used in this example. Figure 27. 3 Required Files for Project Boot Image Rev. 2.1 13
Create the image and remember the location of the saved image. Use the JTAG programming cable to program the flash with this boot image. Select "Xilinx Tools" and choose "Program Flash". Figure 28. Select Xilinx Tools Program Flash Browse for the boot.bin file that was just created, enter 0x0 for the offset and program it. Figure 29. Set Boot File Offset to 0x0 14 Rev. 2.1
Now, completely power off the board. Switch the jumpers so that JP3 is in the bottom position. Connect to the board serially and the application code will be running. Figure 30. PC Terminal Output For a guide on setting up the serial connection to the board, see the following link: http://www.zedboard.org/sites/default/files/documentations/microzed_gettingstarted_v1_1.pdf Rev. 2.1 15
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. Patent Notice Silicon Labs invests in research and development to help our customers differentiate in the market with innovative low-power, small size, analogintensive mixed-signal solutions. Silicon Labs' extensive patent portfolio is a testament to our unique approach and world-class engineering team. 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 and Silicon Labs are trademarks of Silicon Laboratories Inc. Other products or brandnames mentioned herein are trademarks or registered trademarks of their respective holders. 16 Rev. 2.1