190 likes | 251 Views
System Software Design and Documentation. Zach Hill Western Washington University. General System Design. MCU – Freescale MC9S12DP512 Bus Frequency of 16MHz Memory Requirements 12kB RAM 256kB Flash 4kB EEPROM MicroC/OS-II Tick period ~ 1mS. Tasks. Start Task User Interface Task
E N D
System Software Design and Documentation Zach Hill Western Washington University
General System Design • MCU – Freescale MC9S12DP512 • Bus Frequency of 16MHz • Memory Requirements • 12kB RAM • 256kB Flash • 4kB EEPROM • MicroC/OS-II • Tick period ~ 1mS
Tasks • Start Task • User Interface Task • Key Task • SPI Task
ISRs • MP3_ISR • USB_ISR
Task Design • Main: • Initializes I²C, SPI, MicroC/OS-II, and LCD • Creates Start Task • Start Task: • Displays Boot up message • Initializes USB, PWM, Key • Creates Other Tasks • Task Priority: 4 • Task Period – once
Task Design • SPI Task • Waits for semaphore from MP3_ISR and USB_ISR • Sends or receives data over SPI depending on the semaphore posted • Priority: 5 • Execution Time: ?? • Period: ??
Task Design • User Interface • Handles button presses from user • Task Priority: 6 • Execution Time: 4 mS • Task Period: 10 mS • CPU Load: .4
Task Design • Key Task • Scans buttons, if one was pressed updates buffer • Priority: 7 • Task Period: 10 mS • Execution Time: 50 uS • CPU Load: .005
MP3_ISR • Generates a semaphore when Data Request pin on the MP3 decoder goes high • Period: 1 mS (Sporadic) • Execution time ~ 291 nS (max)
USB_ISR • Generates a semaphore when SPI ready pin on USBWiz OEM board goes high • Period: 1 mS (Sporadic) • Execution time ~ 291 nS (max)
Overall CPU Load • CPU load L max= .4 + .005 + .000291 + .000291 = .405582 L max= 40.56% L average = 20.2%
Kernel Selection • MicroC/OS-II • Real-time preemptive multitasking kernel
KeyFlag Dataflow Diagram Buttons Button Input Application Button Driver Module KeyInit() KeyPend() KeyTask() key KeyCodeTable
Dataflow Diagram LCD Module LCD I/O Application UITask()
USB_DATARDY MP3_RDY Dataflow Diagram SPI Module SPI I/O MP3 Data to decoder SPITask() MP3 Data From USB
Dataflow Diagram Application IIC Module IIC I/O Decoder Control Commands UITask() IIC PWM Control Commands
MP3_RDY Dataflow Diagram ISR SPI.c MP3_SPKR.c Interrupt SPITask Pend Post ISR MP3_Isr PORTH
USB_DATARDY Dataflow Diagram ISR SPI.c MP3_SPKR.c Interrupt SPITask Pend Post ISR USB_Isr SCI