Rl-Arm: RTX Real-Time Kernel Tcpnet Networking Suite Flash File System Usb Device Interface Can Interfaces

Download as pdf or txt
Download as pdf or txt
You are on page 1of 48

RL-ARM

RTX Real-Time Kernel TCPnet Networking Suite Flash File System USB Device Interface CAN Interfaces June 2009

Software Development Tools

Microcontroller have

Processor On-chip Memory Interrupt System Rich peripheral set

Todays Microcontroller Selection


On-chip Flash JTAG Debug Serial Wire Debug (SWD) & Serial Wire Viewer (SWV) Cortex-M3 Power management, RTC, reset and watchdog, internal oscillator and PLL USB 2.0 Interface 12-bit A/D converter (Sixteen channels) 10/100 Ethernet MAC SD/MMC card Interface Two CAN Channels Three USART Channels Two channels for I2C, I2S, SPI & SSI 16-bit standard Timers including PWM

SRAM,

I/O Pins, Timers, PWM A/D and D/A converters UART, SPI, I2C Complex communication peripherals (CAN, USB, Ethernet)

80 GPIO Pins

Block Diagram of a Standard Microcontroller

Embedded devices are used everywhere



Need to support many different interfaces and different protocols

Embedded Connectivity Challenges


CAN, USB, SD/MMC, Ethernet HTTP, FTP, SMTP...

Customers demand ease of use Developers need more functionality


Ability to support a wide range of interfaces Need better development and debug tools for this task Todays embedded devices need to support plug and play compatibility

A collection of resources for solving these challenges

Middleware components created and used by ARM engineers


All components are royalty-free All library components supplied - no hidden costs Flexible usage model (with or without the RTX Kernel)

What is RL-ARM?

Provided for many popular microcontrollers

Delivered as libraries and source code

Uses RTX Kernel messaging implementation

Everywhere that embedded devices are connected



It supports traditional embedded functions

Where is RL-ARM used?


For example CAN in industrial applications Web-based and mass storage products

And emerging applications for embedded devices

In simple and complex applications



Optimized routines give fast performance from a small code footprint Component libraries can be used stand-alone or integrated with other resources and optional RTX kernel Templates and examples are provided for all applications on lots of popular microcontrollers

Integrated solution

How does RL-ARM work for me?


Developed with MDK-ARM, the tools and middleware are guaranteed to work together ARM engineers can support every part of your project

Cost effective
Allows you to focus effort on developing the important parts of your application Provides tested and optimized components

Proven and reliable


Thousands of designs using RL-ARM in the field today Trusted in applications by ARM and its partners

Using RL-ARM with MDK-ARM



Build options include settings for RL-ARM resources Debugger includes RTX Kernel awareness

MDK includes dedicated support for RL-ARM functionality


Examples supplied as Vision projects ready to build

Detailed view of system status from Vision IDE


8

Vision Configuration Wizard


User friendly way to adjust settings

Less risk of making mistakes Simple checking of selected values No need to search for relevant source code sections All useful parameters are instantly accessible

TCP/IP Networking Suite

RL-TCPnet

10

TCPnet Networking Suite


Add network support to your projects quickly and easily


Libraries support common network protocols Supplied with templates and examples ready to port to any target Take advantage of standard networking applications

Email, SMTP

Modem, PPP

Remote Access, Telnet

Serial, SLIP

Web interface, HTTP

TCPnet Networking Suite HTTP Server ARP, IEEE 802.xx network CGI Scripting TCP UDP Telnet Server FTP Server ARP DHCP SMTP Server DNS Resolver PPP SLIP

Ethernet

Modem UART

Debug UART

11

Example using networked devices


Control LEDs from a remote PC or another board Example implementations of TCP and UDP
PC running LED Switch Utility

LAN Ethernet Switch LEDSwitch Utility


C++ PC application with source code

Evaluation Boards with LED Switch Client


12

Example using a HTTP server


Access the board from a browser
Control LEDs & LCD etc View board status, switches inputs etc TCPnet includes a HTTP server Typically used to host web-sites Also provides a web-style interface

C interface to CGI scripts

to your application

