System Software Design Dan Sweet May 6 th, 2008 Western Washington University Bicycle Power Meter.

Slides:



Advertisements
Similar presentations
System Integration and Performance
Advertisements

Programmable Interval Timer
Mark Schaumburg.  Dash Module for Formula Car  Sample pulse from engine for RPM  Display Information  Control gui  Can network interface  Request.
Computer System Overview
Chapter 1 Computer System Overview Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,
University College Cork IRELAND Hardware Concepts An understanding of computer hardware is a vital prerequisite for the study of operating systems.
Chapter 1 and 2 Computer System and Operating System Overview
Timers and Interrupts Shivendu Bhushan Summer Camp ‘13.
1 ECE 263 Embedded System Design Lessons 2, 3 68HC12 Hardware Overview, Subsystems, and memory System.
Real-Time Operating Systems Suzanne Rivoire November 20, 2002
Chapter 10: Input / Output Devices Dr Mohamed Menacer Taibah University
Acceleration Based Pedometer
BlueECG System Software Design Western Washington University By: Corey Williamson.
1 Computer System Overview Chapter 1. 2 n An Operating System makes the computing power available to users by controlling the hardware n Let us review.
CHAPTER 2: COMPUTER-SYSTEM STRUCTURES Computer system operation Computer system operation I/O structure I/O structure Storage structure Storage structure.
CHAPTER 3 TOP LEVEL VIEW OF COMPUTER FUNCTION AND INTERCONNECTION
Lecture 14 DMA Controller & Serial Communications Interface (UART)
CSE466 Autumn ‘00- 1 Music Format if amp = 0, note is a command switch(note) 0: turn off specified channel 1: continue for specified tne w/ no change else.
Autonomous Helicopter James LydenEE 496Harris Okazaki.
Topic 6: Further System Fundamentals. Fetch-Execute Cycle Review Computer programs are instructions stored in RAM Processor fetches instructions and executes.
Direct Memory Access Module MTT M DIRECT MEMORY ACCESS MODULE (DMA)
RTX - 51 Objectives  Resources needed  Architecture  Components of RTX-51 - Task - Memory pools - Mail box - Signals.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
1 VxWorks 5.4 Group A3: Wafa’ Jaffal Kathryn Bean.
Michael Nist. System Software Design  MCU (2): CY8CPLC20 8-bit  32 KB Flash, 2 KB SRAM  Bus Frequency: 24 MHz  Memory requirements:  Main Controller:
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
System Software Design Review.  MCU: NXP LPC2378 ARM7 32-bit  512 KB Flash, 8KB EEPROM and SRAM  Bus Frequency: 20 MHz  Approximate Memory requirements:
 Home Security and Lighting System  Western Washington University  Jonathon Ross  28 April, 2009.
