リファレンス回路 5508

Create a 1-Wire Master with Xilinx PicoBlaze



Introduction

This reference design (RD) describes a 1-Wire® Master with PicoBlaze™ 8-bit embedded microcontroller design implemented and tested on the Xilinx® Spartan®-6 LX9 MicroBoard by Avnet. This example design uses the DS28EA001-Wire digital thermometer with sequence detect and PIO on a peripheral module. This module uses the Pmod™ port standard developed by Digilent Inc.

System Design Block Diagram

The system shown in Figure 1 shows the high-level implementation of the design. The system requires:

  • PicoBlaze processor
  • 2 BRAMs (each 1024 x 18-bit)
  • RS-232 port (USB UART)
  • LEDs for alarms
  • 681Ω ±1% pullup resistor
  • Maxim Integrated DS28EA00 peripheral module (DS28EA00PMB1#)
  • Xilinx platform cable USB

Figure 1. System design block diagram.
Figure 1. System design block diagram.

Introduction

This reference design (RD) describes a 1-Wire® Master with PicoBlaze™ 8-bit embedded microcontroller design implemented and tested on the Xilinx® Spartan®-6 LX9 MicroBoard by Avnet. This example design uses the DS28EA001-Wire digital thermometer with sequence detect and PIO on a peripheral module. This module uses the Pmod™ port standard developed by Digilent Inc.

System Design Block Diagram

The system shown in Figure 1 shows the high-level implementation of the design. The system requires:

  • PicoBlaze processor
  • 2 BRAMs (each 1024 x 18-bit)
  • RS-232 port (USB UART)
  • LEDs for alarms
  • 681Ω ±1% pullup resistor
  • Maxim Integrated DS28EA00 peripheral module (DS28EA00PMB1#)
  • Xilinx platform cable USB

Figure 1. System design block diagram.
Figure 1. System design block diagram.

Reference Design Requirements

Software

The RD's software requirements are:

Hardware

The RD's hardware setup is:

File Structure

The directory structure and critical files for this RD are shown in Table 1.

Table 1. Reference Design Directory Structure

Directory Supplied File Description
S6LX9_PicoBlaze_1Wire_ise_14_2\ All Contains files for the whole project
source\ise\ OneWire.xise ISE project file
source\hdl\ OneWire.vhd Top-level VHDL source
kcpsm6.vhd PicoBlaze microcontroller source
source\hdl\KCPSM3_UART\ UART_Manual.pdf PicoBlaze UART manual
UART_real_time_clock.pdf PicoBlaze UART real-time clock manual
source\hdl\KCPSM3_UART\VHDL\ bbfifo_16x8.vhd PicoBlaze UART FIFO macro
kcuart_rx.vhd PicoBlaze UART receive macro
kcuart_tx.vhd PicoBlaze UART transmit macro
uart_rx.vhd PicoBlaze UART receive wrapper
uart_tx.vhd PicoBlaze UART transmit wrapper
source\psm kcpsm6.exe Windows executable to compile the PicoBlaze application
OWP.psm  
OWP.log PicoBlaze 1-Wire log of the compiler output
OWP.vhd Compiled PicoBlaze application formatted to initialize the Spartan-6 Block RAM
ROM.form.vhd BRAM instantiation template used by the PicoBlaze assembler
KCPSM6_User_Guide_31March11.pdf PicoBlaze user's guide
source\ucf OneWire.ucf User Constraints File that defines timing and pin location constraints for the project
ready_for_download onewire.bit Project bitstream
hardware DS28EA00PMB1_sch.pdf DS28EA00 peripheral module schematic and board layout
DS28EA00PMB1_BOM.xls Bill of materials for the DS28EA00 peripheral module
DS28EA00PMB1_gerber.zip Gerber to manufacture the DS28EA00 peripheral module

 

Installing the UART Driver and Virtual COM Port

If the S6LX9 MicroBoard has not been connected to the PC before, you must install the software driver for the virtual COM port (VCP):

  1. Follow the instructions in the "Silicon Labs CP210x USB-to-UART Setup Guide" to complete the installation of the USB driver for the S6LX9 MicroBoard. Click here for the driver location.
  2. Connect the USB-A to USB micro-B cable to the host PC and connector J3 on the S6LX9 MicroBoard.
  3. Windows 7 will automatically assign a VCP to the board. The Device Manager shows which COM port is assigned. It also allows the user to select a COM port. For example in this system, the default virtual COM port is COM17. Look in the Ports (COM & LPT) listing for the Silicon Labs CP210x USB to UART Bridge item. Note the COM port assigned by the system.

Set Up the S6LX9 MicroBoard

Use the following procedure to set up the application:

  1. Connect the USB-JTAG cable with a pod and ribbon connector between the JTAG connector on the board and a USB port on the PC. P
  2. lug the USB cable into the PC and port J3 on the S6LX9 board. LED D7 will illuminate. 
  3. Plug in the DS28EA00 peripheral module with the component side facing the Spartan-6 into J5, the row where pin 1 is marked by the white dot. 

Figure 2. The S6LX9 MicroBoard.
Figure 2. The S6LX9 MicroBoard.

The 1-Wire Demo

Using the prebuilt bitstream file called "onewire.bit", the demo can be loaded into the FPGA and run without building the design. The Xilinx tools must be installed on your host PC, and the hardware should be set up as explained by the instructions in the "Set Up the S6LX9 MicroBoard" and "Installing the UART Driver and Virtual COM Port" sections. Here is the quick procedure to follow:

 

  1. Follow the install directions described in the "Installing the UART Driver and Virtual COM Port" section.
  2. Set up the S6LX9 MicroBoard as described in "Set Up the S6LX9 MicroBoard" section.
  3. Start a Tera Term or HyperTerminal session. Set the serial port parameters to your VCP, 9600 baud rate, no parity,8 bits, 1 stop bit, and no flow control.
  4. Using your Xilinx platform cable and the Xilinx software loading tool called iMPACT, load the "onewire.bit" file into the Spartan-6.
  5. If the DS28EA00 peripheral module is plugged in correctly, you will see:
  6. Note: If the "romid" shows all zeroes, recheck your connections. The DS28EA00 peripheral module likely does not have correct orientation or is plugged into the wrong row.

  7. You can run the demo by typing "1" at the command prompt. This will display the temperature in 2's complement hex, followed continuously by the temperature in decimal. Also, the two LEDs on the DS28EA00 peripheral module will illuminate to represent the high and low alarms, similar to a thermostat controlling heating and cooling. The high alarm A default threshold is set to turn on at ≥ 29°C and the low alarm B default threshold is set to turn on at < 27°C. To exit at any time, press the Esc key.
  8. You can change the DS28EA00 peripheral module alarm LEDs by inputting a 2's complement threshold. As an example, if you input 1Ch (28d) into the high alarm threshold, LED A will turn on at ≥ 28°C. If you input 1Ah (26d) into the low alarm threshold, LED B will turn on at < 26°C. These new alarms are activated by typing "1" at the command prompt.

Compiling the Design

This design is contained within the PicoBlaze application code and can be updated to work with any 1-Wire slave device. There are key 1-Wire subroutines that should be understood by the designer. The low level 1-Wire subroutines are listed in Table 2. The design is contained within OWP.psm and if desired can be modified for your application.

Table 2. Key 1-Wire Subroutines

Speed Subroutine Description
Standard ow_reset_slow Resets the 1-Wire slave devices and prepares them for a command.
Standard write_byte_slow Sends 8 bits of communication to the 1-Wire slave devices.
Standard write_byte_slow_power Sends 8 bits of communication to the 1-Wire slave devices and then supplies strong pullup. The strong pullup will be cleared when the next 1-Wire subroutine is issued.
Standard read_byte_slow Receives 8 bits of communication from the 1-Wire slave devices.
Standard read_byte_slow_power Receives 8 bits of communication from 1-Wire slave devices and then supplies strong pullup. The strong pullup will be cleared when the next 1-Wire subroutine is issued.
Overdrive ow_reset_fast Resets the 1-Wire bus slave devices and prepares them for a command.
Overdrive write_byte_fast Sends 8 bits of communication to the 1-Wire slave devices.
Overdrive write_byte_fast_power Sends 8 bits of communication to the 1-Wire slave devices and then supplies strong pullup. The strong pullup will be cleared when the next 1-Wire subroutine is issued.
Overdrive read_byte_fast Receives 8 bits of communication from the 1-Wire slave devices.
Overdrive read_byte_fast_power Receives 8 bits of communication from the 1-Wire slave devices and then supplies strong pullup. The strong pullup will be cleared when the next 1-Wire subroutine is issued.

Recompiling Procedure

  1. The PicoBlaze assembler will produce the needed files for implementing your design. The new files will overwrite older files, so back up your original files before recompiling. Open Windows Explorer by navigating to "source\psm" and double-clicking on the program file called "kcpsm6.exe." You might receive a security warning stating "The publisher could not be verified. Are you sure you want to run this software?" Click run and you will get the following KCPSM6 assembler window:
  2. Type the OWP.psm file name and hit the return key to compile.
  3. The PicoBlaze assembler will begin running. If there are not any errors in the PicoBlaze code, you will see a screen like the one below. If there are errors, you will be alerted with the line number to where the problem is in the code file (i.e., in the OWP.psm file) and prompted to fix the error before rerunning the assembler.
  4. Start the Xilinx ISE Project Navigator and open the file in "ise\OneWire\OneWire.xise" as shown below.
  5. Select the top level file in the design hierarchy (i.e., OneWire – PicoBlaze) in the Hierarchy pane and double-click on Generate Programming File.
  6. Confirm the hardware set of connections as defined in the "Set Up the S6LX9 MicroBoard" section. Start a Tera Term or HyperTerminal session with the serial port parameters set to your virtual COM port, 9600 baud rate, noparity, 8 bits, 1 stop bit, and no flow control.
  7. In the ISE graphical user interface (GUI), select Configure Target Device to download the FPGA design to the S6LX9 MicroBoard. The PicoBlaze application will immediately begin running upon the download completion.

Summary

This RD illustrates how to use the Xilinx PicoBlaze to interface with a DS28EA00 peripheral module. The RD also can be used as a starting point to interface to other 1-Wire slave devices.

1-Wire is a registered trademark of Maxim Integrated Products, Inc.
HyperTerminal is a registered trademark of Hilgraeve, Incorporated.
ISE is a registered trademark of Xilinx, Inc.
PicoBlaze is a trademark of Xilinx, Inc.
Pmod is a trademark of Digilent Inc.
Spartan is a registered trademark of Xilinx, Inc.
Windows is a registered trademark and registered service mark of Microsoft Corporation.
Windows XP is a registered trademark and registered service mark of Microsoft Corporation.
Xilinx is a registered trademark and registered service mark of Xilinx, Inc.

 
Status:
Package:
Temperature:

MAX31820PAR
1-Wire寄生電源、周囲温度センサー

  • 通信に1つのポートピンのみを必要とする独自の1-Wireインタフェース
  • データラインから電力を取得(寄生電源)、ローカル電源が不要
  • マルチドロップ機能によって分散温度検出アプリケーションが簡素化

MAX31820
1-Wire周囲温度センサー

  • 通信に1つのポートピンのみを必要とする独自の1-Wireインタフェース
  • 各デバイスが固有の64ビットシリアルコードを内蔵ROMに格納
  • マルチドロップ機能によって分散温度検出アプリケーションが簡素化

MAX31826
1-Wireデジタル温度センサー、1Kbロック可能なEEPROM内蔵

  • 独自の1-Wireインタフェースに必要な通信用ポートピンは1つのみ
  • 内蔵の温度センサーとEEPROMによって部品数を削減
  • 分岐機能によってマルチセンサーシステムを簡素化

DS28EA00
シーケンス検出およびPIO付き、1-Wireデジタル温度計

  • デジタル温度計により-40℃~+85℃までの温度を測定
  • 温度計の分解能:9~12ビットまでユーザが選択可能
  • 独自の1-Wireインタフェースには、通信用に1つのポート端子のみが必要

DS1990R
シリアル番号iButton

  • 出荷時レーザで書き込まれた固有の64ビット登録番号によって同一製品が存在しないため、エラーのないデバイス選択と確実な追跡を実現
  • 1-Wireネット用マルチドロップコントローラ内蔵
  • 瞬時接触によるディジタル識別

DS1825
4ビットID付き、分解能を設定可能な1-Wireデジタル温度計

  • ユニークな1-Wireインタフェースは、通信用に1つのポート端子のみが必要
  • 内蔵ROMに格納されたユニークな64ビットシリアルコードを各デバイスが装備
  • マルチドロップ機能によって、分散型温度検出アプリケーションを簡素化

  • DS2413
    1-Wire、デュアルチャネル、アドレス指定可能なスイッチ

    • 2つの設定可能な高電圧、大電流I/Oポートピンをマイクロコントローラの1つのポートピンから制御
    • 最小限の1-Wireインタフェースによってコストとインタフェースの複雑さを低減
    • 広い動作電圧/温度範囲によって堅牢なシステム性能を実現

    DS2431
    1024ビット、1-Wire EEPROM

    • あらゆる個別システムにトレーサビリティおよび関連情報を容易に追加
    • 最小限の1-Wireインタフェースによってコストとインタフェースの複雑さを低減

    DS2408
    1-Wire、8チャネル、アドレス指定可能なスイッチ

    • 8つの個別のI/Oポートピンをマイクロコントローラの1つのポートピンから制御
    • 最小限の1-Wireインタフェースによってコストとインタフェースの複雑さを低減
    • 広い動作電圧/温度範囲によって堅牢なシステム性能を実現

    DS18S20
    1-Wire寄生電力デジタルサーモメータ

    • 通信に1つのポートピンのみを必要とする独自の1-Wire®インタフェース
    • 幅広い温度管理アプリケーションのシステム精度を最大化
    • 寄生電源モードは動作に必要な端子が2つ(DQとGND)のみ

    DS2411
    VCC入力付き、シリコンシリアルナンバ

    • 出荷時にレーザで書き込みされ試験済みのユニークな64ビット登録番号(8ビットファミリコード + 48 ビットシリアルナンバ + 8ビットCRCテスタ)によって、同一パーツがないことを保証
    • 1µA以下のスタンバイ電流
    • 内蔵のマルチドロップコントローラによって共通の1-Wireネットワーク上に複数のDS2411が共存 可能

    DS1821
    プログラマブルなデジタルサーモスタットおよび温度計

    • 外付け部品不要
    • ユニークな1-Wireインタフェースによってわずか1ポートピンで通信可能
    • 動作温度範囲:-55℃~+125℃ (-67°F~+257°F)

    DS2401
    シリコンシリアルナンバー

    • 保証された固有の64ビットROM IDチップによって絶対的なトレーサビリティを実現
    • 最小限の1-Wire®インタフェースによってコストとインタフェースの複雑さを低減
    • 広い動作電圧/温度範囲によって堅牢なシステム性能を実現

    DS18S20-PAR
    寄生電源デジタルサーモメータ

    • Unique 1-Wire Interface Requires Only One Port Pin for Communication
    • Derives Power from Data Line ("Parasite Power")—Does Not Need a Local Power Supply
    • Multi-Drop Capability Simplifies Distributed Temperature Sensing Applications

    DS18B20-PAR
    1-Wire寄生電力デジタルサーモメータ

    • Unique 1-Wire Interface Requires Only One Port Pin for Communication
    • Derives Power from Data Line ("Parasite Power")—Does Not Need a Local Power Supply
    • Multi-Drop Capability Simplifies Distributed Temperature Sensing Applications

    DS18B20
    プログラマブル分解能1-Wireデジタルサーモメータ

    • 通信に1つのポートピンのみを必要とする独自の1-Wire®インタフェース
    • 温度センサーおよびEEPROMの内蔵によって部品数を削減
    • 寄生電源モードは動作に必要な端子が2つ(DQとGND)のみ

    DS2406
    1Kbメモリ付き、デュアル、アドレス指定可能なスイッチ

    • 閉ループ制御を行うために1-Wireバスを使って、オープンドレインPIO端子を制御し、端子のロジックレベルを検出可能
    • DS2407と置き換わり完全互換性があるが、ユーザプログラマブルなパワーオン設定なし、かつHidden Modeなし
    • ソフトオンとなる0.4Vで50mAをシンク可能なPIOチャネルA、および0.4Vで8mAをシンク可能なチャネルB

    DS1990A
    iButtonシリアルナンバー

    • Can Be Read in Less Than 5ms
    • Operating Range: 2.8V to 6.0V, -40°C to +85°C
    Common iButton Features
    • Unique Factory-Lasered 64-Bit Registration Number Ensures Error-Free Device Selection and Absolute Traceability Because No Two Parts are Alike
    • Built-In Multidrop Controller for 1-Wire Net
    • Digital Identification by Momentary Contact

    DS1920
    iButton温度ロガー

    • Digital Thermometer Measures Temperatures from -55°C to +100°C in Typically 0.2s
    • Zero Standby Power
    • 0.5°C Resolution, Digital Temperature Reading is Two's Complement of °C Value