13

Using TCPnet to enable Ethernet


Two items must be added to the project

Both supplied with RL-ARM


Library containing TCP stack and hardware drivers Configuration settings for network components

Ethernet can be enabled and parameters chosen graphically


Check-boxes enable desired network components Configurable options instantly accessible via configuration wizard

14

TCPnet built-in debug support


TCPnet provides optional debug information
Control the debug level for each network component

View network activity via log files or terminal window

15

TCPnet Performance
UDP Packet size 10 200 400 600 800 1000 1200 1400 Packets / sec 19,790 21,370 17,490 14,230 11,950 10,370 9,120 8,140 kByte / sec 176 4,164 6,820 8,330 9,360 10,090 10,670 11,130 Packets / sec 7,540 6,450 5,600 4,730 4,210 3,736 3,322 3,082 TCP kByte / sec 74 1,272 2,202 2,782 3,300 3,652 3,894 4,215

Examples shown using Cortex M3 device at 96MHz, 100 Mbps full duplex Using CMSIS compatible Ethernet drivers

16

TCPnet footprint 5 sockets enabled


HTTP Server (without RTX Kernel) HTTP Server (with RTX Kernel) Telnet Server TFTP Server SMTP Client Demo Example Total ROM Size 41,984 Bytes 45,240 Bytes 22,312 Bytes 34,996 Bytes 16,736 Bytes 11,220 Bytes 15,328 Bytes 15,328 Bytes Total RAM Size 20,112 Bytes 21,776 Bytes 20,112 Bytes 24,320 Bytes 19,600 Bytes 19,568 Bytes 19,576 Bytes 19,776 Bytes

LED Switch Server LED Switch Client DNS Resolver

HTTP Server: Web Server supporting dynamic Web pages and CGI Scripting Telnet Server: with command line interface, authorization etc TFTP Server: for uploading files (for example Web pages to a Web Server) SMTP Client: for sending automated emails LED Switch Server and Client: shows basic TCP/IP and UDP communication DNS Resolver: used to resolve IP address from the host name Further TCP sockets require an approximate 2kB additional space
17

Flash File System

RL-Flash

18

Flash File System (RL-Flash)

Enables industry-standard file system compatibility

Accessed via standard I/O function calls Two file system implementations provided Small & fast file system for internal RAM and ROM FAT32/16/12 for external storage SPI Flash, SD/MMC cards
8.3 and long filenames, royalty-free option available

ROM/RAM, data access

SD/MMC, storage

Flash File System


Standard C File I/O Functions File Table ROM RAM Flash Driver Flash ROM FAT32/16/12 SD/MMC

Sub-directories, folder support

19

RL-Flash Example

Standard file I/O with SD Card Command line interface Interfaces with UART or RTX

SD Card

20

RL-Flash Performance
Board MCBSTM32 LM3S8962 LM3S6965 LM3S3768 Device ST STM32 CPU Core Cortex-M3 Cortex-M3 Cortex-M3 Cortex-M3 ARM9 ARM7 ARM7 ARM7 ARM9 ARM7 CPU [MHz] 72 50 50 50 99 48 48 60 48 60 Card Interface SPI at 18MHz SPI at 12.5MHz SPI at 12.5MHz SPI at 12.5MHz SD4 at 25MHz SD4 at 24MHz SD4 at 24MHz SPI at 7.5MHz SPI at 12MHz SPI at 15MHz Write [KB/s] 711.1 537.8 539.2 539.5 4,083.8 4,084.3 3,946.3 299.4 355.2 402.2 Read [KB/s] 758.1 607.6 603.6 603.8 5,403.7 5,525.9 5,330.6 313.4 357.1 416.1 Luminary LM3S8962 Luminary LM3S6965 Luminary LM3S3768 Atmel AT91SAM9G20 NXP LPC2468 NXP LPC2368 NXP LPC2148 ST STR912 ST STR750

AT91SAM9G 20-EK MCB2400 MCB2300 MCB2140 MCBSTR9 MCBSTR750

Figures shown were achieved working with 4MB of data in 4KB blocks
21

USB Device Interface

RL-USB

22

