Critical Design Review 2/26/2009

advertisement

Critical Design Review

2/26/2009

Jay Brasch Daniel Kopelove

Kirk Nichols Katrina Bossert

Project Overview

• Create a sensing vehicle with the following functionality

– Natural gas sensor

– Geiger counter

– Streaming video

• Control various aspects of the vehicle

– Orientation and position of vehicle

– Orientation and position of camera (two-axis control)

Kirk Nichols

Current Project Status

• SCAB I rev c

– New Parts

• ENC28J60

• AtTiny24

• ATF16LV8C

• SCAB II rev a

– New additions

• LPC 2377

• Motor Relays

• Ethernet PHY Module

• Peripherals

– Geiger counter constructed, awaiting radioactive source for sufficient testing

Kirk Nichols

Base Station

Laptop LabVIEW

System Diagram

AtTiny24 ATF16LV8C

USB

Joystick

Vuzix

HUD

(Peripherals)

Ethernet

PHY/MAC

Layer

NXP 2214/2377

Servo

(3)

DC

Motor

Vehicle Control

System Information

Battery

Level

Debug

Port

Kirk Nichols

Sensing Ports

Pulse

(2)

ADC

(2)

Geiger

(Velocity)

Gas

Sensor

UART

(5)

+

ATF750

CPLD

I 2 C

(3)

(Range

Sensors)

(Compass)

SCAB I - AtTiny24

• Peripheral Microcontroller

– 10 MHz

– SPI interface

– Offload the following peripheral interfaces from the LPC 2214/2377

• 8 ADCs

• 12 External interrupt pins

Kirk Nichols

SCAB I - ATF16LV8C

• Multiplex serial communication such that all serial communication can be controlled with one UART port on LPC 2214/2377.

• Programmable with WinCUPL

• 3.3V Source

Kirk Nichols

SCAB II - New Microcontroller – LPC2377

 Advantages over the LPC2214 Microcontroller

• Ethernet MAC with associated DMA Controller

 Access to PHY chip via MII

 Put Ethernet work into hardware instead of software

• Real-Time Clock

•RTOS software available

 Disadvantages

•Only 3.3V source needed instead of 3.3/1.8V, therefore consumes more power

•Need to Port Code

Kirk Nichols

SCAB II - KS8721BL

• I/F to 802.3 compliant MAC system on the

LPC2377

• Media Independent Interface Management

(MIIM)

• Internal 2.5V regulator

• 50MHz VCO

• Connects to RJ-45 with Magnetics

• LQFP-48

Daniel Kopelove

SCAB II - KS8721BL

• 100Base-TX/FX

– Increased regularity thanks to fiber

• Link status interrupts

Software:

• Olimex Board – RTOS+UIP

Daniel Kopelove

KS8721BL

Daniel Kopelove

Communication Protocol

• Command set (from LabVIEW to scab)

• Data packets (from SCAB to LabVIEW)

• LabVIEW is an intelligent controller (sends low level commands to SCAB)

• Data packets are static size

Daniel Kopelove

Command Packet Structure

Field (offset) Timestamp

(0x0)

Format U32

Sequence Num

(0x3)

U32

Opcode (0x7) Optional Raw

Data (0x9)

U16 U64

Timestamp – excessively late packet arrivals

Sequence num – used for statistics

Opcode – one of the predefined commands

Optional Raw Data – A command may have some extra data, the format of this data depends upon which opcode accompanies it,

Null padded, even word aligned

Daniel Kopelove

Command Set

• Current implemented commands

Command Code

Set speed pulse width

Set vehicle heading servo pulse width

0x0010

0x0011

Set pan servo pulse width

Set tilt servo pulse width

Send data

Set periodic data transmission interval

Restart system

Reset DC motor controller

Self Destruct

0x0012

0x0013

0x0020

0x0021

0x0030

0x0031

0x0BAD

Daniel Kopelove

Data Packet Structure

Field (offset) Timestamp

(0x00)

Format U32

Field

(offset)

Format

Sequence Num

(0x03)

U32

Valid (0x07)

U64

Geiger counts last sec (0x0E)

U16

Geiger counts last 5 sec

(0x11)

U16

Geiger counts

Last X sec

(0x13)

U16

Geiger counts last Y sec

(0x15)

U16

Speed pulse last W sec (0x17)

U16

Field

(offset)

Format

Speed pulse

Last X sec

(0x19)

U16

Speed pulse last Y sec

(0x1B)

U16

Speed pulse last Z sec

(0x1D)

U16

Gas LEL (0x1F)

U16

Daniel Kopelove

Data Packet Structure (cont)

Field (offset) A/D 2 (0x21) Compass

(0x23)

Format U16 U32

I2C 1 (0x27)

U32

I2C 2 (0x2B)

U32

