ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and...

56
ID A20L: Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total Phase 12 October 2010

Transcript of ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and...

Page 1: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

ID A20L: Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs

Kumaran Santhanam

VP Technology

Version: 1.1

Total Phase

12 October 2010

Page 2: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

2

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

Page 3: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

3

Solutions for Innovation

I2C, SPI, and USB communication is ubiquitous across embedded systems.

Page 4: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

4

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

Page 5: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

5

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

Page 6: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

6

Renesas SH7216 Demonstration Kit

Page 7: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

77

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

Page 8: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

88

Renesas SH7216 Demo Board

SH7216

MotorLEDs

LCD

EEPROM

Beagle

Beagle Header

Power

Micro SD

E10A Debugger Circuitry

USB Port

Mini USB

Ethernet

USB Port

CAN Circuit

Reset

JN5 JN1

JN6 JN2

PHY

Expansion Area

Volume

Audio

Mic

3D

3-Axis Accelerometer

Page 9: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

99

Renesas SH7216 Demo Board

SH7216

MotorLEDs

LCD

EEPROM

Beagle

Beagle Header

Power

Micro SD

E10A Debugger Circuitry

USB Port

Mini USB

USB Port

Reset

Page 10: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

1010

Renesas SH7216 Demo Board

SH7216

MotorLEDs

LCD

EEPROM

Beagle

Beagle Header

Power

Micro SD

E10A Debugger Circuitry

USB Port

Mini USB

USB Port

Reset

USB

SPI

I2C

Page 11: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

1111

Total Phase Development Tools

Page 12: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

12

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/SPIHost Adapter

Page 13: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

1313

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 480Protocol Analyzer

Beagle I2C/SPIProtocol Analyzer

Page 14: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

1414

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

Page 15: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

1515

Section 1: Lab Set Up

Page 16: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

16

1. Make sure you have all the materials listed on the lab handout.

2. Confirm that the board power adapter is connected and plugged into an outlet.

3. Plug the Beagle I2C/SPI analyzer and Aardvark adapter into the 10-pin split cable.

4. Connect the Beagle USB 480 analyzer to the computer via the analysis and host ports.

5. Verify the DIP switch, SW1, is set to the correct DEBUG configuration shown below.

16

Section 1: Lab Set Up

Page 17: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

1717

Section 1: Lab Set Up

SH7216

MotorLEDs

LCD

EEPROM

Beagle

Beagle Header

Power

Micro SD

E10A Debugger Circuitry

USB Port

Mini USB

USB Port

Reset

I2C

SPI

6. Connect the mini-B USB cable to the debugger.

USB

Page 18: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

1818

Section 2: Aardvark Host Adapter

Page 19: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

19

Section 2: Aardvark Host Adapter

1. Open the Control Center Software

2. Click Configure Aardvark Adapter

3. Select the Device and Click OK

4. Type in the slave address 0x50

5. Set the bit rate to 100 kHz

Page 20: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

20

Section 2: Aardvark Host Adapter

6. In the message box, type 00. This is your offset.

7. Click Master Write.

8. Click Master Read.

9. In the message box type 00 00 11 22 33 44 55 66 77.

10. Click Master Write.

11. In the message box, re-enter the offset, 00.

12. Click Master Write

13. Click Master Read.

Page 21: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

2121

Section 3: Beagle Protocol Analyzers

Page 22: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

22

Section 3: Beagle Protocol Analyzers

1. Open the Data Center Software.

2. Click Connect to Analyzer.

3. Select the I2C/SPI analyzer and Click OK.

4. Click Device Settings and Select I2C.

5. Set the sampling rate to 50 MHz.

6. Set the protocol lens to I2C.

7. Start the capture.

Page 23: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

2323

Section 4: Development Start Up

Page 24: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

24

1. Open HEW

2. Select Browse to Another Workspace

3. Open the RSK7216-HID.work folder in c:\Workspace

4. Select the RSK7216-HID.hws project

24

Section 4: Development Start Up

Page 25: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

2525

Section 4: Development Start Up

5. Select Debug Connect

6. Select 10A USB Emulator OK

Page 26: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

26

7. Press the reset button and hit enter.

8. Leave the default System Clock settings to 12.00 MHz

9. Leave the ID Code as E10A (default)

26

Section 4: Development Start Up

EEPROM

Beagle Header

Mini USB

Reset

SH7216

MotorLEDs

LCD

Bea

gle

Power

Micro SD

E10A Debugger Circuitry

USB Port

USB Port

I2C

SPIUSB

Page 27: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

2727

Section 4: Development Start Up

10. Select Build Build All

11. Click YES when the confirmation request appears

12. Select Debug Reset Go (Shift+F5)

Page 28: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

2828

Section 4: Development Start Up

SH7216

MotorLEDs

RenesasUSB HID

LCD

Beagle

Power

Micro SD

E10A Debugger Circuitry

USB Port

USB Port

I2C

SPI

13. The motor LEDs will light up and “Renesas USB HID” will display on the LCD screen.

USB

Page 29: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

2929

Section 4: Development Start Up

SH7216

MotorLEDs

Beagle

Power

Micro SD

E10A Debugger Circuitry

USB Port

USB Port

I2C

SPI

14. Plug in the USB cable to connect the board to the Beagle USB 480 analyzer

LCD

USB

Page 30: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

3030

Section 4: Development Start Up

15. Launch RSK_HID.exe from the Host directory

16. The RSK HID Application box will open

Page 31: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

3131

