ZIGBEE and OSAL

ZIGBEE
and OSAL
KNU RTLAB.
Jaehoon Woo
Contents
1. ZIGBEE
2. Z-Stack and OSAL
What’s ZIGBEE
ZigBee is a standard networking protocol aimed at the
wireless control market.
The ZigBee protocol fits on 8-bit microcontrollers, with
16- and 32-bit solutions available.
ZIGBEE is..
Cost-Effective
- A single chip solution yields prices in the $3 to $5 range, on average
Low-Power
- ZigBee devices can achieve 5 years on a pair of AA batteries.
Highly Reliable
- ZigBee enhances reliability through mesh networking, acknowledgments
and use of the robust IEEE 802.15.4 standard.
Highly Secure
-ZigBee uses AES 128-bit security for encryption and authentication
Low Data Rate
- ZigBee through-put is typically 25 kilobits per seconds.
ZIGBEE Markets
Network topology
ZIGBEE Stack Architecture
IEEE 802.15.4 표준
CC2530
CC2530
CIRCUIT
DESCRIPTION
Why Use an OS?
Stack App
App
App
Hardware Platform
 Separate S/W development from H/W development
 OSAL supports:







Task registration, initialization and starting
Task synchronization
Message exchange between tasks
Interrupt handling
Timers
Memory allocation
Power management
OSAL / HAL
OSAL provides scheduling, memory management and messaging features.
HAL provides easy programming access to hardware and isolates the software
from the hardware specifics
Z-Stack
Application(
s)
Because of its very limited functionality, the OSAL is
not, strictly speaking, considered and Operation System
OSAL = Operating System Abstraction Layer
HAL = Hardware Abstraction Layer
Tasks, Events and Messages
Event…
An occurrence used to
Trigger a task to run
Task…
A complete piece of code …
A thread
Message…
Event…
An occurrence used to
Trigger a task to run
Task…
A complete piece of code …
A thread
Information exchanged from
One Task to another
Tasks
• A single tread of code that performs a function can be encompassed in a
task
• A task is made up of an initialization section and a run-time section
• Once started, a task runs to completion
• An event causes the run-time section to execute
Run on OSAL start up
Initialization Code
(Setup)
Run by OSAL on Event
Run-Time Code
(Processing)
Task APIs
osal_set_event()
Sets the event flags for a task – runs task
osal_init_system()
Creates the tasks defined in the task table
osal_start_system()
Starts the OSAL main loop
osal_self()
Returns the ID of the current task
Events
Definition : An action to be completed by a Task.
event_flag, used for defining the type of event, is 16 bits long
15
0
SYS_EVENT_MSG(Reserved for OSAL)
• A special event type used for inter-task communication
Event other bit position is managed by the application
#define TRANSMITAPP_SEN_MSG_EVT
#define TRANSMITAPP_RCVTIMER_EVT
#define TRANSMITAPP_SEND_ERR_EVT
0x0001
0x0002
0x0004
Messaging … Inter–Task Communication
Message
TSK1
TSK2
• Managed by the OSAL
• Messaging used for triggering over the air communication as well as
internal command messaging between tasks.
• Commands between tasks use osal_msg_send() to create
SYS_EVENT_MSG events
Osal_msg_allocate()
allocates a bugger for message transfer between tasks
Osal_msg_deallocate()
deallocated buffer
Osal_msg_send()
place a message in the buffer
Osal_msg_receive()
Scheduling
Example
• Tasks do not pre-empt, but rather run to completion
• Round-robin task servicing loop
Q&A
Thank you!