PICkit™ Serial Analyzer User’s Guide © 2009 Microchip Technology Inc.
Note the following details of the code protection feature on Microchip devices: • Microchip products meet the specification contained in their particular Microchip Data Sheet. • Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the intended manner and under normal conditions. • There are dishonest and possibly illegal methods used to breach the code protection feature.
PICkit™ SERIAL ANALYZER USER’S GUIDE Table of Contents Preface ........................................................................................................1 Chapter 1. PICkit™ Serial Analyzer Overview 1.1 Introduction ..................................................................................... 5 1.2 Highlights ........................................................................................ 5 1.3 PICkit™ Serial Analyzer Contents ..............................................
PICkit™ Serial Analyzer User’s Guide Chapter 4. I2C™ Master Communications 4.1 Introduction ...................................................................................27 4.2 Highlights ......................................................................................27 4.3 PICkit Serial Pin Assignments .......................................................27 4.4 Selecting Communications Mode ..................................................28 4.5 Configuring I2C Communications Mode ..
PICkit™ SERIAL ANALYZER USER’S GUIDE Table of Contents 7.6 Communications: Basic Operations .............................................. 56 7.7 Script Builder ................................................................................ 58 7.8 Script Execute ............................................................................... 63 Chapter 8. USART Asynchronous Communications 8.1 Introduction ................................................................................... 65 8.
PICkit™ Serial Analyzer User’s Guide Chapter 11. PICkit™ Serial Analyzer Firmware 11.1 Introduction ...................................................................................89 11.2 Highlights ......................................................................................89 11.3 Overview .......................................................................................89 11.4 Exec ..............................................................................................91 11.
PICkit™ SERIAL ANALYZER USER’S GUIDE Preface NOTICE TO CUSTOMERS All documentation becomes dated, and this manual is no exception. Microchip tools and documentation are constantly evolving to meet customer needs, so some actual dialogs and/or tool descriptions may differ from those in this document. Please refer to our web site (www.microchip.com) to obtain the latest documentation available. Documents are identified with a “DS” number.
PICkit™ Serial Analyzer User’s Guide • • • • • Chapter 11. “PICkit™ Serial Analyzer Firmware” Chapter 12. “PICkit™ Serial Analyzer DLL” Chapter 13. “Troubleshooting” Appendix A. “PICkit Serial Analyzer Schematics” Appendix B.
Preface WARRANTY REGISTRATION Please complete the enclosed Warranty Registration Card and mail it promptly. Sending in the Warranty Registration Card entitles users to receive new product updates. Interim software releases are available at the Microchip web site. RECOMMENDED READING This user’s guide describes how to use the PICkit™ Serial Analyzer. Other useful documents are listed below. The following Microchip documents are available and recommended as supplemental reference resources.
PICkit™ Serial Analyzer User’s Guide • MPLAB® IDE – The latest information on Microchip MPLAB IDE, the Windows® Integrated Development Environment for development systems tools. This list is focused on the MPLAB IDE, MPLAB SIM simulator, MPLAB IDE Project Manager and general editing and debugging features. • Programmers – The latest information on Microchip programmers. These include the MPLAB PM3 and PRO MATE® II device programmers and the PICSTART® Plus and PICkit™ 2 development programmers.
PICkit™ SERIAL ANALYZER USER’S GUIDE Chapter 1. PICkit™ Serial Analyzer Overview 1.1 INTRODUCTION The PICkit™ Serial Analyzer development system enables a personal computer (PC) to communicate with embedded development systems via serial protocols such as I2C™, SPI, asynchronous and synchronous USART. The PC program uses a graphical interface to enter data and commands to communicate to the target device. Data and commands can be entered using basic or scripting commands.
PICkit™ Serial Analyzer User’s Guide FIGURE 1-1: PICkit™ SERIAL ANALYZER DEVELOPMENT SYSTEM PC Target Device USB I2C™ SPI USART PICkit™ Serial Analyzer 1.5 PICkit™ SERIAL ANALYZER HARDWARE The PICkit™ Serial Analyzer connects to a Microsoft® Windows® compatible computer using a USB port. It interfaces to the target device using a 6-pin header. Figure 1-2 shows an overview of the PICkit™ Serial Analyzer.
PICkit™ Serial Analyzer Overview 1.5.1 Status LEDs The Status LEDs indicate the status of the PICkit™ Serial Analyzer. 1. Power (green) – Power is applied to the PICkit™ Serial Analyzer by the USB port. 2. Target (yellow) – The PICkit™ Serial Analyzer is communicating with the target device. 3. Busy (red) – The PICkit™ Serial Analyzer is communicating with the target device. 1.5.2 Push Button The push button is available for future implementation. 1.5.
PICkit™ Serial Analyzer User’s Guide 1.6 PICkit™ SERIAL ANALYZER SOFTWARE 1.6.1 PC Program The PICkit™ Serial Analyzer PC program uses a graphical interface to enter data and commands to communicate to the target device. Data and commands can be entered using basic or scripting commands. Chapter 3. “PICkit™ Serial Analyzer PC Program” explains the installation and operation of the program.
PICkit™ SERIAL ANALYZER USER’S GUIDE Chapter 2. Getting Started 2.1 INTRODUCTION This chapter will get you started using the PICkit™ Serial Analyzer with the 28-pin demo board. In this demo, the PICkit™ Serial Analyzer will communicate with the 28-pin demo board using the I2C serial protocol. The PICkit™ Serial Analyzer will be the I2C master and the 28-pin demo board will be the I2C slave device. The 28-pin demo board is programmed to emulate an I2C Real-Time Clock and Serial EEPROM.
PICkit™ Serial Analyzer User’s Guide 2.5 CONNECTING THE PICkit™ SERIAL ANALYZER TO THE 28-PIN DEMO BOARD Connect the PICkit Serial Analyzer to P3 on the 28-pin demo board as shown in Figure 2-1.
Getting Started FIGURE 2-2: 2.7 PICkit™ SERIAL ANALYZER MAIN WINDOW RUNNING THE 28-PIN DEMO I2C™ DEMONSTRATION PROGRAM Select the 28-pin demo I2C demonstration by clicking on Demo Boards > 28 Pin Demo I2C from the menu bar. The 28-Pin Demo I2C Demonstration window will be displayed as shown in Figure 2-3. The Real-Time Clock (RTC) will be displayed first. Note the tabs to select between the RTC, EEPROM and ADC demonstrations.
PICkit™ Serial Analyzer User’s Guide FIGURE 2-3: 2.7.2 28-PIN DEMO I2C™ – RTC Serial EEPROM (EEPROM) Clicking on the EEPROM tab will display the 256 byte array of EEPROM memory as shown in Figure 2-4. The 28-pin demo board has been programmed to emulate a stand-alone serial I2C EEPROM device such as a 24LC02. The I2C commands are very similar to the commands used in these devices. The Serial EEPROM tab displays the contents of a serial EEPROM implemented on the 28-pin demo board.
Getting Started FIGURE 2-4: 2.7.3 28-PIN DEMO I2C™ – EEPROM Analog-to-Digital Converter (ADC) Clicking on the ADC tab will show a meter gauge displaying the value of the ADC as read from potentiometer RP1 as shown in Figure 2-5. The meter gauge displays the Most Significant 8 bits of the 10-bit ADC internal to the PIC® microcontroller. Rotate potentiometer RP1 and the display changes almost instantaneously.
PICkit™ Serial Analyzer User’s Guide 2.8 I2C™ COMMUNICATIONS – BASIC OPERATIONS Individual I2C commands and data can be read and written to the 28-pin demo board from the Basic Operations window as shown in Figure 2-6. Ensure that the PICkit Serial Analyzer program is in I2C Master mode by selecting PICkit Serial Analyzer > Run Configuration Wizard from the menu bar and selecting I2C Master. Note: The 28-Pin Demo I2C window and the Basic Operations window cannot be opened at the same time.
Getting Started For example, to read seconds from the Real-Time Clock: Step 1 – Enter 0xA2 into the Slave Address[W] block in the Read section of the Basic Operations window (lower third of window) Step 2 – Enter 0x02 into the Word Address block Step 3 – Note that the Slave Address[R] has already been entered for you (the Read bit is set). Step 4 – Enter 0x01 into the Byte Count block Step 5 – Click on the Execute button The I2C combination command (Write then Read) will be sent to the 28-pin demo board.
PICkit™ Serial Analyzer User’s Guide NOTES: DS51647C-page 16 © 2009 Microchip Technology Inc.
PICkit™ SERIAL ANALYZER USER’S GUIDE Chapter 3. PICkit™ Serial Analyzer PC Program 3.1 INTRODUCTION This chapter covers the installation, starting and high-level operations of the PICkit Serial Analyzer program. Detailed information about the entering of data and commands for specific serial communications modes are given in the following chapters. 3.2 HIGHLIGHTS This chapter discusses: • • • • • 3.
PICkit™ Serial Analyzer User’s Guide FIGURE 3-1: 3.5 PICkit™ SERIAL ANALYZER MAIN WINDOW CONFIGURATION WIZARD If it is the first time that the PICkit Serial Analyzer program is run, the Configuration Wizard will run automatically. The Configuration Wizard can be manually invoked by selecting PICkit Serial Analyzer > Run Configuration Wizard from the menu bar.
PICkit™ Serial Analyzer PC Program FIGURE 3-2: CONFIGURATION WIZARD – WELCOME The Configuration Wizard Page 1 of 4, as shown in Figure 3-3, displays the available communications modes and allows you to choose one of the modes. FIGURE 3-3: CONFIGURATION WIZARD – PAGE 1 OF 4 In this example, I2C Master Communication mode is selected. The Configuration Wizard Page 2 of 4, as shown in Figure 3-4, allows you to select the bus speed.
PICkit™ Serial Analyzer User’s Guide The I2C bus requires pull-up resistors. The PICkit Serial Analyzer has the ability to enable internal 2.2 kΩ pull-up resistors. If the target device does not have pull-up resistors installed, then enable pull-ups by selecting the Yes radio button as shown in Figure 3-5. If the target device has the pull-up resistors installed, you can disable the internal pull-ups by selecting the No radio button.
PICkit™ Serial Analyzer PC Program Once all pages of the Configuration Wizard are completed, you can choose to not display the wizard at start-up by checking the Do not show this wizard on start-up again check box. FIGURE 3-7: 3.6 CONFIGURATION WIZARD – YOU’RE DONE! MAIN WINDOW 3.6.1 Menu Bar The menu bar selects various functions of the PICkit Serial Analyzer program.
PICkit™ Serial Analyzer User’s Guide PICkit™ SERIAL ANALYZER The PICkit Serial Analyzer menu selection commands the PICkit Serial Analyzer hardware.
PICkit™ Serial Analyzer PC Program WINDOW • New Transaction Window – Opens new or additional transaction window. Multiple transaction windows can be opened as needed for logging communications.
PICkit™ Serial Analyzer User’s Guide FIGURE 3-10: STATUS COLUMN (BASIC VIEW) FIGURE 3-11: STATUS COLUMN (ADVANCED VIEW) 3.6.4 Transactions Window The Transactions window, shown in Figure 3-12, keeps a running log of the commands and data that are communicated between the PICkit Serial Analyzer program and target device. From the menu bar on the Transaction window, the contents can be saved (File>Save) to a *.txt or *.rtf file.
PICkit™ Serial Analyzer PC Program Additional Transactions windows can be displayed. From the PICkit Serial Analyzer menu bar, select Window > New Transaction Window. The active Transactions window will log the current commands and data. FIGURE 3-12: TRANSACTIONS WINDOW FILE • Open – Opens a *.txt or *.rtf file and displays it in the Transactions window • Save – Saves the contents of the Transactions window to a *.txt or *.
PICkit™ Serial Analyzer User’s Guide NOTES: DS51647C-page 26 © 2009 Microchip Technology Inc.
PICkit™ SERIAL ANALYZER USER’S GUIDE Chapter 4. I2C™ Master Communications 4.1 INTRODUCTION This chapter describes the I2C Master Communications mode. I2C data and commands can be entered using a Basic Communications window or by creating script commands. It is assumed that the user is familiar with the I2C protocol. For more information see: • The I2C Bus Specification Version 2.1 January 2000 is available from NXP Semiconductor (formerly Philips Semiconductor) web site at: http://www.nxp.
PICkit™ Serial Analyzer User’s Guide 4.4 SELECTING COMMUNICATIONS MODE The I2C Master Communications mode is selected from the Configuration Wizard or menu bar. Configuration Wizard – Select PICkit Serial Analyzer > Run Configuration Wizard from the menu bar Menu Bar – Select PICkit Serial Analyzer > Select Communications Mode > I2C Master 4.5 CONFIGURING I2C COMMUNICATIONS MODE Once the communications mode has been selected, it is configured from the Configuration Wizard or menu bar.
I2C™ Master Communications CAUTION The USB port current limit is set to 100 mA. If the target plus PICkit Serial Analyzer exceeds this current limit, the USB port will turn off. The target may be powered externally if more power is required. COMM I2CM BIT RATE Select the desired I2C bus bit rate using the drop down box.
PICkit™ Serial Analyzer User’s Guide ADVANCED OPTIONS • Disable LED2 Default – Disable default LED2 behavior (LED2 = Yellow ‘Target’ LED) • Disable LED1 Default – Disable default LED1 behavior (LED1 = Red ‘Busy’ LED) • Enable Switch Test – Enable low-level switch test: - Switch Off (not depressed) – blink LED1, LED2 off - Switch ON (depressed) – blink LED2, LED1 off • AUX1 Default State – AUX1 communication line – default state (0 | 1) • AUX2 Default State – AUX2 communication line – default state (0 | 1) •
I2C™ Master Communications Receive issues a simple Read command to the target device (refer to The I2C Specification reference in Section 4.1 “Introduction”. The basic structure of the command is: • Start bit (S_) • Slave Address[W] – Enter the slave address of the device to communicate with. The Write bit should be set to indicate a read operation. • Byte Count – Enter the number of bytes to receive • Stop bit (P_) FIGURE 4-3: 4.
PICkit™ Serial Analyzer User’s Guide 4.7.1 Script Commands The left most column contains the script commands as shown in Figure 4-5. • Script Name – Enter the name of the script • Save Script – Saves the script • Execute Script – Executes (performs) the script displayed in the Script Detail column • Clear Script – Clears the Script Detail column • Del User Scripts – Deletes scripts from the User Scripts column • Show Array – Displays a spreadsheet-like table in which large amounts of data may be entered.
I2C™ Master Communications FIGURE 4-6: I2C™ SCRIPT BUILDER – EXAMPLE SCRIPTS Example Scripts 4.7.3 Script Detail The third column contains Script Detail as shown in Figure 4-7. This column is used to create the script or view an existing script. More information about creating a custom script is discussed in Section 4.7.5 “Creating A Script”. To load a user script from the User Scripts column into the Script Detail column, the user can double click or right click and select from the local menu.
PICkit™ Serial Analyzer User’s Guide User Scripts can be deleted by right clicking and selecting Delete Script from the local menu. FIGURE 4-8: I2C™ SCRIPT BUILDER – USER SCRIPTS User Scripts 4.7.5 Creating A Script Scripts are created by placing the cursor into the Script Detail column and right clicking. A local menu will be displayed as shown in Figure 4-9. Select from the choice of commands or script macro commands. The sequence of macro commands are executed from top to bottom.
I2C™ Master Communications I2C™ SCRIPT BUILDER – CREATING A SCRIPT FIGURE 4-9: TABLE 4-2: I2C™ SCRIPT MACRO COMMAND Command Abbreviation Macro Command Description I2CINIT [I_] I2C™ Initialization I2TART [S_] I2C™ Start I2TOP [P_] I2C™ Stop I2CRESTART [RS] I2C™ Restart I2CWRTBYT [W_] I2C™ Write Bytes. Next byte is the byte count, followed by the data. I2CRDBYT [R_] I2C™ Read Bytes. Next byte is the byte count.
PICkit™ Serial Analyzer User’s Guide 4.8 SCRIPT EXECUTE The Script Execute window is shown in Figure 4-10. Once scripts are created using the Script Builder, they can be assigned to buttons in the Script Execute window. This makes a convenient window to execute multiple scripts either individually or iteratively. Script executing will be logged in the Transactions window. The Script Execute window is opened by selecting Communications > Script > Script Execute from the menu bar. FIGURE 4-10: 4.8.
I2C™ Master Communications FIGURE 4-11: © 2009 Microchip Technology Inc.
PICkit™ Serial Analyzer User’s Guide NOTES: DS51647C-page 38 © 2009 Microchip Technology Inc.
PICkit™ SERIAL ANALYZER USER’S GUIDE Chapter 5. I2C™ Slave Communications 5.1 INTRODUCTION This chapter describes I2C Slave Communications. The I2C Slave mode allows you to mimic an I2C slave by responding to standard Read, Write and Receive commands. You can mimic an I2C slave device from either the PICkit Serial Analyzer PC interface (Interactive mode), or from the PICkit Serial Analyzer itself (Auto mode).
PICkit™ Serial Analyzer User’s Guide 5.4 SELECTING COMMUNICATIONS MODE The I2C Slave Communications mode is selected from the Configuration Wizard or menu bar. Configuration Wizard – Select PICkit Serial Analyzer > Run Configuration Wizard from the menu bar Menu Bar – Select PICkit Serial Analyzer > Select Communications Mode > I2C Slave 5.5 CONFIGURING I2C SLAVE COMMUNICATIONS MODE Once the communications mode has been selected, it is configured from the Configuration Wizard or menu bar.
I2C™ Slave Communications I2C SLAVE MODE There are three modes of I2C slave operation: • Default: Basic/mechanical mode of operation in which the PICkit Serial Analyzer blindly accepts any/all ‘write’ data and provides canned/default ‘read’ data in response to any enabled I2C address and all device addresses. • Interactive: This mode allows the host to orchestrate I2C transactions in ‘real time’.
PICkit™ Serial Analyzer User’s Guide • • • • • • Nack RX – Enable event marker: NACK byte received Reg Read – Enable event marker: Register Read Reg Write – Enable event marker: Register Write Status Error – Enable event marker: change in I2C status byte Stop – Enable event marker: I2C Stop Data RQ – Enable event marker: Data request Note: Disabling any of the event markers may cause the software to not respond correctly, or at all.
I2C™ Slave Communications 5.6 COMMUNICATIONS: BASIC OPERATIONS The I2C Slave Basic Operations window can be opened by selecting: • Basic Operations from the tool bar, or • Communications > Basic Operations from the menu bar The I2C Slave Basic Operations window is shown in Figures 5-3. There are three basic communications commands, Receive, Write and Read. FIGURE 5-3: I2C™ SLAVE – BASIC OPERATIONS Receive responds to a basic Receive request from the master.
PICkit™ Serial Analyzer User’s Guide Show Profile Generator. Press this to close the Basic Operations page and open the I2C Slave Profile Generator page. Note: 5.7 The Basic Operations page and the Profile Generator page cannot both be opened at the same time due to DLL conflict issues. COMMUNICATIONS: PROFILE GENERATOR The I2C Slave Profile Generator allows you to mimic an I2C slave device from either the PICkit Serial Analyzer PC interface, or from the PICkit Serial Analyzer itself.
I2C™ Slave Communications • Memory Block – Check if the register is to be treated as a contiguous block of memory, such as an EE array. • Data Size – Number of bytes in the register. If the register is not a Memory Block, this many bytes will be returned when the register is read. If the register is a Memory Block, the profile generator will return one byte at a time until it is Nacked.
PICkit™ Serial Analyzer User’s Guide NOTES: DS51647C-page 46 © 2009 Microchip Technology Inc.
PICkit™ SERIAL ANALYZER USER’S GUIDE Chapter 6. Lin Communications 6.1 INTRODUCTION This chapter describes the LIN Communications mode. LIN data and commands can be entered using a Basic Communications window. To use LIN communications, you must attach the LIN Adapter to the PICkit Serial Analyzer and supply it power prior to attempting any communications. It is assumed that the user is familiar with the LIN protocol. For more information see: LIN bus Specification Ver. 1.2: http://www.lin-subbus.de/ 6.
PICkit™ Serial Analyzer User’s Guide 6.5 CONFIGURING LIN SLAVE COMMUNICATIONS MODE Once the communications mode has been selected, it is configured from the Configuration Wizard or menu bar. Configuration Wizard – Select PICkit Serial Analyzer > Run Configuration Wizard from the menu bar Menu Bar – Select PICkit Serial Analyzer > Configure Communications Mode The Configure Mode window will open.
Lin Communications FIGURE 6-2: LIN CONFIGURE COMMUNICATIONS MODE – ADVANCED VIEW EVENT MARKERS • • • • • • • • • • • • • Abrt Mac Exe – Enable event marker: abort ‘macro’ execution Macro Loop – Enable event marker: top of ‘macro’ loop Mac Lp 65536 – Enable event marker: ‘macro’ loop count overflow (i.e.
PICkit™ Serial Analyzer User’s Guide 6.6 COMMUNICATIONS: BASIC OPERATIONS The LIN Basic Operations window can be opened by selecting: • Basic Operations from the tool bar, or • Communications > Basic Operations from the menu bar The LIN Basic Operations window is shown in Figure 6-3. FIGURE 6-3: LIN BASIC OPERATIONS Display Mode: Determines when OnReceive data is displayed.
Lin Communications Note: © 2009 Microchip Technology Inc. The “x” indicates the value is a hexadecimal number. Clicking on “x” will toggle it to a “d” indicating that the value is a decimal number.
PICkit™ Serial Analyzer User’s Guide NOTES: DS51647C-page 52 © 2009 Microchip Technology Inc.
PICkit™ SERIAL ANALYZER USER’S GUIDE Chapter 7. SPI and Microwire Master Communications 7.1 INTRODUCTION This chapter describes the SPI and Microwire Master Communications mode. Microwire is a subset of the SPI protocol. Data and commands can be entered using a Basic Communications window or by creating script commands. It is assumed that the user is familiar with the SPI protocol. For more information see: An SPI tutorial is available on the Microchip Technology web site.
PICkit™ Serial Analyzer User’s Guide 7.4 SELECTING COMMUNICATIONS MODE The SPI Master Communications mode is selected from the Configuration Wizard or menu bar. Configuration Wizard – Select PICkit Serial Analyzer > Run Configuration Wizard from the menu bar Menu Bar – Select PICkit Serial Analyzer > Select Communications Mode > SPI Master 7.5 CONFIGURATING SPI COMMUNICATIONS MODE Once the Communications mode has been selected, it is configured from the Configuration Wizard or menu bar.
SPI and Microwire Master Communications CAUTION The USB port current limit is set to 100 mA. If the target plus PICkit Serial Analyzer exceeds this current limit, the USB port will turn off. The target may be powered externally if more power is required. SPI BIT RATE Select the desired SPI bit rate by selecting the radio button for the desired range and then selecting the bit rate using the slider.
PICkit™ Serial Analyzer User’s Guide • Auto Output Disable – Disables output during input. Allows the SDI lines and the SDO lines to be shorted for 3-wire communication. • Chip Select Polarity – Set chip polarity – active-high or active-low. 7.6 COMMUNICATIONS: BASIC OPERATIONS The SPI Basic Operations window can be opened by selecting: • Communications: Basic Operations from the tool bar, or • Basic Operations from the menu bar The SPI Basic Operations window is shown in Figure 7-3.
SPI and Microwire Master Communications FIGURE 7-4: 7.6.1 SPI BASIC OPERATIONS Basic Communications – Serial EEPROM Example Figures 7-5 through 7-7 demonstrate how to communicate with a 25LC020A SPI serial EEPROM. Refer to the 25LC020A Data Sheet (DS21833) for a detailed explanation of its SPI communications. Before data can be written to the 25LC020A, the write enable (WREN) latch must be set. This requires that CS be enabled, command 0x06 transmitted, and CS disabled.
PICkit™ Serial Analyzer User’s Guide FIGURE 7-6: SEEPROM EXAMPLE – WRITE BYTES Figure 7-7 shows how to read data from the 25LC020A. Groups 0 and 1 are disabled, and Groups 2 and 3 are enabled. This example shows how data is transmitted and received in one transaction (Chip Select, CS, active) between Groups. Clicking on the Execute button will send the Read command (0x03) and memory address (0x00) of Group 2 followed by a Read Ten Bytes command in Group 3.
SPI and Microwire Master Communications FIGURE 7-8: 7.7.1 SPI SCRIPT BUILDER Script Commands The left most column contains the script commands as shown in Figure 7-9.
PICkit™ Serial Analyzer User’s Guide 7.7.2 Example Scripts The second column contains Example Scripts as shown in Figure 7-10. These can be studied to learn how to create or to edit custom scripts. To load the example script into the Script Detail column, either double click or right click and select from the local menu. FIGURE 7-10: 7.7.3 SPI SCRIPT BUILDER – EXAMPLE SCRIPTS Example Scripts Script Detail The third column contains Script Detail as shown in Figure 7-11.
SPI and Microwire Master Communications FIGURE 7-11: SPI SCRIPT BUILDER – SCRIPT DETAIL Script Detail 7.7.4 User Scripts The fourth column contains User Scripts as shown in Figure 7-12. User scripts that are created, named and saved are displayed in the User Scripts column. To load a user script from the User Scripts column into the Script Detail column, the user can double click or right click and select from the local menu.
PICkit™ Serial Analyzer User’s Guide 7.7.5 Creating A Script Scripts are created by placing the cursor into the Script Detail column and right clicking. A local menu will be displayed as shown in Figure 7-13. Select from the choice of commands or script macro commands. The sequence of macro commands are executed from top to bottom. Macro commands are entered by right clicking in the box and selecting from the local menu as shown in Figure 7-13.
SPI and Microwire Master Communications 7.8 SCRIPT EXECUTE The Script Execute window is shown in Figure 7-14. Once scripts are created using the Script Builder, they can be assigned to buttons in the Script Execute window. This makes a convenient window to execute multiple scripts either individually or iteratively. Script executing will be logged in the Transactions window. FIGURE 7-14: 7.8.
PICkit™ Serial Analyzer User’s Guide NOTES: DS51647C-page 64 © 2009 Microchip Technology Inc.
PICkit™ SERIAL ANALYZER USER’S GUIDE Chapter 8. USART Asynchronous Communications 8.1 INTRODUCTION This chapter describes the USART Asynchronous Communications mode. USART asynchronous data and commands can be entered using a Basic Communications window or by creating script commands. It is assumed that the user is familiar with the USART asynchronous protocol.
PICkit™ Serial Analyzer User’s Guide 8.4 SELECTING COMMUNICATIONS MODE The USART Asynchronous Communications mode is selected from the Configuration Wizard or menu bar. Configuration Wizard – Select PICkit Serial Analyzer > Run Configuration Wizard from the menu bar Menu Bar – Select PICkit Serial Analyzer > Select Communications Mode > USART Asynchronous 8.
USART Asynchronous Communications CAUTION The USB port current limit is set to 100 mA. If the target plus PICkit Serial Analyzer exceeds this current limit, the USB port will turn off. The target may be powered externally if more power is required. USART BAUD Enter the desired USART symbol rate (Baud) in the text box.
PICkit™ Serial Analyzer User’s Guide • • • • • 8.
USART Asynchronous Communications FIGURE 8-4: 8.7.1 USART ASYNCHRONOUS SCRIPT BUILDER Script Commands The left most column contains the script commands as shown in Figure 8-5.
PICkit™ Serial Analyzer User’s Guide 8.7.2 Example Scripts The second column contains Example Scripts as shown in Figure 8-6. These can be studied to learn how to create or to edit custom scripts. To load the example script into the Script Detail column, either double click or right click and select from the local menu. FIGURE 8-6: USART ASYNCHRONOUS SCRIPT BUILDER – EXAMPLE SCRIPTS Example Scripts 8.7.3 Script Detail The third column contains Script Detail as shown in Figure 8-7.
USART Asynchronous Communications FIGURE 8-7: 8.7.4 USART ASYNCHRONOUS SCRIPT BUILDER – SCRIPT DETAIL Script Detail User Scripts The fourth column contains User Scripts as shown in Figure 8-8. User scripts that are created, named and saved are displayed in the User Scripts column. To load a user script from the User Scripts column into the Script Detail column, the user can double click or right click and select from the local menu.
PICkit™ Serial Analyzer User’s Guide The sequence of macro commands are executed from top to bottom. Macro commands are entered by right clicking in the box and selecting from the local menu as shown in Figure 8-9. Macro commands are entered according to the sequence of events as defined by the USART asynchronous protocol. Studying the example scripts is a good way to learn the sequence of events. The example scripts can also be modified and saved under a different name.
USART Asynchronous Communications TABLE 8-2: 8.8 USART SCRIPT MACRO COMMANDS (CONTINUED) USAUX1IN [A1IN] Set Aux1 direction to Input USAUX1W0 [A1W0] Aux1 Wait 0 USAUX1W1 [A1W1] Aux1 Wait 1 USAUX2RST [A2RST] Reset Aux2 USAUX2SET [A2RST] Set Aux2 USAUX2OUT [A2OUT] Set Aux2 direction to Output USAUX2IN [A2IN] Set Aux2 direction to Input USAUX2W0 [A2W0] Aux2 Wait 0 USAUX2W1 [A2W1] Aux2 Wait 1 SCRIPT EXECUTE The Script Execute window is shown in Figure 8-10.
PICkit™ Serial Analyzer User’s Guide 8.8.2 Iteration Scripts can be executed a user defined number of times at a specified interval of time. Figure 8-11 shows an example. A script named TX_Data has been assigned to the Iteration button in the left column. The number of iterations is entered in the Iterations box and the delay in milliseconds in the Delay box. A summary of the iterations is displayed in the left column. The macro is executed when the Iteration button is clicked.
PICkit™ SERIAL ANALYZER USER’S GUIDE Chapter 9. USART Master Synchronous Communications 9.1 INTRODUCTION This chapter describes the USART Synchronous Master Communications mode. USART Synchronous Master data and commands can be entered using a Basic Communications window or by creating script commands. It is assumed that the user is familiar with the USART synchronous protocol. For more information see: • USART, AUSART or EUSART chapter of the PIC® microcontroller data sheet of interest 9.
PICkit™ Serial Analyzer User’s Guide 9.5 CONFIGURING USART SYNCHRONOUS MASTER COMMUNICATIONS MODE Once the communications mode has been selected, it is configured from the Configuration Wizard or menu bar. Configuration Wizard – Select PICkit Serial Analyzer > Run Configuration Wizard from the menu bar Menu Bar – Select PICkit Serial Analyzer > Configure Communications Mode The Configure Mode window will open.
USART Master Synchronous Communications FIGURE 9-2: USART SYNCHRONOUS MASTER CONFIGURE COMMUNICATIONS MODE – ADVANCED VIEW SCRIPT TIME-OUT When sending scripts, the software will wait a maximum of script time-out ms to receive a script complete tag before issuing an error. If your hardware is slow to respond or you are transferring a lot of data, you may need to increase the script time-out to avoid errors.
PICkit™ Serial Analyzer User’s Guide 9.6 COMMUNICATIONS: BASIC OPERATIONS The USART Asynchronous Operations window can be opened by selecting: • Communications: Basic Operations from the tool bar, or • Basic Operations from the menu bar The USART Synchronous Master Basic Operations window is shown in Figure 9-3. There are two basic communications commands, Read and Write. Data can be transmitted to the target device as 7-bit ASCII or 8-bit byte. 7-bit ASCII data is entered in the left-hand window.
USART Master Synchronous Communications FIGURE 9-4: 9.7.1 USART SYNCHRONOUS MASTER SCRIPT BUILDER Script Commands The left most column contains the script commands as shown in Figure 9-5.
PICkit™ Serial Analyzer User’s Guide 9.7.2 Example Scripts The second column contains Example Scripts as shown in Figure 9-6. These can be studied to learn how to create or to edit custom scripts. To load the example script into the Script Detail column, either double click or right click and select from the local menu. FIGURE 9-6: USART SYNCHRONOUS MASTER SCRIPT BUILDER – EXAMPLE SCRIPTS Example Scripts 9.7.3 Script Detail The third column contains Script Detail as shown in Figure 9-7.
USART Master Synchronous Communications FIGURE 9-7: USART SYNCHRONOUS MASTER SCRIPT BUILDER – SCRIPT DETAIL Script Detail 9.7.4 User Scripts The fourth column contains User Scripts Detail as shown in Figure 9-8. User scripts that are created, named and saved are displayed in the User Scripts column. To load a user script from the User Scripts column into the Script Detail column, the user can double click or right click and select from the local menu.
PICkit™ Serial Analyzer User’s Guide The sequence of macro commands are executed from top to bottom. Macro commands are entered by right clicking in the box and selecting from the local menu as shown in Figure 9-9. Macro commands are entered according to the sequence of events as defined by the USART Synchronous Master protocol. Studying the example scripts is a good way to learn the sequence of events. The example scripts can also be modified and saved under a different name.
USART Master Synchronous Communications TABLE 9-2: 9.8 USART SCRIPT MACRO COMMANDS (CONTINUED) USAUX1W1 [A1W1] Aux1 Wait 1 USAUX2RST [A2RST] Reset Aux2 USAUX2SET [A2RST] Set Aux2 USAUX2OUT [A2OUT] Set Aux2 direction to Output USAUX2IN [A2IN] Set Aux2 direction to Input USAUX2W0 [A2W0] Aux2 Wait 0 USAUX2W1 [A2W1] Aux2 Wait 1 SCRIPT EXECUTE The Script Execute window is shown in Figure 9-10.
PICkit™ Serial Analyzer User’s Guide 9.8.2 Iteration Scripts can be executed a user defined number of times at a specified interval of time. Figure 9-11 shows and example. A script named TX_Data has been assigned to the Iteration button in the left column. The number of iterations is entered in the Iterations box and the delay in millisecond in the Delay box. A summary of the iterations is displayed in the left column. The macro is executed when the Iteration button is clicked.
PICkit™ SERIAL ANALYZER USER’S GUIDE Chapter 10. User Defined Templates 10.1 INTRODUCTION User Defined Templates extend user scripts by interpreting the data read from the target device and displaying it in a human readable form. The conversion formula is: EQUATION 10-1: CONVERSION FORMULA Read Value * Slope + Offset = Display Value For example, an 8-bit ADC value is read, and we desire a displayed value in voltage, 0 to 5 Volts. The 8-bit ADC value (read value) can be 0 to 256 decimal.
PICkit™ Serial Analyzer User’s Guide 10.3 CREATING AND USING TEMPLATES Create a User Define Template by selecting User Define Templates > Display Template from the menu bar. The User Defined Template window is displayed as shown in Figure 10-1, showing three active scripts. Note: First, a user define script(s) must be created using the Script Builder window for the selected serial communications mode. Refer to the respective serial communications chapter under the Script Builder section.
User Defined Templates • Graph – allows the data to be graphed during run time. The pop-up graph may be resized as needed. Once the parameter(s) are entered, they can be saved as a User Defined Parameter file (*.udp). • File->Open – Open an existing User Defined Parameter file (*.udp) • File->Save – Save or replace a User Defined Parameter file (*.udp) • Clear All – Resets (clears) all parameter boxes OPTIONS • • • • 10.4 Run All – Runs all parameter scripts above that are marked as active.
PICkit™ Serial Analyzer User’s Guide 10.5 GRAPHING DATA You may also graph any of the data being displayed in real time; simply press the Graph button for the corresponding parameter. The graph may be resized as desired. See Figure 10-3. The Style button on the bottom of the graph toggles the view between an area, line, column, or point plot. FIGURE 10-3: DS51647C-page 88 GRAPHING DATA © 2009 Microchip Technology Inc.
PICkit™ SERIAL ANALYZER USER’S GUIDE Chapter 11. PICkit™ Serial Analyzer Firmware 11.1 INTRODUCTION This chapter explains the internal operations of the PICkit™ Serial Analyzer firmware. The source code is available on the PICkit Serial Analyzer CD-ROM at D:\PICkit Serial Analyzer\Firmware. 11.2 HIGHLIGHTS This chapter discusses: • • • • • • • 11.
PICkit™ Serial Analyzer User’s Guide Data streams associated with PICkit™ Serial Analyzer are formatted with markers called “Tag” bytes. A Tag may be stand-alone or accompanied by data. As seen in Table 11-1, the data stream for each state controller has a set of associated Tag bytes defined in detail later in the document. Exec manages the interface with the host.
PICkit™ Serial Analyzer Firmware TABLE 11-3: STATUS BLOCK Tag Bytes 11.4 Definition 0-3 Exec section 4-11 Generic Comm section 12-19 Protocol specific communication section EXEC The Exec module will directly decode the data stream from the host. The list of different commands is shown in Table 11-4. Every data stream from the software to the PICkit™ Serial Analyzer begins with one of the following Exec command Tag bytes.
PICkit™ Serial Analyzer User’s Guide TABLE 11-5: TAG BYTE 0x01 COMMAND CODES CMD Description 0x00 Master Reset: Exec Reset, Comm Reset (idled) 0x01 Comm initialization: Comm is initialized as defined by CONTROL_BLOCK 0x02 Request EXEC_STATUS_PACKET (Ref.
PICkit™ Serial Analyzer Firmware Tag bytes 0x03, 0x04 and 0x05 write data bytes to their respective script buffers. In the current architecture, Script Buffer 1 (CBUF1) is used to store communication commands that will be fetched and executed by the Comm block. So, Tag byte 0x03 is used to delineate data that is to be sent to the script buffer including communication protocols to be sent to the unit under test. Tag bytes 0x04 and 0x05 are typically not used.
PICkit™ Serial Analyzer User’s Guide TABLE 11-9: EXEC TAG (EDATA) BYTES (CONTINUED) Tag/EDATA LEN 0x87 N+2 0x88 2 Name Description Data from CBUF3 CBUF3_DATA 0 Tag 1 Configuration byte 2 : N+1 Data: from CBUF3 Packet number PACKET_ID 0 Tag 1 Data: arbitrary packet ID# Tag byte 0x80 means the transaction is over. Tag byte 0x81 signifies that the following data is the firmware version. 0x82 signifies that the data following is the control block (CONTROL_BLOCK).
PICkit™ Serial Analyzer Firmware 11.5 COMM The Comm module will decode Tag bytes from the data stream in the script buffer. The Tag bytes may represent commands to internally configure the PICkit™ Serial Analyzer and report status, or the Tag bytes may be protocol specific identification that needs to be translated into the device under test’s protocol and communicated to the device. The Comm module performs both of these functions.
PICkit™ Serial Analyzer User’s Guide TABLE 11-11: COMM SCRIPT COMMAND TAG BYTES (CONTINUED) Tag/CCMD LEN 0x1D 1 MACRO_DATA_START Name Mark start of “macro” data block Description 0x1E 1 MACRO_DATA_END Mark end of “macro” data block 0x1F 2 MARKER Script “marker” 0 Tag 0 0x20 1 EVENT_TIMER_RESET Tag 0 Tag 1 Marker Event timer Reset 0 Tag TABLE 11-12: COMM SCRIPT DATA TAG BYTES Tag/CDATA LEN 0x00 – 0x0F 16 RESERVED RESERVED 0x10 2 DATA_BYTE Data byte follows 0x11 0x12 0
PICkit™ Serial Analyzer Firmware TABLE 11-13: COMM SCRIPT CONTROL BLOCK Byte Bit Description Comm: GENERAL 8 7:0 9 7:0 Comm mode: 00: IDLE 01: I2CM 02: SPI-M 04: USART-A 05: USART-SM 07: I2 0A: LIN 0B: MWIRE-M Comm control bits 0 1 2 3 4 5 6 7 7:0 0 1 2 3 4 5 6 7 7:0 7:0 7:0 7:0 7:0 1 = Enable event markers – global 1 = Enable event markers – time-stamp n/a n/a 1 = Enable Pull-ups 1 = VSRC: On 1 = VSRC: variable 1 = Abort macro execution Bit flags 1 = Event marker enable: macro loop 1 = Event marke
PICkit™ Serial Analyzer User’s Guide TABLE 11-14: COMM SCRIPT STATUS BLOCK Byte Bit Description Comm: GENERAL 4 5 6 7 8 9 10 11 11.6 7:0 0 1 2 3 4 5 6 7 7:0 0 1 2 3 4 5 6 7 7:0 7:0 7:0 7:0 7:0 7:0 Comm status: error Time-out AB0 Time-out AB1 Comm initialization error VSRC fault Data error (e.g., unrecognized Tag, missing data, etc.
PICkit™ Serial Analyzer Firmware TABLE 11-16: I2CM CONTROL BLOCK Byte Bit Description Comm: I2CM 16 17 18 19 20 21 22 23 © 2009 Microchip Technology Inc.
PICkit™ Serial Analyzer User’s Guide TABLE 11-17: I2CM STATUS BLOCK Byte Bit Description Comm: I2CM 12 13 14 15 16 17 18 19 7:0 0 1 2 3 4 5 6 7 7:0 0 1 2 3 4 5 6 7 7:0 7:0 7:0 0 1 2 3 4 5 6 7 7:0 7:0 7:0 Bit flags: error status WCOL error SSPOV error received NACK when ACK was expected Composite error Bit flags: info status AUX1 – state (0 | 1) AUX2 – state (0 | 1) AUX1 – direction (1=IN, 0=OUT) AUX2 – direction (1=IN, 0=OUT) n/a n/a n/a n/a SDA Line Voltage (255 = 5V) SCL Line Voltage (255 = 5V)
PICkit™ Serial Analyzer Firmware .
PICkit™ Serial Analyzer User’s Guide TABLE 11-18: I2CM ‘CMD’ TAG BYTES (CONTINUED) 0x95 1 I2CM _AUX1_WAIT_1 wait AUX1 == 1 0 0x96 2 1 I CM _AUX2_RST 1 I2 1 I2 1 2 I CM _AUX2_IN 1 I2 1 I2CM AUX2: 0 0 0x97 CM _AUX2_SET CM _AUX2_OUT CM _AUX2_WAIT_0 _AUX2_WAIT_1 Tag wait AUX2 == 0 0 0x9B Tag AUX2 direction: INPUT 0 0x9A Tag AUX2 direction: OUTPUT 0 0x99 Tag AUX2: 1 0 0x98 Tag Tag wait AUX2 == 1 0 Tag An example of a data stream in the script buffer that would direct the
PICkit™ Serial Analyzer Firmware TABLE 11-19: I2CM ‘DATA’ TAG BYTES Tag/ CDATA LEN 0x80 1 Name I2CM_EVENT_START_TX Description Start bit event 0 2 CDATA-Tag 0x81 1 I CM_EVENT_STOP_TX Stop bit event 0x82 1 I2CM_EVENT_RESTART_TX Restart bit event 0 0 2 CDATA-Tag CDATA-Tag 0x83 1 I CM_EVENT_ACK_TX ACK bit event 0x84 1 I2CM_EVENT_NACK_TX NACK bit event 0x85 1 2CM_EVENT_ACK_RX I ACK bit event 0x86 1 I2CM_EVENT_NACK_RX NACK bit event 2 2CM_EVENT_BYTE_TX 0 0 0 0 0x87 0x88 0x8
PICkit™ Serial Analyzer User’s Guide 11.7 I2CS COMMUNICATIONS The I2CS Communication mode is a flexible I2C slave that can be configured to respond to one or more bus addresses. Three operating modes (described below) provide several levels of sophistication and operability. In all modes, transactions can be reported to the host using optional PICkit Serial Analyzer event tags. Additionally, mode-dependant data is available as described below.
PICkit™ Serial Analyzer Firmware FIGURE 11-2: PICkit™ Serial Analyzer Exec Control B Comm I2CS Status H O S T I2C™ USB CBUF1 CBUF2 D E V I C E A CBUF3 A – event data B – I2C™ read data 11.7.1.1.1 Operation The Default mode requires very little configuration/initialization. 1. Issue Cold Start 2. Write Configuration Block (with Comm = I2CS and Mode = 0) 3. Issue Warm Start 11.7.1.
PICkit™ Serial Analyzer User’s Guide 11.7.1.2.1 Operation Execute the following sequence for initialization: 1. Issue Cold Start (Reset) 2. Write Configuration Block (with Comm = I2CS, Mode = 1, Event Markers enabled) 3. Issue Warm Start The host must monitor I2C transactions via the Event Markers. Should the I2C Master request ‘read’ data, the PICkit Serial Analyzer will hold the I2C SCK line low and alert the host with SDATA Tag: I2CS_DATA_RQ.
PICkit™ Serial Analyzer Firmware FIGURE 11-4: PICkit™ Serial Analyzer Exec Control Comm I2CS Status H O S T I2C™ USB CBUF1 CBUF2 CBUF3 D E V I C E A B (Profile) A - event data B - I2C™ read data 11.7.1.3.1 Operation: The host configures the Auto mode as follows: 1. Issue Cold Start (Reset) 2. Write Configuration Block (Comm = I2CS, Mode = 2, appropriate Event Markers enabled) 3. Write Slave Profile to CBUF3 4.
PICkit™ Serial Analyzer User’s Guide TABLE 11-21: Table-Tag(1) DESCRIPTION 0x10 Slave Address 0x2X Register Definition 0x40 End of Slave Profile Note 1: The upper nibble defines the Table-Tag, the lower nibble is reserved for option flags TABLE 11-22: TABLE-TAG: SLAVE ADDRESS (0X20) Table-Tag: SLAVE ADDR: 0x20 Data: Slave Address Data: (Reserved) Data: (Reserved) The slave definition is 4 bytes long (including the tag). Two bytes are reserved for firmware operation.
PICkit™ Serial Analyzer Firmware EXAMPLE The following slave profile defines 2 slave addresses – 2 registers for 1 and 1 register block for the other.
PICkit™ Serial Analyzer User’s Guide 11.7.2 Configuration/Status 11.7.2.
PICkit™ Serial Analyzer Firmware 11.7.2.2 STATUS_BLOCK TABLE 11-28: BYTE BIT DESCRIPTION Comm: I2CS 12 7:0 bit flags: error status 0 Slave profile malformed (mode 2) 1 2 3 4 13 5 SSPOV 6 WCOL 7 composite error 7:0 bit flags: info status 0 SCK line state (0 | 1) 1 SDA line state (0 | 1) 2 3 4 5 6 7 14 7:0 15 7:0 16 7:0 17 7:0 18 7:0 19 7:0 © 2009 Microchip Technology Inc.
PICkit™ Serial Analyzer User’s Guide 11.7.3 Communication Tags 11.7.3.
PICkit™ Serial Analyzer Firmware 11.7.3.
PICkit™ Serial Analyzer User’s Guide 11.8 SPI COMMUNICATIONS SPI is a 4-wire serial protocol that uses data in, data out, clock and Chip Select pins. It is a very basic protocol using a clock edge to capture data. The CONTROL_BLOCK is used to enable SPI event markers, set the bit rate and configure transaction/protocol options.
PICkit™ Serial Analyzer Firmware TABLE 11-33: BIT RATE CODES FOSC 20 MHz 20 MHz 20 MHz 20 MHz 20 MHz 20 MHz Pre-Scale Code Pre-Scale Value Scale Code Scale Value Total Scale Value 0x00 0x00 0x01 0x01 0x02 0x02 8 8 32 32 128 128 0x00 0xFF 0x00 0xFF 0x00 0xFF 1 256 1 256 1 256 8 2048 32 8192 128 32768 Bit Rate 2.500 MHz 9.766 kHz 0.625 MHz 2.441 kHz 0.156 MHz 0.610 kHz TABLE 11-34: SPI STATUS BLOCK Byte Bit Description Comm: SPI 12 13 14 15 16 17 18 19 © 2009 Microchip Technology Inc.
PICkit™ Serial Analyzer User’s Guide TABLE 11-35: SPI ‘CMD’ TAG BYTES Tag/CCMD LEN 0x83 3 SPI_BITRATE 0x84 2 SPI_DATAIO_IN 0x85 N+2 SPI_DATAIO_OUT 0x86 N+2 SPI_DATAIO_INOUT 0x87 1 SPI_SDO_IN 0x88 1 SPI_SDO_OUT 0x8A 1 SPI_INIT 0x8B 1 SPI__ON Assert CS(1) 0 Tag 0x8C 1 SPI__OFF De-assert CS(1) 0 Tag Note 1: Name Description Set bit rate 0 Tag 1 scaler 2 pre-scaler (ref section x.x.
PICkit™ Serial Analyzer Firmware 11.9 USART COMMUNICATIONS Universal Synchronous Asynchronous Receive Transmit (USART) protocol is a standard 2-wire serial communication. In Asynchronous mode, there is a transmit line and a receive line. In Synchronous mode, the transmit line becomes the clock line and the receive line becomes the bidirectional data line. In Asynchronous mode, 8 bits are framed by a Start and Stop bit. A ninth bit can be included to use as a parity bit.
PICkit™ Serial Analyzer User’s Guide TABLE 11-39: USART CONTROL BLOCK Byte Bit Description Comm: USART 16 17 7:0 7:0 0 1 2 3 4 5 6 7 7:0 0 1 2 3 4 5 6 7 7:0 7:0 7:0 0 1 2 3 4 5 6 7 7:0 7:0 18 19 20 21 22 23 n/a 1 = clock polarity (dflt) 1 = high-low at Start bit cell, 0 = low-high (USART-SM only, ignored otherwise) 1 = n/a 1 = Async receive disable (USART-A only, ignored otherwise) 1 = n/a 1 = n/a 1 = n/a 1 = n/a 1 = n/a 1 = Event marker enable: read byte 1 = Event marker enable: write byte 1 = Even
PICkit™ Serial Analyzer Firmware TABLE 11-41: USART STATUS BLOCK Byte Bit Description Comm: USART 12 13 14 7:0 0 1 2 3 4 5 6 7 7:0 7:0 0 1 2 15 16 17 18 19 © 2009 Microchip Technology Inc.
PICkit™ Serial Analyzer User’s Guide TABLE 11-42: USART ‘CMD’ TAG BYTES Tag/ CCMD LEN 0x80 1 Name USART_INIT Description Initialize USART controller 0 0x82 0x83 N+2 2 USART_DATA_XMT USART _DATA_SRCV (USART-SM only) Transmit data 0 Tag 1 Byte count = N 2 Data N+1 Data Receive data 0 Tag 1 Byte count = N 0x84 1 USART_DATA_ARCV_ENABLE (USART-A only) Enable receive data monitor 0x85 1 USART_DATA_ARCV_DISABLE (USART-A only) Disable receive data monitor 0x86 1 USART_BREAK_XMT (US
PICkit™ Serial Analyzer Firmware TABLE 11-42: USART ‘CMD’ TAG BYTES (CONTINUED) 0x97 1 USART_AUX2_SET AUX2: 1 0x98 1 USART_AUX2_OUT AUX2 direction: Output 0x99 1 USART_AUX2_IN AUX2 direction: Input 0x9A 1 USART_AUX2_WAIT_0 wait AUX2 == 0 0x9B 1 USART_AUX2_WAIT_1 wait AUX2 == 1 Tag 0 Tag 0 Tag 0 Tag 0 Tag 0 TABLE 11-43: USART ‘DATA’ TAG BYTES Tag/CDATA LEN 0x80 2 0x81 0x82 0x83 2 2 1 Name USART_EVENT_BYTE_TX USART_EVENT_BYTE_RX USART_EVENT_STATUS_ERR USART_EVENT_BRE
PICkit™ Serial Analyzer User’s Guide 11.10.2 Configuration/Status 11.10.2.
PICkit™ Serial Analyzer Firmware 11.10.2.2 STATUS_BLOCK TABLE 11-45: BYTE BIT DESCRIPTION Comm: LIN 12 7:0 bit flags: error 0 FERR – framing error 1 OERR – overrun error 2 FAULT – from LIN bus adapter 3 Auto-Baud Detect error (e.g.
PICkit™ Serial Analyzer User’s Guide MONITOR To configure the PICkit Serial Analyzer to perform as LIN bus monitor, the host must write the CONTROL_BLOCK to specify: 1. LIN adapter ‘Chip Select’ line state 2. Set ‘receive enable’ Configuration bit to allow the PICkit Serial Analyzer to receive RX data and report it to the HOST 3. Set ‘auto-baud enable’ Configuration bit to allow PICkit Serial Analyzer to track baud rate of bus transactions Optionally, 1. Enable desired combination of event markers 11.10.
PICkit™ Serial Analyzer Firmware 11.10.3.2 TAG: SDATA Tag commands and data returned from the PICkit Serial Analyzer.
PICkit™ Serial Analyzer User’s Guide The auto-baud operation depends on receiving a ‘Break’ (13 bits of 0’s) followed by a ‘Sync’ (byte 0x55). Referring to the timing diagram below – the Break begins at ‘A’. At ‘B’ the PICkit Serial Analyzer expected a Stop bit – the USART interrupts the PICkit Serial Analyzer (RCIF – receive interrupt flag) and sets FERR (framing error).
PICkit™ Serial Analyzer Firmware LIN specifications limit the baud rate to 20k (Reference the following table for examples). Baud = FOSC/(4 * (BRG_CODE + 1)) where: FOSC = 20 MHz TABLE 11-48: © 2009 Microchip Technology Inc. BAUD CODE ACTUAL ERROR 100 49999 100.0 0.00% 200 24999 200.0 0.00% 300 16666 300.0 0.00% 400 12499 400.0 0.00% 500 9999 500.0 0.00% 600 8332 600.0 0.00% 700 7142 700.0 0.00% 800 6249 800.0 0.00% 900 5555 899.9 -0.01% 1000 4999 1000.0 0.
PICkit™ Serial Analyzer User’s Guide NOTES: DS51647C-page 128 © 2009 Microchip Technology Inc.
PICkit™ SERIAL ANALYZER USER’S GUIDE Chapter 12. PICkit™ Serial Analyzer DLL 12.1 INTRODUCTION Custom software programs can be created by accessing the Dynamically Linked Library (DLL), PICkitS.dll, with the software language of your choice. All of the functionality to create tag byte scripts that will be converted to protocol scripts is built into the DLL and is very easy to use. Any programming language that can access functions from a DLL can be used, however, a Microsoft.
PICkit™ Serial Analyzer User’s Guide NOTES: DS51647C-page 130 © 2009 Microchip Technology Inc.
PICkit™ SERIAL ANALYZER USER’S GUIDE Chapter 13. Troubleshooting 13.1 INTRODUCTION This chapter describes questions and answers to common problems associated with using the PICkit™ Serial Analyzer and how to resolve them. 13.2 FREQUENTLY ASKED QUESTIONS PICkit™ Serial Analyzer could not be found Question I am receiving the error message, “PICkit™ Serial Analyzer could not be found” in the Transactions window, but the PICkit™ Serial Analyzer is plugged in.
PICkit™ Serial Analyzer User’s Guide Microsoft® Windows® 95/98/NT Question Can I run on Windows® 95/98/NT? Answer No. These operating systems either do not support USB or have drivers that are not compatible. DS51647C-page 132 © 2009 Microchip Technology Inc.
PICkit™ SERIAL ANALYZER USER’S GUIDE Appendix A. PICkit Serial Analyzer Schematics A.1 INTRODUCTION This appendix contains the PICkit Serial Management hardware diagrams. FIGURE A-1: PICkit™ SERIAL ANAYLZER SCHEMATIC (SHEET 1 OF 2) © 2009 Microchip Technology Inc.
PICkit™ Serial Analyzer User’s Guide FIGURE A-2: DS51647C-page 134 PICkit™ SERIAL ANALYZER SCHEMATIC (SHEET 2 OF 2) © 2009 Microchip Technology Inc.
PICkit Serial Analyzer Schematics FIGURE A-3: SILKSCREEN FIGURE A-4: TOP COPPER FIGURE A-5: BOTTOM COPPER © 2009 Microchip Technology Inc.
PICkit™ Serial Analyzer User’s Guide NOTES: DS51647C-page 136 © 2009 Microchip Technology Inc.
PICkit™ SERIAL ANALYZER USER’S GUIDE Appendix B. 28-Pin Demo Board I2C™ Demonstration Firmware B.1 INTRODUCTION The 28-Pin Demo Board I2C™ demonstration firmware communicates with the PICkit™ Serial Analyzer using the I2C serial protocol. The PICkit Serial Analyzer will be the I2C master and the 28-pin demo board will be the I2C slave device. The 28-pin demo board is programmed to emulate an I2C Real-Time Clock (RTC) and Serial EEPROM. B.2 HIGHLIGHTS This chapter discusses: • • • • • B.
PICkit™ Serial Analyzer User’s Guide TABLE B-1: FIRMWARE MODULES MODULE B.5 DESCRIPTION adc.asm ADC service – measuring channel AN0, connected to potentiometer RP1, and post results to register in shared memory device.asm Basic device (microcontroller) configuration ee_util.asm EEPROM Read/Write routines exec.asm “Executive” feature set – provides functionality for test and demonstration of PICkit™ Serial Analyzer and 28-pin demo board i2c_slave_pksd.
28-Pin Demo Board I2C™ Demonstration Firmware I2C™ WRITE BYTE(S) FIGURE B-2: SLAVE-ADR [W] S A DATA WORD-ADR DATA A DATA A A P Read Byte(s) with Word Address – The word address is set to begin at a given value and incremented sequentially during the transaction.
PICkit™ Serial Analyzer User’s Guide TABLE B-3: REAL-TIME CLOCK (RTC) WORD ADDRESSES (CONTINUED) 0x08 RTC_YEARS 00-99 year, coding: BCD 0x09 RTC_ALARM_MIN 00-59 minute of alarm, coding: BCD bit 7: enable 0x0A RTC_ALARM_HOUR 00-23 hour of alarm, coding: BCD bit 7: enable 0x0B RTC_ALARM_DAY 01-31 day of alarm, coding BCD bit 7: enable 0x0C RTC_ALARM_WEEK 00-06 weekday of alarm bit 7: enable 0x0D (not assigned) 0x0E (not assigned) 0x0F (not assigned) B.6.
28-Pin Demo Board I2C™ Demonstration Firmware TABLE B-4: REG TABLE B-4 EXECUTIVE (EXEC) WORD ADDRESSES NAME DESCRIPTION 0x00 EXEC_STATE State of executive state controller bit 7 == 1: force state controller to one of eight “entry points” specified by bits[2:0] 0x01 EXEC_ADC_CH0 ADC results of CHANNEL AN0 (potentiometer RP1) 0x02 EXEC_RTC_SE binary value representation of RTC “SECONDS” 0x03 EXEC_STATUS state of communications connector pins: bit 0: PIN 1 (AUX1) bit 1: PIN 4 (SDA) bit 2: PIN 5 (
PICkit™ Serial Analyzer User’s Guide B.7 FUNCTIONS B.7.1 Ping-Pong Display The Ping-Pong display is useful in testing the four LEDs which are illuminated individually and in sequence as seen below. The following pattern is executed at a 100-millisecond step interval. FIGURE B-6: B.7.
28-Pin Demo Board I2C™ Demonstration Firmware B.7.3 ADC Display The ADC Display begins by displaying hex values 0x0A, 0x0D and 0x0C in sequence to signify “ADC” test. After the opening display sequence, the LEDs displays the Most Significant 4 bits of the ADC result measuring channel AN0 (potentiometer RP1). As RP1 is manually turned from one extreme to the other, the LED display should range from binary 0000 to 1111. The firmware must be forced from this mode by command or Reset. B.7.
PICkit™ Serial Analyzer User’s Guide NOTES: DS51647C-page 144 © 2009 Microchip Technology Inc.
PICkit™ Serial Analyzer User’s Guide NOTES: © 2009 Microchip Technology Inc.
WORLDWIDE SALES AND SERVICE AMERICAS ASIA/PACIFIC ASIA/PACIFIC EUROPE Corporate Office 2355 West Chandler Blvd. Chandler, AZ 85224-6199 Tel: 480-792-7200 Fax: 480-792-7277 Technical Support: http://support.microchip.com Web Address: www.microchip.