System Software Design Colin Gatlin May 12, 2009 Western Washington University.
Turbine Flow Meter Kevin Hooks Senior Design Project.
System Software Design and Documentation Zach Hill Western Washington University.
Digital Handheld Communication and Navigation Device
Our Project Next generation communication system for vehicles ▫Simple, real-time visual communication Multi-touch input ▫Driver’s gestures produce an.
Vinh Le.  MCU: Freescale Kinetis K60512 ARM Cortex M4  Bus Frequency: 50MHz  Available Memory: ◦ 512KB Flash ◦ 64KB SRAM  Memory Required: ◦ 10KB.
Input/Output Problems Wide variety of peripherals —Delivering different amounts of data —At different speeds —In different formats All slower than CPU.
SYSTEM SOFTWARE DESIGN JAMES ZUROSKE Pet Proximity Sensor.
IT3002 Computer Architecture
Lost Item Pager System Design Russ Kinley 5/6/6008.
Ryan Hansgen. General System Design  MC9S08QE64CFT 24MHz Bus Frequency 64 K byte Flash EEPROM, 4.0 K byte RAM  Memory required 8 K bytes ROM 2 K bytes.
RFID Access Control System Lucius Knight. General System Design  Microcontroller  PSoC CY8C29466  24MHz Bus Frequency  Memory Available  32kB FLASH.
System Software Design Dane Kim May 4 th, 2009 EET 475, WWU.
BICYCLE SECURITY AND TRIP COMPUTER MATTHEW ROTHNIE WESTERN WASHINGTON UNIVERSITY 4/25/12.
ATV INSTRUMENTATION DISPLAY System Design Ed Raezer Senior Project Western Washington University.
System Software Design Engineer: Mac Gainor Western Washington University.
Machine Access System Software Design and Documentation Western Washington University By: Kevin Pogue.
Portable/Programable Location System – Software Design By: Mark Moerdyk.
Digitally Configurable Audio Routing Patchbay DCARP System Software Presentation Aaron Cramer Western Washington University 2009.
LED CUBE Preliminary System Software Design Fernando J. Garcia May
Humidity Sensing Fan Controller Jason Huft 05/11/10.
SGDRS Software System Design Justin A. King WWU EET Senior project 2013.
Automatic Pressure Canning System System Software Design By: Michael Drysdale.
Atmospheric Data Measuring Rocket Software Design & Description Matt Buonadonna ADaM Code Presentation.
GPS Enhanced PFD System Software Presentation Eric Grossmann.
Software Design Review Andres Rodriguez. General System Design  MCU: STM32F405  MCU Bus Frequency: 84MHz  Memory Requirements  Flash: ~ 10Kb  RAM:
System Software Design GPS Training System Jason Corbridge May 8, 2008 Western Washington University.
LED CUBE Preliminary System Software Design Fernando J. Garcia May
WESTERN WASHINGTON UNIVERSITY KENT SYKES 2009 Audio Field Recorder System Software Design.
ATV INSTRUMENTATION DISPLAY System Software Design Ed Raezer.
Wireless Heart Rate Monitor. On-Person Unit MC13213 (HCS08)  16 MHz Bus Frequency  On Chip Resources 60K of Flash 4K of RAM  Require Resources 15K.
HOME CONTROL SYSTEM By: Justin E. Klumpp & Leo L.S. Wan Leo L.S. Wan.
Voice Over IP – Software Western Washington University By: Jonathan R. Peterson.
The Guardian: Refrigerator Contents Tracker Bryant Lampano Western Washington University Electronics Engineering Technology [Type the company name]
System Software Design Presentation Western Washington University Taylor Reijm.
Topics Covered What is Real Time Operating System (RTOS)
Wireless Heart Rate Monitor
By: Justin E. Klumpp & Leo L.S. Wan
Presentation transcript:

System Software Design Dan Sweet May 6 th, 2008 Western Washington University Bicycle Power Meter

General System Design Freescale MC bit MCU Bus Frequency: 8 MHz (from external xtal) Memory Requirements: MCU1 & 2: ~5000 bytes ROM for SMAC MCU1 & 2: ~5000 bytes ROM for SMAC MCU1: ~4000 bytes ROM for uC/OS MCU1: ~4000 bytes ROM for uC/OS MCU1: ~2000 bytes of RAM total MCU1: ~2000 bytes of RAM total MCU2: ~1000 bytes of ROM for Time-Slice MCU2: ~1000 bytes of ROM for Time-Slice MCU2: ~1000 bytes of RAM total MCU2: ~1000 bytes of RAM total MCU1 total: ~9000 ROM, ~2000 RAM MCU1 total: ~9000 ROM, ~2000 RAM MCU2 total: ~6000 ROM, ~1000 RAM MCU2 total: ~6000 ROM, ~1000 RAM

Kernal Choice MCU 1: uC/OS Tick period of 1 ms Tick period of 1 ms 4 Tasks 4 Tasks MCU 2: Time Slice Routine Slice Period of ~.25 seconds Slice Period of ~.25 seconds 3 main slice functions 3 main slice functions

MCU 1 uC/OS Design Task 1: StartTask Highest priority (4) Highest priority (4) Initial task which begins other tasks Initial task which begins other tasks Only runs once before termination Only runs once before termination Task 2: RxIn Receives data via wireless transceiver Receives data via wireless transceiver Controls all SMAC functionality & interfaces with the SMAC modules Controls all SMAC functionality & interfaces with the SMAC modules Will run sporadically (whenever an incoming message is received) Will run sporadically (whenever an incoming message is received) Next highest priority (5) Next highest priority (5)