Section 5: Bug 1 – I2C LCD

Page 32: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

3232

Section 5: Bug 1 – I2C LCD Diagnosing the Problem

1. Click Connect in the RSK HID Application box.

2. Leave VID = 0x45b3. Leave PID = 0x2013

Page 33: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

33

Section 5: Bug 1 – I2C LCD Test Application Functions

4. Click Toggle LED

5. Click Set LCD and Type Renesas Dev Con

6. Click Clear LCD

7. Click Write I2C and type “abcdefghijklmnop”

8. Go back to the Data Center Software

9. Go back to the application box and Click I2C LCD

Page 34: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

3434

Please spend the next 5 minutes trying to find the I2C LCD bug.

SH7216

MotorLEDs

LCD

EEPROM

Beagle

Beagle Header

Power

Micro SD

E10A Debugger Circuitry

USB Port

Mini USB

USB Port

Reset

I2C

Page 35: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

3535

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

Page 36: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

36

Section 5: Bug 1 – I2C LCD Solution

36

10. Select Debug | Halt Program

11. Make the corrections to source code in line 256.

12. Save (Ctrl+S)

13. Click Build (F7)

14. Click OK to download the module.

15. Click Reset Go (Shift+F5)

16. Click OK when disconnect failure appears.

17. Click Connect in the Application Box

18. Click I2C LCD to verify the solution.

Page 37: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

3737

Section 6: Bug 2 - Read I2C

Page 38: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

38

Section 6: Bug 2 - Read I2CDiagnosing the Problem

1. Click Write I2C and type “abcdefghijklmnop”

2. Click Read I2C

Page 39: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

3939

Please spend the next 5 minutes trying to isolate the Read I2C bug.

SH7216

MotorLEDs

LCD

EEPROM

Beagle

Beagle Header

Power

Micro SD

E10A Debugger Circuitry

USB Port

Mini USB

USB Port

Reset

I2C

Page 40: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

4040

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

Page 41: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

4141

3. Open another Data Center Software

4. Connect to the Beagle USB 480 analyzer

5. Go to Capture Settings and adjust the Data Capture Limit to 700 MB

6. Start the Capture

7. Go to the Bus Pane

Section 6: Bug 2 - Read I2CIsolating the Problem

Page 42: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

4242

8. In the HEW, click Stop, then Reset Go (Shift+F5)

9. HID USB Demonstration should appear in the bus pane

10. Right click on the device and select Show Only

11. Go to the Filter tab

12. Uncheck Collapsed & SOFs

13. Apply filter

Section 6: Bug 2 - Read I2CIsolating the Problem

Page 43: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

4343

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

Page 44: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

4444

Please spend the next 5 minutes trying to find the Read I2C bug.

SH7216

MotorLEDs

LCD

EEPROM

Beagle

Beagle Header

Power

Micro SD

E10A Debugger Circuitry

USB Port

Mini USB

USB Port

Reset

I2C

USB

Page 45: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

4545

14. Select Debug | Halt Program

15. Make the corrections to source code.

16. Save (Ctrl+S)

17. Click Build (F7)

18. Click OK to download the module.

19. Click Reset Go (Shift+F5)

20. Click OK when disconnect failure appears.

21. Click Connect in the Application Box

22. Click Read I2C to verify the solution.

Section 6: Bug 2 - Read I2CSolution

Page 46: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

4646

Section 7: Implement SPI Feature

Page 47: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

4747

1. Go back to the Data Center Software running I2C.

2. Stop the capture and Clear the capture (Ctrl+L)

3. Change the Device Settings and Protocol Lens to SPI

4. Start the Capture

5. Go back to the Application Box

6. Click Read SPI

7. Click Write SPI and type “ABCDEFGHIJKLMNOP”

8. Click Read SPI

9. Go back to the Data Center Software and compare the data.

10. Click SPI LCD

Section 7: Implement SPI FeatureDiagnosing the Situation

Page 48: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

4848

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

Page 49: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

4949

Please take the next 10 minutes to implement this feature.

SH7216

MotorLEDs

LCD

Beagle Micro

SD

E10A Debugger Circuitry

USB Port

Mini USB

USB Port

Reset

SPI

Page 50: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

5050

11. Select Debug | Halt Program

12. At the top of the file, create a variable for stack index.

13. In the Write SPI code, use stack index to write data to sequential locations, incrementing stack index after each write.

14. In the SPI to LCD code, use stack index to retrieve last written data, then decrement stack index to previous location.

15. In the Read SPI code, use stack index to retrieve last written data.

Section 7: Implement SPI FeatureSolution

Page 51: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

5151

16. Save (Ctrl+S).

17. Click Build (F7).

18. Click OK to download the module.

19. Click Reset Go (Shift+F5).

20. Click connect in the application box.

Section 7: Implement SPI FeatureSolution

Page 52: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

5252

21. Click Write SPI and type 1111

22. Click Write SPI and type 2222

23. Click Write SPI and type 3333

24. Click Read SPI

25. Click SPI LCD

26. Click SPI LCD

27. Click SPI LCD

28. Click SPI LCD

Section 7: Implement SPI FeatureVerify the Solution

Page 53: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

5353

Questions

Page 54: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

54

Questions

Page 55: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.

55

Feedback Form

Please fill out the feedback form!If you do not have one, please raise your hand

Page 56: ID A20L:Using Embedded Tools for I2C, SPI, and USB Debugging and Development for Renesas MPU and MCUs Kumaran Santhanam VP Technology Version: 1.1 Total.