Field (offset) Battery stack V

1 (0x2F)

Format U16

Battery stack V

2 (0x31)

U16

Servo 1 pulse width (0x33)

U16

Servo 2 pulse width (0x35)

U16

Field (offset)

Format

Servo 3 pulse width (0x37)

U16

H&S Data

(0x39)

U32

Speed pulse width (0x3D)

U16

Daniel Kopelove

LabVIEW User Interface

Katrina Bossert

LabVIEW: Successes and Problems

• Successful

– Reasonable user interface

– Web browser and successful IP address connection

• Problems

– LabVIEW USB Driver

– Limitations in programming (e.g. you must request a specific size of data from a TCP/IP connection)

Katrina Bossert

Current User Interface

Goggles

(incorporate

C++ code)

USB Joystick

& LabVIEW Driver

Serial

Communication

LabVIEW

Keyboard Control

Video Streaming

TCP IP and

Communication protocol

Katrina Bossert

FreeRTOS

• “Don’t do it”

– Threading never as simple as it seems

• Advantages

– Manages system timers and interrupts

– Convenient scheduling of recurring tasks

• Our implementation

– Latencies as high as 100 ms acceptable

– Short, simple tasks

Jay Brasch

FreeRTOS Pseudocode

{ void ethernetController( void *pvParameters )

DataType Data1, Data2

{ while( true) vTaskDelayUntil( &xLastWakeTime, CYCLE_RATE_MS )

// Request data from the sensors.

if(checkEthernetQueue(&Data1) if (Data.HighPriority) processCriticalTask(Data1) else processNormalTask(Data1)

}

}

}

Jay Brasch

Power Design

Two battery sources for maximum isolation

12 V (26 W) Consumption (W) 7.6V (21 W) Consumption(W)

SCAB 4

Ethernet Controller 3

Router

Geiger Counter

Total

6

2

15

Motor 20

Ethernet Camera 6

Servos 2

Total 26

*35W motor battery readily available

Jay Brasch

FAIL! Handling

• Goal: Handle unexpected conditions gracefully

– “Heartbeat” packet sent periodically

– Battery state sensing

– Relays

• Reset motor controller

• Reset router manually or 90 dB buzzer

– Lost communication procedures

• Wait and attempt reconnect

• Move 5s opposite most recent heading

• Execute Start of Day (SOD) task

Jay Brasch

RTOS Scheduling (periodic)

Task

Poll Tiny

Poll Batt

Poll Link

Poll Periph 1

Poll Command Queue 1

Poll Speed 1

Poll Gas

Heartbeat

Comm. INT

1

1

3

1

1

Time 1 2 3 4 5 6 7 8 9 10 11

1 x x x x x x x x x x x

Jay Brasch

RTOS Scheduling (aperiodic)

Task

Request from Tiny

Open/Close relays

Actuate Servos

Change motor speed

Send Data

1

3

1

1

Time

1

Jay Brasch

Milestones

• Milestone 1

– SCAB installed on vehicle

• Controlling motors

• Controlling camera

– Embed video stream in LabVIEW

– LabVIEW controls vehicle via RS232

• Milestone 2

– SCAB acts as network host

• Transmits telemetry data to LabVIEW interface

– LabVIEW acts as network host

• Transmits control commands to SCAB

– System can run 30 minutes from battery

Katrina Bossert

Questions

Kirk

LabVIEW

Responsibilities

SCAB

Vehicle

HUD

Ethernet

Communication

Router

Katrina Bossert

Katrina

Jay

Dan

KS8721BL

Kirk Nichols

LPC 2377

Kirk Nichols

ATF16LV8C

Kirk Nichols

KS8721BL

Kirk Nichols

• u08 pkt1[] = {0x00,

• 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x16,

• 0xb6, 0x98, 0x95, 0x3f, 0x08, 0x06, 0x00, 0x01,

• 0x08, 0x00, 0x06, 0x04, 0x00, 0x01, 0x00, 0x16,

• 0xb6, 0x98, 0x95, 0x1f, 0x0a, 0x00, 0x01, 0x02,

• 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00,

• 0x01, 0x14 };

• IO3DIR |= 0x00000002;

• IO3SET = 0x00000002;

• initMAC();

• write_ptr = ReadETHReg(EWRPTL);

• write_ptr |= (ReadETHReg(EWRPTH) << 8);

• WriteMacBuffer(pkt1, 51);

• write_ptr = ReadETHReg(EWRPTL);

• write_ptr |= (ReadETHReg(EWRPTH) << 8);

• WriteCtrReg(ETXNDL, write_ptr);

• WriteCtrReg(ETXNDH, (write_ptr >> 8));

• SetBitField(ECON1,ECON1_TXRTS);

Kirk Nichols

Kirk Nichols

Download