MCU 1 Task 2: RxIn Task 2: RxIn Receives data via wireless transceiver Receives data via wireless transceiver Controls all SMAC functionality & interfaces with the SMAC modules Controls all SMAC functionality & interfaces with the SMAC modules Will run sporadically (whenever an incoming message is received about every.25 seconds) Will run sporadically (whenever an incoming message is received about every.25 seconds) Execution Time: ~ < 10 ms Execution Time: ~ < 10 ms Next highest priority (5) Next highest priority (5) SMAC Functions Used: MLMESetMC13192ClockRate(0); MLMESetMC13192ClockRate(0); MLMESetChannelRequest(CHANNEL_NUMBER); MLMESetChannelRequest(CHANNEL_NUMBER); MLMEMC13192PAOutputAdjust(OUTPUT_POWER); MLMEMC13192PAOutputAdjust(OUTPUT_POWER); MLMERXEnableRequest(&rx_packet,0); MLMERXEnableRequest(&rx_packet,0); Zero means wait forever with RX ON

MCU 1 Task 2: RxIn SMAC Data Members: byte gu8RTxMode; //current mode of radio byte gu8RTxMode; //current mode of radio byte rx_data_buffer[x]; //holds in data byte rx_data_buffer[x]; //holds in data tRxPacket rx_packet; tRxPacket rx_packet; SMAC structure for RX packets rx_packet.u8DataLength = 0; //length of data rx_packet.u8DataLength = 0; //length of data rx_packet.pu8Data = &rx_data_buffer[0]; rx_packet.pu8Data = &rx_data_buffer[0]; rx_packet.u8MaxDataLength = 128; rx_packet.u8MaxDataLength = 128; rx_packet.u8Status = 0; rx_packet.u8Status = 0;

MCU 1 uC/OS Design (cont.) Task 3: UpdateData Will perform necessary manipulation on incoming data before updating LCD Will perform necessary manipulation on incoming data before updating LCD Must receive access to the LCD via a mutex key (Cal_Interface must use LCD too) Must receive access to the LCD via a mutex key (Cal_Interface must use LCD too) Third highest priority (6) Third highest priority (6) Period: ~.5 Seconds Period: ~.5 Seconds Execution Time: <25 ms Execution Time: <25 ms

MCU 1 Task 4: Cal_Interface() Cal_Interface() controls the user interface to calibrate the strain coefficients It takes control of LCD and incoming data (uses LCD mutex and data mutex). Informs user to place given weight on pedal, takes reading, process is repeated for other pedal No data needs to be sent to the pedal unit, which simplifies communication. Period: Sporadic (whenever user presses set-up button) Execution Time: (excluding waiting for user input) ~2 seconds per pedal = 4 seconds

MCU 1 Interrupts OC0Isr: (may be removed) Simple Output Compare Timer to control time slice delay and any other misc. delays Simple Output Compare Timer to control time slice delay and any other misc. delays Execution Time <1 us Execution Time <1 us IRQIsr (From SMAC protocol): Routine to handle incoming messages Routine to handle incoming messages Created as part of SMAC requirements Created as part of SMAC requirements Execution Time <1 ms Execution Time <1 ms Vscirx (From SMAC protocol): Interfaces the MCU to transceiver via SCI Interfaces the MCU to transceiver via SCI Execution Time < 1 us Execution Time < 1 us IRQTimer1 (From SMAC protocol): Separate output compare timer for the SMAC protocol Separate output compare timer for the SMAC protocol Execution Time <2 us Execution Time <2 us OSTickIsr: (From uC/OS) – OS Tick Timer OSCtxSw: (From uC/OS) – OS Context Switch Interrupt KBIIsr: Controls interrupt from button Controls interrupt from button Will generate interrupt when button is pressed Will generate interrupt when button is pressed Execution Time < 2 us Execution Time < 2 us

MCU1 Data Flow Diagram RxIn, UpdateData, & Cal_Interface must have access to the incoming Rx data. Normally, RxIn & Update data swap control over this data (during normal operation) When Calibration is started, UpdateData is suspended so the Cal_Interface can output data to LCD and perform calculations on incoming data Cal_Interface changes Cal_Coefficient which is used by UpdateData to calculate torque

MCU 1 CPU Load RxIn execution time: ~10 ms every ~.25 s UpdateData execution time: ~25 ms /.25 s Calibrate Routine Does not run at same time, so is not included in main CPU load Normal Operation Mode CPU load: L = (10 ms + 25 ms)/.25 s = 14% CPU Load* L = (10 ms + 25 ms)/.25 s = 14% CPU Load* *Excludes Interrupts

MCU 2 Time Slice Design Three Operations of Time Slice Collect data from Accelerometer (A/D) Collect data from Accelerometer (A/D) Collect data from Strain Gauges (A/D) Collect data from Strain Gauges (A/D) Send out data via SMAC wireless Tx Send out data via SMAC wireless Tx *These Items may be combined into a single inline routine

