560 likes | 725 Views
ID A20L: Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs. Total Phase. Kumaran Santhanam. VP Technology. 12 October 2010. Version: 1.1. Kumaran Santhanam. Vice President of Technology Aardvark and Cheetah host adapter lines
E N D
ID A20L: Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Total Phase Kumaran Santhanam VP Technology 12 October 2010 Version: 1.1
Kumaran Santhanam Vice President of Technology Aardvark and Cheetah host adapter lines Beagle protocol analyzer lines Education B.S. EECS from the University of California at Berkeley M.S. EE from Stanford University Work Experience 20 years experience with embedded systems development 9 years at Total Phase designing hardware and software development tools Currently responsible for developing technology for use in current and future products Key role in providing architecture and technical direction for the product development team
Solutions for Innovation I2C, SPI, and USB communication is ubiquitous across embedded systems.
Total Phase Solutions By using debugging tools manufactured by Total Phase, you can: Debug in real-time Quickly evaluate embedded systems Program EEPROMS and flash memories Easily collaborate with colleagues Maximize productivity
Agenda Introduction to the Renesas SH7216 Demo Kit Introduction to Total Phase Development Tools Lab Lab Set Up Aardvark host adapter and Control Center Software Beagle protocol analyzers and Data Center Software Bug 1: I2C LCD Bug 2: Read I2C Advanced: Implement SPI Feature Q&A
Renesas SH 7216 Demo Kit The SH7216 board can be used to develop custom prototypes using the on-board I/O expansion headers. The board features: SH7216 (running at 192 MHz) FS USB Device Controller MicroSD Card Socket On-Board E10A Debugger 3-Axis Analog Accelerometer Microphone 2x8 Character LCD EEPROM 12 LEDs (to simulate motor winding) Potentiometer Your Company Logo HERE 7
Renesas SH7216 Demo Board 3-Axis Accelerometer EEPROM Reset JN5 JN1 LCD Beagle Header E10A Debugger Circuitry Mini USB 3D Power USB Port Motor LEDs E² Beagle Micro SD SH7216 Ethernet PHY USB Port Expansion Area Audio CAN Circuit Mic JN6 JN2 Volume 8
Renesas SH7216 Demo Board EEPROM Reset LCD Beagle Header E10A Debugger Circuitry Mini USB Power USB Port Motor LEDs E² Beagle Micro SD SH7216 USB Port 9
Renesas SH7216 Demo Board EEPROM Reset LCD Beagle Header E10A Debugger Circuitry Mini USB Power USB Port Motor LEDs E² Beagle Micro SD SH7216 I2C USB Port USB SPI 10
Aardvark I2C/SPI Host Adapter • General purpose I2C/SPI master or slave • Active communication on the I2C bus up to 800 kHz • Active communication up to 8 MHz as an SPI master • and up to 4 MHz as an SPI slave • GPIO with selectable pins Aardvark I2C/SPI Host Adapter
Beagle Protocol Analyzers Beagle USB 480 Protocol Analyzer Non-intrusively monitor high-, full-, and low-speed USB 2.0 Interactive Real-Time Display, Filter, and Search Real-time class-level decoding Beagle I2C/SPI Protocol Analyzer Non-intrusively monitor I2C and SPI Interactive Real-Time Display, Filter, and Search Beagle USB 480 Protocol Analyzer Beagle I2C/SPI Protocol Analyzer 13
Total Phase Software Data Center Software LiveDisplay LiveFilter LiveSearch 32-bit and 64-bit support Tree View and Block View Cross-platform compatible Control Center Software Read and Write I2C/SPI messages XML Batch Script support Built-in Help System Multiple adapter support Cross-platform compatible 14
Make sure you have all the materials listed on the lab handout. Confirm that the board power adapter is connected and plugged into an outlet. Plug the Beagle I2C/SPI analyzer and Aardvark adapter into the 10-pin split cable. Connect the Beagle USB 480 analyzer to the computer via the analysis and host ports. Verify the DIP switch, SW1, is set to the correct DEBUG configuration shown below. Section 1: Lab Set Up 16
Section 1: Lab Set Up Connect the mini-B USB cable to the debugger. EEPROM Reset LCD Beagle Header E10A Debugger Circuitry Mini USB Power USB Port Motor LEDs E² Beagle Micro SD SH7216 I2C USB Port USB SPI 17
Section 2: Aardvark Host Adapter • Open the Control Center Software • Click Configure Aardvark Adapter • Select the Device and Click OK • Type in the slave address 0x50 • Set the bit rate to 100 kHz
Section 2: Aardvark Host Adapter • In the message box, type 00. This is your offset. • Click Master Write. • Click Master Read. • In the message box type 00 00 11 22 33 44 55 66 77. • Click Master Write. • In the message box, re-enter the offset, 00. • Click Master Write • Click Master Read.
Section 3: Beagle Protocol Analyzers • Open the Data Center Software. • Click Connect to Analyzer. • Select the I2C/SPI analyzer and Click OK. • Click Device Settings and Select I2C. • Set the sampling rate to 50 MHz. • Set the protocol lens to I2C. • Start the capture.
Open HEW Select Browse to Another Workspace Open the RSK7216-HID.work folder in c:\Workspace Select the RSK7216-HID.hws project Section 4: Development Start Up 24
Section 4: Development Start Up Select DebugConnect Select 10A USB Emulator OK 25
Section 4: Development Start Up Press the reset button and hit enter. Leave the default System Clock settings to 12.00 MHz Leave the ID Code as E10A (default) EEPROM Reset LCD E10A Debugger Circuitry Beagle Header Mini USB Power USB Port Motor LEDs E² Beagle Micro SD SH7216 I2C USB USB Port SPI 26
Section 4: Development Start Up Select BuildBuild All Click YES when the confirmation request appears Select DebugReset Go (Shift+F5) 27
Section 4: Development Start Up The motor LEDs will light up and “Renesas USB HID” will display on the LCD screen. LCD Renesas USB HID E10A Debugger Circuitry Power USB Port Motor LEDs E² Beagle Micro SD SH7216 I2C USB Port USB SPI 28
Section 4: Development Start Up Plug in the USB cable to connect the board to the Beagle USB 480 analyzer LCD E10A Debugger Circuitry Power USB Port Motor LEDs E² Beagle Micro SD SH7216 I2C USB Port USB SPI 29
Section 4: Development Start Up Launch RSK_HID.exe from the Host directory The RSK HID Application box will open 30
Section 5: Bug 1 – I2C LCD Diagnosing the Problem Click Connect in the RSK HID Application box. Leave VID = 0x45b Leave PID = 0x2013 32
Section 5: Bug 1 – I2C LCD Test Application Functions • Click Toggle LED • Click Set LCD and Type Renesas Dev Con • Click Clear LCD • Click Write I2C and type “abcdefghijklmnop” • Go back to the Data Center Software • Go back to the application box and Click I2C LCD
Please spend the next 5 minutes trying to find the I2C LCD bug. EEPROM Reset LCD Beagle Header E10A Debugger Circuitry Mini USB Power USB Port Motor LEDs E² Beagle Micro SD SH7216 I2C USB Port 34
Using the Beagle I2C analyzer, we can quickly diagnose this problem. When we Write to I2C, the Data Center displays this transaction. The first byte of data is 00. Remember that 00 is our offset. When we click I2C LCD, the Data Center displays these transactions. If we closely examine the data we see that the write transaction says 08. This means that the data is being pushed to the LCD starting at offset 08. The correct offset is 00 as shown in the first write transaction. Section 5: Bug 1 – I2C LCD Solution 35
Section 5: Bug 1 – I2C LCD Solution Select Debug | Halt Program Make the corrections to source code in line 256. Save (Ctrl+S) Click Build (F7) Click OK to download the module. Click Reset Go (Shift+F5) Click OK when disconnect failure appears. Click Connect in the Application Box Click I2C LCD to verify the solution. 36
Section 6: Bug 2 - Read I2CDiagnosing the Problem • Click Write I2C and type “abcdefghijklmnop” • Click Read I2C
Please spend the next 5 minutes trying to isolate the Read I2C bug. EEPROM Reset LCD Beagle Header E10A Debugger Circuitry Mini USB Power USB Port Motor LEDs E² Beagle Micro SD SH7216 I2C USB Port 39
Using the Beagle analyzers, we can quickly diagnose this problem. When we Read I2C, the Data Center displays these transactions. Using the Details pane, we can see the data is being read correctly from the I2C EEPROM. Section 6: Bug 2 - Read I2CIsolating the Problem 40
Open another Data Center Software Connect to the Beagle USB 480 analyzer Go to Capture Settings and adjust the Data Capture Limit to 700 MB Start the Capture Go to the Bus Pane Section 6: Bug 2 - Read I2CIsolating the Problem 41
In the HEW, click Stop, then Reset Go (Shift+F5) HID USB Demonstration should appear in the bus pane Right click on the device and select Show Only Go to the Filter tab Uncheck Collapsed & SOFs Apply filter Section 6: Bug 2 - Read I2CIsolating the Problem 42
Using the Beagle USB 480 analyzer, we can diagnose this problem. When we Read I2C, the Data Center displays these input reports. Using the Details pane, we can see the data is being read backwards over USB. Section 6: Bug 2 - Read I2CIsolating the Problem 43
Please spend the next 5 minutes trying to find the Read I2C bug. EEPROM Reset LCD Beagle Header E10A Debugger Circuitry Mini USB Power USB Port Motor LEDs E² Beagle Micro SD SH7216 I2C USB Port USB 44
Select Debug | Halt Program Make the corrections to source code. Save (Ctrl+S) Click Build (F7) Click OK to download the module. Click Reset Go (Shift+F5) Click OK when disconnect failure appears. Click Connect in the Application Box Click Read I2C to verify the solution. Section 6: Bug 2 - Read I2CSolution 45
Go back to the Data Center Software running I2C. Stop the capture and Clear the capture (Ctrl+L) Change the Device Settings and Protocol Lens to SPI Start the Capture Go back to the Application Box Click Read SPI Click Write SPI and type “ABCDEFGHIJKLMNOP” Click Read SPI Go back to the Data Center Software and compare the data. Click SPILCD Section 7: Implement SPI FeatureDiagnosing the Situation 47
Modify the source code so that a data stack is created. When Write SPI is clicked, you must be able to write data by SPI multiple times in sequence to the SD Card. When SPI LCD is clicked, you must be able to send data by SPI from the SD Card to the LCD in the reverse sequence. When Read SPI is clicked, you must only be able to read the last data written to the SD Card. Section 7: Implement SPI FeatureThe Task 48
Please take the next 10 minutes to implement this feature. Reset LCD E10A Debugger Circuitry Mini USB USB Port Motor LEDs E² Micro SD Beagle SH7216 USB Port SPI 49
Select Debug | Halt Program At the top of the file, create a variable for stack index. In the Write SPI code, use stack index to write data to sequential locations, incrementing stack index after each write. In the SPI to LCD code, use stack index to retrieve last written data, then decrement stack index to previous location. In the Read SPI code, use stack index to retrieve last written data. Section 7: Implement SPI FeatureSolution 50