ICradio-ZWIR4512-OEM

From InCircuit
Revision as of 21:28, 21 January 2011 by Traeger (Talk | contribs)

Jump to: navigation, search
transparent

The ICradio ZWIR4512 OEM module is a | 6loWPAN radio module. The delivered 6LowPAN radio stack is able to build up a meshing network. Every node per default is relaying packets. So the user does not need to care about meshing. Just send packts to the nodes, the network will route the packets to the destination. The 6LowPAN Stack is delivered by ZMDi. It is a free for use software library in addition of some C-header files. For an easy startup with the ICradio ZWIR4512 OEM radio modules, In-Circuit deliveres the modules with an small application software. This software is connects to the UART and RF interfaces and handles some packets.

The Demo-Software implemets an UART-to-Radio protocol. For an easy use the pakets to the uart have to be send as hex-values as ASCII, meaning 0x00 ia send as "00". Only '0'-'9' and 'A'-'F' are accepted letters. Additionaly there is an 'Magic Word' - the letter 'S'. The 'S' is used as sync byte to start a packet. The packets to the UART alway have a fixed sceme:

  • first letter is the 'S'
  • followed by 2 bytes length of the packet (N + 1(type) +16(address))
  • followed by 16 bytes IPv6 address of the destination, the IPv6 address ::1 is reserved for the Local Host. Packets to the ocal host are not sent over radio, but they are commands to the module.
  • followed by 1 type-byte, that determines the type of the packet. When a module receives the packet, it decides with the type how to handle the packet data. There are several packet types pre-defined - as seen below.
  • followed by N data bytes, that determines the type of the packet. When a module receives the packet, it decides with the type how to handle the packet data. There are several packet types pre-defined - as seen below.

Example:

S00110000000000000000000000000000000105
S - sync letter
0011 - length = 0x11 = 17 bytes
00000000000000000000000000000001 - address = ::1 (IPv6 Local Host)
05 - type is 0x05 = discover-network command

This is the commad 0x05 to the Local Host. It is the command to discover the network - see below for available commands. The module executes the Stack command for scanning the network. When nodes are discovered, a callback routine is called.

void rf_CallbackDiscover( unsigned char hopCount, char rssi, unsigned char  addrCount, ZWIR_IPv6Address_t*  address ) {
 uint8_t data[2];
 data[0] = hopCount;
 data[1] = rssi;
 packetHandler(SOURCE_RF, address, PACKET_TYPE_DISCOVER_NETWORK_REPLY, data, 2);
}

The packet handler then sends this packet via uart. The address is the address of the

The module sends to the uart a pachet with PACKET_TYPE_DISCOVER_NETWORK_REPLY with the received address, the hop-count and the RSSI of the node that was discovered.

 S0013FE0800000000000000000000000012340601DF

This reply means that the node FE080000000000000000000000001234 is 1 hopcounts away and is received with -33dBm signal strength.

Pre-defined packet types:

typedef enum {
 PACKET_TYPE_DATA                            = 0x00,
 PACKET_TYPE_BIND                            = 0x01,
 PACKET_TYPE_BINDACK                         = 0x02,
 PACKET_TYPE_UNBIND                          = 0x03,
 PACKET_TYPE_SETUP                           = 0x04,
 PACKET_TYPE_DISCOVER_NETWORK                = 0x05,
 PACKET_TYPE_DISCOVER_NETWORK_REPLY          = 0x06,
 PACKET_TYPE_LED_DATA                        = 0x07,
 PACKET_TYPE_BTN_DATA                        = 0x08,
 PACKET_TYPE_GET_LOCAL_ADDRESS               = 0x09,
 PACKET_TYPE_GET_LOCAL_ADDRESS_REPLY         = 0x0A,
 PACKET_TYPE_SET_MAC_ADDRESS                 = 0x0B,
 //special type for use with ICradioPlug
 PACKET_TYPE_CONFIGURE_AS_PLUG               = 0xF0,
} PACKET_TYPE_t;



Some special commands are also implemented and have to be sent via UART to the LOCAL-HOST (::1)

  • scanning the network
 S00110000000000000000000000000000000105
  • getting the module's IPv6 address
 S00110000000000000000000000000000000109
  • setting the module's LED's
 S001300000000000000000000000000000001070100  (set LED1=on, LED2=off)
 S001300000000000000000000000000000001070001  (set LED1=off, LED2=on)
Personal tools