21
© 2010, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction Purpose: This course provides an overview of the SH7216 Ethernet peripheral with the emphasis on user applications with open source uIP TCP/IP stack Objectives: Obtain basic knowledge on SH7216 Ethernet peripherals Find out what is available from Renesas Learn how to run advanced applications with uIP TCP/IP stack Get other freely available tools Content: 21 pages 3 questions Learning Time: 25 minutes

© 2010, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction Purpose: This course provides an overview of the SH7216 Ethernet

Embed Size (px)

Citation preview

© 2010, Renesas Technology America, Inc., All Rights Reserved1

Course Introduction

Purpose: This course provides an overview of the SH7216 Ethernet peripheral

with the emphasis on user applications with open source uIP TCP/IP stack

Objectives: Obtain basic knowledge on SH7216 Ethernet peripherals Find out what is available from Renesas Learn how to run advanced applications with uIP TCP/IP stack Get other freely available tools

Content: 21 pages 3 questions

Learning Time: 25 minutes

© 2010, Renesas Technology America, Inc., All Rights Reserved2

SH7216 Features

CPU core SH-2A (SuperH RISC Engine) Single core FPU (single precision, double precision)

Operating frequency CPU: bus/peripheral: 100/200MHz:

50MHz/50MHz

Power supply voltage 3.3V+-0.3V(core,I/O), 5.0V+-0.5V(A/D)

On-chip memory 512KB/768KB/1MB Flash memory 64kB/96kB/128KB RAM 32k Data Flash (R/W

30K :Target) with BGO function

External memory interface SDRAM, Byte-selection SRAM, burst ROM 8-bit, 16-bit and 32-bit

Peripheral functions Multifunction 16-bit PWM timer: 16-bit cycle timer: 2ch Watchdog timer: 1ch I2C bus interface: 1ch DMA controller: 8ch + DTC 12-bit A/D converter: 4ch x 2 Units SCI: 4ch SCIF: 1ch (16-stage transmit and receive FIFO)

SH-2A + FPU100/200MHz

ExternalMemory I/F

8/16/32-bit

DMAC(8 Ch)

Flash(512K/768K/1MB)

RAM(64K/96K/128KB)

WDT

USART(5 ch)

I2C, SPI

Multi FunctionTimer2 Unit(16-bit x 6 ch)

Multi FunctionTimer2S Unit

(16-bit x 3 ch)

Compare Timer(16-bit x 2 ch)

12-bit ADC(4ch x 2 units)

I/O Ports

USB 2.0 FSDevice

CAN

Ethernet10/100 MAC

DTC

Data Flash(32KB)

Peripheral functions (con’t) RSPI I/F RCAN I/F Ethernet MAC I/F USB2.0 function (full speed): 1ch

© 2010, Renesas Technology America, Inc., All Rights Reserved3

Ethernet Peripheral

Ethernet Controller (EtherC)

Compliant with Ethernet and IEEE 802.3 frames Type encapsulation (Ethernet)

Length encapsulation (IEEE 803.2)

Supports 10 and 100 Mbps operation

Supports half and full duplex modes

PAUSE MAC layer flow control (IEEE 802.3x) When in full duplex mode

Media Independent Interface (MII) PHY layer interface

Magic Packet detection and Wake-On-LAN (WOL)

PreambleDestination

AddressSource

AddressType/

LengthData FCS

8Bytes 6 6 2 4

Ethernet Frame

46-1500

© 2010, Renesas Technology America, Inc., All Rights Reserved4

Ethernet Peripheral

Ethernet Direct Memory Access Controller (E-DMAC)

Directly connected to EtherC

Reduce CPU workload

Efficient system bus utilization by block transfers

Transmit and receive buffer management Descriptors to define and control the buffers

Support single frame and multi-buffer operation

RX_BUFF

RECEIVE DESCRIPTORS

statusbufsize size

Char *buf_pDiscript *next

statusbufsize size

Char *buf_pDiscript *next

statusbufsize size

Char *buf_pDiscript *next

RX_BUFF

RX_BUFF

***

TX_BUFF

TRANSMIT DESCRIPTORS

statusbufsize size

Char *buf_pDiscript *next

statusbufsize size

Char *buf_pDiscript *next

statusbufsize size

Char *buf_pDiscript *next

TX_BUFF

TX_BUFF

***

© 2010, Renesas Technology America, Inc., All Rights Reserved5

PHY

RECEIVE DESCRIPTORS

TRANSMIT DESCRIPTORS

TX BUFFER

TX BUFFER

TX BUFFER

RX BUFFER

RX BUFFER

RX BUFFER

E-D

MA

C In

terface

RX

TX

MII

MAC

SH7216

Ethernet

Me

mo

ry Bu

s Inte

rface

RX Descriptor Information

TX Descriptor Information

RX DMAC

TX DMAC

E-DMAC

RAM

Inte