USB Device Interface (RL-USB)

Offer plug and play compatibility for your design Enables interfaces for standard USB device classes
Uses native drivers provided for Windows 2000/XP/Vista

Human interface devices

Audio, entertainment & communications

Mass storage, drives, cameras...

Comms devices, telephone modems...

23

RL-USB Configuration

Device configuration settings are easy to access


User must select the appropriate settings for their device Start with a standard USB template Adjust USB Core Parameters Update the Device Descriptors Extend the USB Event Handlers Composite devices Single device with multiple functions e.g. keyboard with mousepad Configure each function in turn Implement USB Class Code Add USB Class Code from
the related USB Template Re-assign USB Event Handlers

USB Configuration using the Vision Configuration Wizard

24

RL-USB Example HID Template

Human Interface Device Connects to PC without driver LEDs controlled from PC application Switches reported to PC application

HID Client Application supplied with source code

USB

Example USB templates include:


Audio, PC speaker Storage, memory stick CDC, virtual COM port

25

RL-CAN
CAN Interface

26

CAN Interface (RL-CAN)

Generic CAN driver with hardware adaptations

Interrupt-driven hardware layer Supports several ARM-based microcontrollers Common API for access to many CAN controllers Including Atmel, NXP, ST, Luminary, TI, Toshiba
Configure and initialize devices Send, request and receive messages

Implemented using RTX Kernel


Memory Pool Message Passing

27

Hardware

RL-CAN Examples
A/D Converter gets input voltage from Potentiometer Input Voltage sent every second via CAN2 Message received via CAN is shown on LEDs via CAN1 Using Vision Simulation Script generates A/D input voltage Analog Input CAN Tx Messages received via CAN2 Voltage
Incremental Script

CAN Rec

LEDs

28

RL-CAN Virtual Simulation Registers


Vision provides VTREGs

Allows control of communication (CAN, I2C, SSP, SPI) CAN I/O can be simulated and scripted using these registers

29

Vision Debug & Signal Functions


Users can define and generate input functions as
stimuli to simulation models

Scripts for CAN Input and Output Messages Signal Functions Automated Message Processing Periodic CAN Messages

FUNC void SendCANmessage (void) { CAN0ID = 0x4500;// message ID = 0x4500 CAN0L = 2; // message length 2 bytes CAN0B0 = 0x12; // message data byte 0 CAN0B1 = 0x34; // message data byte 1 CAN0IN = 2; // send message with 29-bit ID } FUNC void Print_CANmessage (void) { switch (CAN0OUT) {

case 1: printf("\nSend 11-bit ID=%X", break; case 2: printf("\nSend 29-bit ID=%X", break;

CANAID); CANAID);

} printf("\nMessage Length %d, Data: ", CAN0L); printf("%X %X", CAN0B0, , CAN0B7);

case 3: printf("\nRequest 11-bit ID=%X", CANAID); return; case 4: printf("\nRequest 29-bit ID=%08X", CANAID); return;

30

RTX Real-Time Kernel

31

Software Concepts for ARM


Each task called from main loop Interrupts perform time-critical jobs Stack usage un-predictable User manages task interactions

Embedded applications typically have two design concepts main as Infinite Loop

Using a Real-Time Kernel

Allows application to be separated into independent tasks Message passing eliminates critical memory buffers Each task has its own stack area Interrupt communication with event flags and messages

32

Why use a Real-Time Kernel?

Structured framework for embedded applications

Hardware interface layer Easy expansion of system software Hardware independent Housekeeping Process scheduling CPU resource management Task communication Focus on Application Development Leave basic system management to the RTOS kernel Avoid re-writing resource management code that already exists Reduce porting and testing overheads

33

What makes a Good RTOS?


Performance
Predictable behaviour Low latency High number of interrupt levels Ease of Use Flexible API and implementation Tool-chain integration Scheduling options

Multitasking, Pre-emptive, Round Robin System Friendly

Consumes small amount of system resource Proven kernel Low cost

34

Real-Time?

Real-Time does not simply mean High Speed