MCU 2 Interrupts OC0Isr: Simple Output Compare Timer to control time slice delay and any other misc. delays Simple Output Compare Timer to control time slice delay and any other misc. delays Execution Time <1 us Execution Time <1 us IRQIsr (From SMAC protocol): Routine to handle incoming messages Routine to handle incoming messages Created as part of SMAC requirements Created as part of SMAC requirements Execution Time <1 ms Execution Time <1 ms IRQTimer1 (From SMAC protocol): Separate output compare timer for the SMAC protocol Separate output compare timer for the SMAC protocol Execution Time <2 us Execution Time <2 us Vscitx (From SMAC protocol): Interfaces the MCU to transceiver via SCI Interfaces the MCU to transceiver via SCI Execution Time < 1 us Execution Time < 1 us

MCU 2: Sample Accelerometer Slice For each axis sampled: An initial calibration routine run once (not every slice) An initial calibration routine run once (not every slice) Take a set of samples (16-64) and average them, acts as LPF (8-bit samples) Take a set of samples (16-64) and average them, acts as LPF (8-bit samples) Subtract calibration value Subtract calibration value Apply a discrimination window to filter noise Apply a discrimination window to filter noise Integrate to get velocity Integrate to get velocity Do movement end check Do movement end check Save new value in old value spot Save new value in old value spot

Integration on set of samples INT32U velocityx[2], accelerationx[2]; velocityx[0],acceleration[0] = last value velocityx[1],acceleration[1] = new value velocityx[1]= velocityx[0]+ accelerationx[0]+ ((accelerationx[1] -accelerationx[0])>>1);

MCU 2: Sample Strain values Sampled in 10-bit mode (3.1 mV per step) Two separate channels sampled Each channel sampled several times and averaged to reduce noise Raw data stored in global variable to be sent to MCU1

MCU 2: Tx Slice Data members used: tTxPacket tx_packet;//SMAC structure for TX packets tTxPacket tx_packet;//SMAC structure for TX packets INT8U tx_data_buffer[x];//Data buffer to hold TX data INT8U tx_data_buffer[x];//Data buffer to hold TX data tx_packet.u8DataLength;//Length of data tx_packet.u8DataLength;//Length of data tx_packet.pu8Data = &tx_data_buffer[0];//Load the address of our txbuffer into tx structure. tx_packet.pu8Data = &tx_data_buffer[0];//Load the address of our txbuffer into tx structure.

MCU 2: Tx Slice Major SMAC Functions used: MLMESetChannelRequest(CH_NUM); MLMESetChannelRequest(CH_NUM); Sets channel number MLMEMC13192PAOutputAdjust(OUT_POW); MLMEMC13192PAOutputAdjust(OUT_POW); Sets output power of Tx MCPSDataRequest(&tx_packet); MCPSDataRequest(&tx_packet); Transmits Packet, blocks until sent out.

MCU 2 Data Flow Diagram Flow of data in MCU 2 is very simple, since it is a time slice routine No two slices can access a data member simultaneously, so there is no conflicting access to data Major data will be global to simplify the access amongst different functions Operation is the same whether MCU 1 is in normal operation or in calibration mode

MCU 2 CPU Load Slice Period: ~.25 seconds A/D speed: Bus clock = 8 MHz Bus clock = 8 MHz A/D pre-scaler = 4 A/D pre-scaler = 4 A/D rate = 2 MHz A/D rate = 2 MHz A/D conversion time 2 MHz) = 14 us A/D conversion time 2 MHz) = 14 us Accelerometer A/D slice: 16 samples for each average = 224 us 16 samples for each average = 224 us Total Time: < 500 us Total Time: < 500 us Strain Gauge A/D slice: 8 samples per average * 2 = 224 us 8 samples per average * 2 = 224 us Total Time: < 400 us Total Time: < 400 us Tx slice: Est. Total Time: < 5 ms Est. Total Time: < 5 ms CPU Load: L=(500 us us + 5 ms)/.25 s* = 2.5% CPU Load (Leaves lots of room for more averaged samples) L=(500 us us + 5 ms)/.25 s* = 2.5% CPU Load (Leaves lots of room for more averaged samples) *Excludes Interrupts *Excludes Interrupts

