Motes Caracteristicas
-
Upload
alberto-gonzalez-luque -
Category
Documents
-
view
234 -
download
0
Transcript of Motes Caracteristicas
-
7/30/2019 Motes Caracteristicas
1/35
-
7/30/2019 Motes Caracteristicas
2/35
-
7/30/2019 Motes Caracteristicas
3/35
-
7/30/2019 Motes Caracteristicas
4/35
-
7/30/2019 Motes Caracteristicas
5/35
-
7/30/2019 Motes Caracteristicas
6/35
-
7/30/2019 Motes Caracteristicas
7/35
-
7/30/2019 Motes Caracteristicas
8/35
-
7/30/2019 Motes Caracteristicas
9/35
-
7/30/2019 Motes Caracteristicas
10/35
-
7/30/2019 Motes Caracteristicas
11/35
-
7/30/2019 Motes Caracteristicas
12/35
-
7/30/2019 Motes Caracteristicas
13/35
-
7/30/2019 Motes Caracteristicas
14/35
-
7/30/2019 Motes Caracteristicas
15/35
-
7/30/2019 Motes Caracteristicas
16/35
-
7/30/2019 Motes Caracteristicas
17/35
-
7/30/2019 Motes Caracteristicas
18/35
-
7/30/2019 Motes Caracteristicas
19/35
-
7/30/2019 Motes Caracteristicas
20/35
-
7/30/2019 Motes Caracteristicas
21/35
-
7/30/2019 Motes Caracteristicas
22/35
-
7/30/2019 Motes Caracteristicas
23/35
-
7/30/2019 Motes Caracteristicas
24/35
-
7/30/2019 Motes Caracteristicas
25/35
-
7/30/2019 Motes Caracteristicas
26/35
Alessio Falchi Chapter 3 The Berkeley motes environment
42
modul e Bl i nkM {
pr ovi des {
i nt er f ace St dCont r ol ;
}
uses {
i nt er f ace Ti mer ;
i nt er f ace Leds;
}
}
Figure 3.2.7-2
The first part of the code states that this is a module called BlinkM and declares
the interfaces it povides and uses. The Bl i nkM module provides the interface
St dCont r ol . This means that Bl i nkM implements the St dCont r ol interface. The Bl i nkMmodule also uses two interfaces: Leds andTi mer . This
means that Bl i nkMmay call any command declared in the interfaces it uses and
must also implement any events declared in those interfaces. The Leds interface
defines several commands like r edOn( ) , r edOf f ( ) , and so forth, which turn
the different LEDs (red, green, or yellow) on the mote on and off.
Because Bl i nkMuses the Leds interface, it can invoke any of these commands.
However Leds is just an interface: the implementation is specified in the
-
7/30/2019 Motes Caracteristicas
27/35
Alessio Falchi Chapter 3 The Berkeley motes environment
43
Bl i nk. nc configuration file. An event is a function that the implementation of
an interface will signal when a certain event takes place. In this case, the
f i r ed( ) event is signaled when the specified interval has passed. This is an
example of a bi - directional interface: an interface not only provides commands
that can be called by users of the interface, but also signals events that call
handlers in the user. A module that uses an interface must implement the events
that this interface uses.
Let's look at the rest ofBl i nkM. nc to see how this all fits together:
i mpl ement at i on {
command r esul t _t St dCont r ol . i ni t ( ) {
cal l Leds. i ni t ( ) ;
r et ur n SUCCESS;
}
command r esul t _t St dCont r ol . st ar t ( ) {
r et ur n cal l Ti mer . st ar t ( TI MER_REPEAT, 1000) ;
}
command r esul t _t St dCont r ol . st op( ) {
r et ur n cal l Ti mer . st op( ) ;
}
event r esul t _t Ti mer . f i r ed( ) {
cal l Leds. r edToggl e( ) ;
r et ur n SUCCESS;
}
}
As we see the Bl i nkM module implements the St dCont rol . i ni t ( ) ,
St dCont r ol . star t ( ) , and St dCont r ol . st op( ) commands, since it
provides the StdControl interface. It also implements the Ti mer . f i r ed( )
event, which is necessary since BlinkM must implement any event from an
interface it uses. The i ni t ( ) command in the implemented StdControl interface
simply initialises the Leds subcomponent with the call to Leds . i ni t ( ) . The
s ta r t ( ) command invokes Ti mer . st ar t ( ) to create a repeat timer that
-
7/30/2019 Motes Caracteristicas
28/35
-
7/30/2019 Motes Caracteristicas
29/35
Alessio Falchi Chapter 3 The Berkeley motes environment
45
Figure 3.2.8-1
CC1000Radi oI nt M module is the data path module for the CC1000. Thismodule provides transmit and receive data movement using CSMA/CA based
contention avoidance schemes. In the receive mode , the module accepts bytes of
data from the radio via the SPI interface and performs the necessary preamble
detection , synchronization and CRC calculation/checks. When a packet has been
received , it posts a task which signals a receive event. While the stack computes
and checks the CRC , it does not drop the packet based on a bad CRC. Rather it
sets the cr c field of theTOS_Msg struct to be 1 if the CRC is valid.
To transmit the stack checks to see if the channel is clear by searching for a
preamble AND monitoring received signal strength (via the ADC). When the
channel is clear , it toggles the radio and pushes out the preamble , sync and
payload bytes. The stack also implements low power listening modes and uses the
Timer components to trigger RX and TX periods.
CC1000Cont r ol M is the control path module for CC1000 operation. This
module provides all of the management functions of the radio including tuning ,
-
7/30/2019 Motes Caracteristicas
30/35
-
7/30/2019 Motes Caracteristicas
31/35
Alessio Falchi Chapter 3 The Berkeley motes environment
47
buffer and checks for the preamble. Preamble/start symbol will be discussed in
further detail below.
To understand the behavior of MAC layer its important to discuss about TinyOS
messages structure :
t ypedef st r uct TOS_Msg
{
ui nt 16_t addr ;
ui nt 8_t t ype;
ui nt 8_t gr oup;
ui nt 8_t l enght ;
i nt8_t dat a[ TOSH_DATA_LENGTH] ;
ui nt 16_t cr c;
ui nt 16_t st r engt h;
ui nt 16_t t i me;
} TOS_Msg;
It consists of an unsigned two byte fieldaddr , followed by three unsigned single
byte fields t ype, group, and l engt h addr specifies a moteID or the
broadcast address (0xffff). When the CC1000Radi oI ntMreceives a packet, the
packet is passed to the AM level. Ifaddr is neither the broadcast address nor the
address of the mote receiving the packet, the packet is dropped.
The group field specifies a channel for motes on a network. If a mote receives a
packet sent by a mote with a different group field, the packet is dropped at the
AM level. The default group is 0x7d. The t ype field specifies which handler to
be called at the AM level when a packet is received. The l engt h field specifies
the length of the data portion of theTOS Msg. Packets have a maximum
payload of 29 bytes.
The next field in theTOS Msg st r uct is the data portion. It consists of an
array of 29 bytes (as specified by TOSH DATA LENGTH). The unsigned two
byte field crc follows. When sending, the
-
7/30/2019 Motes Caracteristicas
32/35
-
7/30/2019 Motes Caracteristicas
33/35
-
7/30/2019 Motes Caracteristicas
34/35
-
7/30/2019 Motes Caracteristicas
35/35