Not all tasks are Most Urgent Tasks need to complete before deadline and other tasks Real-Time OS not to be confused with high speed requirements Real-Time, not mission critical Varying levels of Real-Time Hard, Firm, Soft and Non RTOS not confined to critical systems Deterministic behaviour is often most important A Real-Time OS is a framework RTOS provides good multitasking environment Reliable and scalable management of housekeeping tasks

35

RTX Real-Time Kernel

Full-featured real-time kernel for embedded systems Process Management

Create and delete tasks, change task priorities Manage event flag and CPU resources Multi-Tasking Pre-emptive context switching, scheduling, and semaphores Real-Time Control Deterministic behaviour Inter-task communication Mailbox management Interface to interrupt functions Memory allocation Thread-safe (usage even in ISR)
36

RTX Specifications

Provides all real-time kernel requirements


Royalty free

Multi-Tasking Round Robin, Pre-emptive, Cooperative Unlimited User Timers, Semaphores and Mailboxes

Task Specifications Priority Levels No. of Tasks Defined No. of Tasks Active Context Switch Interrupt Latency

Unlimited < 300 Cycles < 100 Cycles 256

256

Memory Requirements CODE Space RAM Space


(depending on used functionality) (each active task requires its own stack space)

1.5K 5K < 500

Bytes

37

RTX Performance
Task Specifications CPU Clock Speed Initialize system, start task Create defined task, (no task switch) Create defined task, (with task switch) Delete Task Task Switch Set event (no task switch) Send semaphore Send message Max Interrupt lockout for IRQ ISRs ARM7TDMI 60MHz 46.2S 17.0S 19.1S 9.3S 6.6S 2.4S 1.7S 4.5S 3.1S Cortex-M3 72MHz 22.1S 8.1S 9.3S 4.8S 3.9S 1.9S 1.6S 2.5S -

38

Enabling RTX in MDK-ARM


Infinite while loop in main() is replaced by an OS initialisation call

Core application duties are defined as RTOS tasks

Graphical configuration of RTOS settings

39

Kernel Aware Debugging


RTX and Vision are tightly integrated

Kernel status information is easily visible

Tasks and Event analysis Resource Loading

40

RTX Event Viewer

Displays task switching and events of a running RTX system


Available on running Cortex-Mx devices or using Vision simulation

41

RTX Examples

Traffic Light LEDs are timed or controlled by push button Uses interrupt control, event management, and multitasking
capabilities of RTX Kernel

42

RTX Examples
CAN Example using RTX Mailbox and event handling CAN Send (Tx) shows automatic data handling capabilities message checking with instant message receipt CAN Rec
task wait and return almost impossible without Real-Time Kernel

Analog Input Voltage

CAN Tx CAN Rec LEDs

Incremental Script

43

Summary of main points


How does RL-ARM work for me?

RL-ARM Whats next?

RL-ARM Roadmap
What new features can I expect to see?

Learn more and get started


Where can I get more information?

44

How does RL-ARM work for me?


Develop robust and powerful applications fast

The RTX kernel and sources, gives you all the resources you need to create and control multi-threaded, real-time applications that can be tailored to your system.

Ensure you only do what you have to

RL-ARM enables USB, TCP/IP networking and file-system support. Use existing resources to ensure you focus on the important parts of your application.

Take advantage of the expertise of others

RL-ARM is designed, tested and optimised by ARM engineers. Documentation and examples make it easy to re-use the work done by our experts.

45

New features coming to RL-ARM


Next release September 2009
RL-Flash FAT FS will tolerate power-failures User/admin access control for HTTP login

Now!

RTX Kernel task C

task A task B
FTP client and host support

Next year

function function 2 1 Library code


Full thread-safe implementation of all features

New lightweight graphics library CMSIS compliant components

Enhanced USB support Host, Hub & OTG

46

Need More Help?

Application Notes on www.keil.com/appnotes 192: Using TCP/IP Examples on ARM Powered Evaluation Boards 195: Developing HID USB Device Drivers For Embedded Systems

47

Get More Information



Program examples Latest technical information Application Notes Program Examples Device Database Support Knowledgebase Discussion Forum

Customers use www.keil.com on a daily basis to obtain

48

You might also like