rnal B

us

RX FIFO

TX FIFO

CPUC

PU

Me

mo

ry Bu

s

Ethernet Peripheral

PROPERTIESOn passing, 'Finish' button: Goes to Next SlideOn failing, 'Finish' button: Goes to SlideAllow user to leave quiz: At any timeUser may view slides after quiz: After passing quizUser may attempt quiz: Unlimited times

© 2010, Renesas Technology America, Inc., All Rights Reserved8

Renesas Software Library

Demonstration Project

Ethernet peripheral drivers

Complete TCP/IP stack implementation

Web server example

DHCP client

© 2010, Renesas Technology America, Inc., All Rights Reserved9

Renesas Software Library

Application Note

Demonstration setup

DHCP operation

Creation of new Web pages

192.168.1.101

uIP Demo

© 2010, Renesas Technology America, Inc., All Rights Reserved10

uIP TCP/IP Stack

Features of the uIP TCP/IP Stack

Perfect solution for simple applications

Small footprint

Works on 8-bit to 32-bit MCUs

Needs only a timer peripheral

No RTOS required

High-level applications supported

Web server and client

ARP, IP, ICMP (ping), TCP, DHCP, Telnet, DNS

Supported by active community of developers

Developed by Adam Dunkels at Swedish Institute of Computer Science

Free to use and distribute

PROPERTIESOn passing, 'Finish' button: Goes to Next SlideOn failing, 'Finish' button: Goes to SlideAllow user to leave quiz: At any timeUser may view slides after quiz: After passing quizUser may attempt quiz: Unlimited times

© 2010, Renesas Technology America, Inc., All Rights Reserved12

uIP TCP/IP Advanced Demo

© 2010, Renesas Technology America, Inc., All Rights Reserved13

uIP - Advanced Demo

You should see a demo video in another browser window.[If you don’t see another window check for pop-up blocking.]

© 2010, Renesas Technology America, Inc., All Rights Reserved14

uIP – Application Functions

uip_newdata() Checks if new data has received

uip_acked() Checks if the last data sent has been acknowledged

uip_closed() Checks if the connection is closed

uip_send() Sends TCP or UDP data

No support for socket style send

More on this later

uip_listen() Listen a given port for incoming data

© 2010, Renesas Technology America, Inc., All Rights Reserved15

uIP – Running Multiple Applications

Adding a Top Layer

Web server uses TCP port 80

© 2010, Renesas Technology America, Inc., All Rights Reserved16

uIP – Running Multiple Applications

Adding a Top Layer

Advanced demo uses TCP port 5001

© 2010, Renesas Technology America, Inc., All Rights Reserved17

uIP – Sending Data

Main loop – Invoke the stack

uIP stack – Call the application

Top layer application – Multiplex applications

Application handler – Fill in the application data

Main loop – Transmit

Flow of executiondemo_app()

Detect button push uip_poll_conn(s.TCPconn);

uip_process()

UIP_APPCALL();

top_level_appcall()

demo_appcall();

demo_appcall()

uip_send(); return;

demo_app()

Process ARP Write data to E-DMAC peripheral; return;

return;

uip_process()

Application data to send? OK to send? Create TCP/UDP and IP headers return;

uIP stack – Fill in the protocol headers

© 2010, Renesas Technology America, Inc., All Rights Reserved18

uIP – Sending Data

Create application information structure

Fill in connection information

Both for TCP and UDP

Determine when to send data out

Determine whether TCP ACKs can be used

Call uIP stack

For TCP use uip_poll_conn()

For UDP use uip_udp_periodic_conn()

Call uip_send in application handler

Write data to the Ethernet peripheral

© 2010, Renesas Technology America, Inc., All Rights Reserved19

Renesas Rulz

Advanced Demo

GUI demo

SH7126 advanced demo

http://www.renesasrulz.com

© 2010, Renesas Technology America, Inc., All Rights Reserved20

Freely Available Tools

Wireshark

De facto network protocol analyzer

Extensive analysis and frame filtering

Freely available from http://www.wireshark.org

/

Fping

ICMP (ping) message tests the connectivity to

another device

Fping builds on DOS ping utility with more

options

Freely available from http://

www.kwakkelflap.com/fping.html

PROPERTIESOn passing, 'Finish' button: Goes to Next SlideOn failing, 'Finish' button: Goes to SlideAllow user to leave quiz: At any timeUser may view slides after quiz: After passing quizUser may attempt quiz: Unlimited times

© 2010, Renesas Technology America, Inc., All Rights Reserved22

Summary

Basics of SH7216 Ethernet block Ethernet Controller (EtherC) Ethernet Direct Memory Access Controller (E-DMAC) Linked list operation of E-DMAC Code re-usage due to similar peripheral across the families

Demo application Web server DHCP feature

Advanced demo Multiple TCP and UDP connections Throughput measurements

uIP improvements Multiple applications Sending data