Module List (1 of 4) Module NameTasksPublic Functions & Data MCU1.cStart Task RxIn Update Data tRxPacket rx_packet rx_data_buffer[x] gu8RTxMode gu8Channel MCU2.c-main(); GetAccel(); GetStrain(); SendData(); WaitForSlice(); gu8RTxMode; UINT8 gu8Channel; tTxPacket tx_packet; byte tx_data_buffer[x]; Start08.c- mcu_hw_config.c Has initialization and clock routines -GPIOInit() UseExternalClock() UseMcuClock() MCUInit() UINT8 IRQPinLow()

Module List (2 of 4) simple_mac.c -The highest layer of SMAC code -UINT8 MCPSDataRequest(tTxPacket); UINT8 MLMERXEnableRequest(tRxPacket, Timeout); UINT8 MLMERXDisableRequest(void); UINT8 MLMEHibernateRequest(); UINT8 MLMEDozeRequest(Timeout); UINT8 MLMEWakeRequest(); UINT8 MLMESetChannelRequest(u8Channel); UINT8 MLMESetMC13192ClockRate(u8Freq); UINT8 MLMESetMC13192TmrPrescale (u8Freq); UINT8 MLMEMC13192XtalAdjust(u8reqValue); UINT8 MLMEEnergyDetect(); UINT8 MLMEMC13192SoftReset(); UINT8 MLMELinkQuality (); UINT8 MLMEMC13192FEGainAdjust(u8GainValue); UINT8 MLMEMC13192PAOutputAdjust(u8PaValue); UINT8 MLMEGetRficVersion(); void MLMETestMode (tTxPacket, u8mode); UINT8 MLMEScanRequest(flags, *pu8ChannelScan); drivers.c Controls the interface between MCU & radio unit via SPI. Also has IRQ interrupt (lowest layer of SMAC code) -gu8IRQValue void SPIDrvWrite(u8Addr, u16Content); UINT16 SPIDrvRead(u8Addr); UINT16 SPIDrvRead2(u8Addr); void RAMDrvWriteTx(tTxPacket); UINT8 RAMDrvReadRx(tRxPacket); IRQIsr();

Module List (3 of 4) simple_phy.c Houses the PHY layer of the SMAC protocol. This is the second highest layer of the SMAC code. -UINT8 PDDataRequest(tTxPacket *); void PDDataIndication(); UINT8 PLMEHibernateRequest(); UINT8 PLMEDozeRequest(u32Timeout); UINT8 PLMEWakeRequest(); UINT8 PLMESetChannelRequest(u8Channel); UINT8 PLMESetTrxStateRequest(u8ReqMode); UINT8 PLMEEnergyDetect(); UINT8 PLMECCARequest(); UINT8 PLMELinkQuality(); UINT32 PLMEGetTimeRequest(); UINT8 PLMESetMC13192ClockRate(u8Freq); UINT8 PLMESetMC13192TmrPrescale (u8Freq); void PLMESetTimeRequest(u32RequestedTime); UINT8 PLMEEnableMC13192Timer1(u32CounterValue); UINT8 PLMEDisableMC13192Timer1(); void PLMEMC13192ResetIndication(); UINT8 PLMEMC13192SoftReset(); UINT8 PLMEMC13192XtalAdjust(u8TrimValue); UINT8 PLMEMC13192FEGainAdjust(i8GainValue); UINT8 PLMEPAOutputAdjust(u8RequestedPAValue); UINT8 PLMEGetRficVersion(); void PLMELoadPRBS9 (tTxPacket *); UINT8 PLMEPhyReset(); UINT8 PLMEEnablePromiscuousMode(); UINT8 PLMEDisablePromiscuousMode();

Module List (4 of 4) MC1321XSRB.c-void RadioInit() kbi.c-KBIIsr() KBIInit() timer.c-void delay(UINT16 count); interrupt void IRQTimer1(void); SCI.c-interrupt void Vscirx() void SCIInit(void); void SCIStartTransmit(UINT8 cData); void SCITransmitStr(UINT8 *pStr); void SCITransmitArray(UINT8 *pStr, UINT8 length); UINT8 SCIgets(char *pPrompt, char *pBuffer, UINT8 u8Size); void SCIInitGeneric(u32BusClock,u32BaudRate,u8ComNumber); void SCITransmitFormattedArray(char *pStr, UINT8 length); mc13213.c-- Delay.c-void OCDelay(INT16U ms) void OCDlyInit(void); INT16U GetmSCnt(void); *This List Excludes the list of modules associated with uC/OS