TBD_CDR
Document Sample


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
System Diagram
Laptop LabVIEW
Sensing Ports
AtTiny24 ATF16LV8C Geiger
Pulse
(Velocity)
(2)
USB Vuzix
Joystick HUD ADC Gas
Ethernet Sensor
(2)
(Peripherals) PHY/MAC
NXP 2214/2377 UART
Layer
(5) (Range
+ Sensors)
ATF750
CPLD
System Information
Servo DC
I2 C (Compass)
(3) Motor Battery Debug (3)
Level Port
Vehicle Control
Kirk Nichols
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 Sequence Num Opcode (0x7) Optional Raw
(0x0) (0x3) Data (0x9)
Format U32 U32 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 0x0010
Set vehicle heading servo pulse width 0x0011
Set pan servo pulse width 0x0012
Set tilt servo pulse width 0x0013
Send data 0x0020
Set periodic data transmission interval 0x0021
Restart system 0x0030
Reset DC motor controller 0x0031
Self Destruct 0x0BAD
Daniel Kopelove
Data Packet Structure
Field (offset) Timestamp Sequence Num Valid (0x07) Geiger counts
(0x00) (0x03) last sec (0x0E)
Format U32 U32 U64 U16
Field Geiger counts Geiger counts Geiger counts Speed pulse last W
(offset) last 5 sec Last X sec last Y sec sec (0x17)
(0x11) (0x13) (0x15)
Format U16 U16 U16 U16
Field Speed pulse Speed pulse Speed pulse Gas LEL (0x1F)
(offset) Last X sec last Y sec last Z sec
(0x19) (0x1B) (0x1D)
Format U16 U16 U16 U16
Daniel Kopelove
Data Packet Structure (cont)
Field (offset) A/D 2 (0x21) Compass I2C 1 (0x27) I2C 2 (0x2B)
(0x23)
Format U16 U32 U32 U32
Field (offset) Battery stack V Battery stack V Servo 1 pulse Servo 2 pulse
1 (0x2F) 2 (0x31) width (0x33) width (0x35)
Format U16 U16 U16 U16
Field (offset) Servo 3 pulse H&S Data Speed pulse
width (0x37) (0x39) width (0x3D)
Format U16 U32 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 Motor 20
Ethernet Controller 3 Ethernet Camera 6
Router 6 Servos 2
Geiger Counter 2
Total 15 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 Time 1 2 3 4 5 6 7 8 9 10 11
Poll Tiny 1 x
Poll Batt 1 x
Poll Link 1 x
Poll Periph 1 x
Poll Command Queue 1 x
Poll Speed 1 x
Poll Gas 1 x
Heartbeat 1 x
Comm. INT 3 x x x
Jay Brasch
RTOS Scheduling (aperiodic)
Task Time
Request from Tiny 1
Open/Close relays 1
Actuate Servos 1
Change motor speed 1
Send Data 3
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
Responsibilities
Kirk Jay
SCAB
Vehicle
HUD
Ethernet
LabVIEW Communication
Router
Katrina Bossert
Katrina 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
Get documents about "