www.trevorwilcox.com
PHANTOMDigital Handheld Communication and Navigation Device
General System Design Freescale 9s12xep100 microcontroller
50 MHz bus frequency Chip Resources
3 of 6 SCI Ports Two interrupt driven
Wake-Up Interrupts on Port H and Port J (Key + RF) Time Channel 6 Interrupt (Used by Kernel)
Memory Usage ROM – 21.6kB of 48kB (up to 1MB paged) RAM – 8kB of 8kB (up to 64kB paged) EEPROM – 500B of 2kB (up to 4kB paged)
Kernel Design uC/OS-II – A real-time preemptive
multitasking kernel Tick Period – 1ms 3+2Tasks 2 ISRs 4 Flags 1 Mutex
Task/ISR TimingTask/ISR Priorit
yPerio
d(avg)
Period(min)
Behavior
Execution Time (avg)
Execution Time (max)
CPULoad(avg)
CPU Load (max)
RFrxISR - 60sec* 0.8ms Sporadic 2µs * 2µs * ~0.0%
0.25%
GPSrxISR - 30sec* 1.7ms Sporadic 2µs 2µs ~0.0%
0.12%
StartTask 4 - - Run Once
2sec 2sec - -
OS_TIMER_TIMER
5 1ms 1ms Periodic 0.5µs 0.5µs 0.05% 0.05%
SysTask (newKey)
6 120sec
16ms Sporadic 7.1ms* 7.1ms* ~0.0%
44.3%
(newSec)
1sec 1sec Periodic 5ms* 5ms* 0.5% 0.5%
(newMsg)
60sec 162.4ms Sporadic 7.3ms* 7.3ms* 0.02% 4.5%
(newGPS)
30sec 61.2ms Sporadic 7.2ms* 7.2ms* 0.02% 11.8%
KeyTask 7 8ms 8ms Periodic 8µs * 10µs 0.1% 0.13%ClockTask 8 1sec 1sec Periodic 1µs * 1µs ~0.0
%~0.0
%
*Estimated**Maximum load should be considered average load because system will be sleeping during “average” load conditions.
Maximum CPU Load: 44.85%
Average CPU Load: ~0.7%**
Start Task Initializes Keypad, GPS, Clock, RF, and
LCD hardware Creates the other tasks Period: Run once Execution time: ~2sec
RFrxISR Triggered by RDRF (Read Data Register
Full) flag on RF SCI port Copies incoming byte to buffer and
exits When end of message is detected or
the buffer is full, posts a flag notifying SysTask
Period: 0.8ms (time in between bytes at 9600bps), Behavior is sporadic
Execution time: 2µs
GPSrxISR Virtually identical to RFrxISR Triggered by RDRF on GPS SCI port Copies incoming byte to buffer and
exits When end of message is detected or
the buffer is full, posts a flag notifying SysTask
Period: 1.7ms (time in between bytes at 4800bps)
Execution time: 2µs
KeyTask Scans keypad to detect and debounce
user key presses Posts a flag notifying SysTask of user
inputted key Period: 8ms (periodic) Execution time:
Maximum: 10µs Average: 8µs (estimated)
ClockTask Uses OS Delay to count current time of
day and date Posts flag notifying SysTask that one
second has elapsed Period: 1s (periodic) Execution time: 1µs
SysTask Runs on New RF Message, New GPS Message, New Key
Press and New Second events Processes user input, including keypad multitap Processes RF and GPS data Provides the Graphical User Interface (GUI) State machine structure to react to events and display
correct graphical output for the event type and current user screen
Monitors power status and controls system power cycle Saves user settings in EEPROM Provides software tools to user
SysTask (GPS) Parses and interperets NMEA 0183 message streamed
from GPS hardware Location data is updated
Period: Minimum: 61.2ms Average: 30sec
Execution time: Parsing and translating: 200µs Maximum: 7.2ms (estimated) Average: 7.2ms (estimated)
SysTask (Messaging) Four primary functions: interpret received messages, transmit outgoing messages,
manage message cryptography, and conduct Medium Access Control (MAC) Incoming messages are processed when newMsg flag is posted by RFrxISR. The
header is examined to determine if the system is the intended recipient. If it is, an ACK message is transmitted to the sender. No ACK will be transmitted for “Broadcast-All” messages. Message content will be decrypted using aes256 module, and message data will be ready to use.
For outgoing messages, message is encrypted, headers are added, and message is sent to the LN96 for transmission
Period: Minimum: 162.4ms Average: 60sec
Execution time: Parsing and translating: 300µs (estimated) Maximum: 7.3ms (estimated) Average: 7.3ms (estimated)
SysTask (User Input) When the newKey flag is posted by KeyTask, SysTask
will retrieve that key and interpret the key’s meaning based on the current state and cursor location
Multitap function may be used depending on current state
Period: Minimum: 16ms Average: 120sec
Execution time: Maximum: 7.1ms (estimated) Average: 7.1ms (estimated)
SysTask (Clock) When newSec flag is posted by
ClockTask, SysTask will update the time on the LCD if appropriate
A mutex will be used to control access to the date-time information
Period: 1 sec Execution time: 5ms (estimated)
Task/Module RelationshipsSystemTask*main.c LN96.cLCD.c aes256.cEEPROM.c *messaging.
cpower.c random.ctools.c multitap.cgps.c 9s12xep100
.c
*Module where task code exists.
KeyTask*ucoskey.c
ClockTask*clock.c
Modules and LibrariesModule/Library
Tasks Public Functions and Data
Estimated ROM/RAM
main.c StartTask,SysTask
settingsData 2500b/4kb
LCD.c lcd_init(),lcd_powerdown()lcd_setbgcolor(),lcd_display()lcd_backlight(),lcd_putchar()lcd_setfontsize(),lcd_putstrg()lcd_getfontsize(),lcd_clear()lcd_putimage(),lcd_getcolor()lcd_movecursor()lcd_setcolor(),lcd_eraseline() lcd_disptime(),lcd_getcursor()lcd_txtopaque()
780b/10b
Modules and LibrariesModule/Library
Tasks Public Functions and Data
Estimated ROM/RAM
EEPROM.cAdapted from Todd Morton
EESectModify(),EESectErase()EEWordWrite
400b/10b
power.c Sleep(),Stop(),Powerdown()
200b/10b
tools.c gridFind() 400b/300b
multitap.c getMultiTap() 1800b/200b
9s12xep100start.cAdapted from Todd Morton
_Startup() 80b/0b
uCOSkey.cAdapted from Todd Morton
KeyTask KeyPend(),KeyInit() 400b/70b
gps.c GPSrxISR gpsDatagps_getRMC(),gps_getGSV()gps_init(),gps_setqueryrate()
1100b/400b
Modules and LibrariesModule/Library
Tasks Public Functions and Data
Estimated ROM/RAM
clock.c ClockTask TimeBuffer 120b/70bLN96.c RFrxISR rf_init(),rf_write(),rf_reset() 500b/10baes256.cCopyright (c) 2007-2009 Ilya O. Levin
aes256_init()aes256_done()aes256_encrypt_ecb()aes256_decrypt_ecb()
1400b/500b
messaging.c msgData,rfMsgBuffersendMsg()
2000b/800b
random.c getRand() 500b/100b
Modules and LibrariesModule/Library
Tasks Public Functions and Data
Estimated ROM/RAM
uC/OS-II(c) Copyright 1992-2007, Jean J. Labrosse
OS_TASK_TIMER
See uC/OS-II Documentation
2400b/1500b
Math.cISO C Standard Library
undetermined undetermined
String.cISO C Standard Library
undetermined undetermined
STDIO.cISO C Standard Library
undetermined undetermined
STDLIB.cISO C Standard Library
undetermined undetermined ~7k ROMfor C Libraries
Total: 21.6kb ROM8kb RAM
GPS Communication
RF Communication
User I/O
Date/Time Tracking
www.trevorwilcox.com
Questions? Kernel Choice Tasks
StartTask RFrxISR GPSrxISr SysTask KeyTask ClockTask
Data Control Medium Access Control GPS Communication Power Management Memory Usage ?
toothpastefordinner.com