Table of Contents

Advertisement

Quick Links

1

Introduction

The STM32W108 SimpleMAC (media access control) library provides a set of APIs to
access the lower-MAC function of the STM32W108HB, STM32W108CB, STM32W108C8,
STM32W108CZ and STM32W108CC microcontrollers (STM32W108xx). These devices
integrate a 2.4 GHz IEEE 802.15.4-compliant transceiver featuring 16 channels and
supporting 250 Kbps transfers. The SimpleMAC library is designed to run on all
STM32W108 family devices. In addition, the SimpleMAC library will allow developing
specific stacks based on the IEEE 802.15.4 standard.
This document provides information on:
IEEE 802.15.4 protocol
STM32W108 SimpleMAC library features
How to build and run STM32W108 SimpleMAC demonstration applications
How to design an application using the STM32W108 SimpleMAC library APIs
Table 1
lists the microcontrollers and tools concerned by this user manual.
Table 1.
Microcontrollers
Evaluation tools to MCUs
Figure 1.
Note:
The term application board refers to the STM32W108xx boards delivered with all available
STM32W108xx kits. This term is not used to refer to the STM32-Primer2 + MB850
platforms. For more information, visit the STM32W 32-bit RF microcontroller web pages at
www.st.com/stm32w. These web pages provide full access to all STM32W108xx resources
(kits, software packages and documents).
August 2012
Applicable products and tools
Type
STM32W108xx
STM32W-EXT
STM32W-SK
STM32W-RFCKIT
STM32W108 SimpleMAC library
Customer Application
Network Layer (Optional)
IEEE 802.15.4 Upper MAC (Optional)
IEEE 802.15.4 Simple MAC
STM32W108 Device
Doc ID 16995 Rev 10
STM32W108xx SimpleMAC library
Part numbers/product sub-classes
Customer code
Librairies provided to ST
by customers
Silicon
UM0893
User manual
MS18162V1
www.st.com
1/54

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the SimpleMAC STM32W108 Series and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Summary of Contents for ST SimpleMAC STM32W108 Series

  • Page 1: Introduction

    STM32W108xx kits. This term is not used to refer to the STM32-Primer2 + MB850 platforms. For more information, visit the STM32W 32-bit RF microcontroller web pages at www.st.com/stm32w. These web pages provide full access to all STM32W108xx resources (kits, software packages and documents).
  • Page 2: Table Of Contents

    Contents UM0893 Contents Introduction ..........1 IEEE 802.15.4 protocol .
  • Page 3 UM0893 Contents 4.3.2 Jumper settings ......... . . 29 4.3.3 Boards supported .
  • Page 4 Contents UM0893 5.3.4 SFD event ..........45 Receiving packets .
  • Page 5 UM0893 List of tables List of tables Table 1. Applicable products and tools ..........1 Table 2.
  • Page 6 List of figures UM0893 List of figures Figure 1. STM32W108 SimpleMAC library ..........1 Figure 2.
  • Page 7: Ieee 802.15.4 Protocol

    UM0893 IEEE 802.15.4 protocol IEEE 802.15.4 protocol The IEEE 802.15.4 is a standard which specifies the physical layer (PHY) and the media access control (MAC) layer for low-rate wireless personal area networks (LR-WPANs). The main features are as follows: ● Channel access via carrier sense multiple access with collision avoidance (CSMA-CA) ●...
  • Page 8: Ieee 802.15.4 Device Addressing

    IEEE 802.15.4 protocol UM0893 ● Star networks where communications are established between devices and a single central controller, called the PAN coordinator. Figure 3. Star topology IEEE 802.15.4 device addressing A unique PAN identifier is assigned to each independent PAN built on a channel. All devices connected to the network have a unique 64-bit extended address.
  • Page 9: Ieee 802.15.4 Phy Layer

    UM0893 IEEE 802.15.4 protocol 2.3.1 IEEE 802.15.4 PHY layer The PHY layer manages the physical RF transceiver. It is also in charge of the following tasks: ● Activating and deactivating of the radio transceiver ● Energy detection for the current channel ●...
  • Page 10: Ieee 802.15.4 Mac Layer

    IEEE 802.15.4 protocol UM0893 IEEE 802.15.4 PHY link quality indication (LQI) The LQI characterizes the strength and/or quality of a received packet. The measurement may be implemented using: ● Receiver energy detection ● Signal-to-noise ratio estimation 2.3.2 IEEE 802.15.4 MAC layer The MAC layer is in charge of the following tasks: ●...
  • Page 11: Figure 5. Device-To-Coordinator Communications

    UM0893 IEEE 802.15.4 protocol Figure 5. Device-to-coordinator communications IEEE 802.15.4 MAC coordinator-to-device data transfer In beacon-enabled networks, the coordinator indicates in the beacon that data is pending. The device periodically listens to the beacons and transmits a data request MAC command using slotted CSMA-CA if necessary.
  • Page 12: Table 3. General Mac Frame Format

    IEEE 802.15.4 protocol UM0893 Figure 7. Coordinator-to-device communications in non beacon-enabled networks IEEE 802.15.4 general MAC frame format The MAC frame is composed of a MAC header (MHR), a MAC payload, and a MAC footer (MFR). The MHR is composed of fixed fields. The address fields are optional. Table 3.
  • Page 13: Table 4. Phy Frame Format

    UM0893 IEEE 802.15.4 protocol Bit 6 Intra-PAN 1: frame to be sent within same PAN 0: frame to be sent to another PAN Bit 5 Acknowledge request 1: device sends an acknowledgment frame when it receives a valid frame 0: device does not send an acknowledgment frame when it receives a valid frame Bit 4 MAC frame pending 1: sender device has additional data to send to the receiver 0: sender device does not have any more data for the receiver...
  • Page 14: Stm32W108 Simplemac Library Overview

    STM32W108 SimpleMAC library overview UM0893 STM32W108 SimpleMAC library overview This section describes the STM32W108 SimpleMAC library features: ● IEEE 802.15.4 PHY features supported by the library ● IEEE 802.15.4 MAC features supported by the library ● SimpleMAC library APIs naming conventions and classes. IEEE 802.15.4 PHY layer supported features The SimpleMAC library supports the following IEEE 802.15.4 PHY features: ●...
  • Page 15: Simplemac Library Api Naming Conventions

    UM0893 STM32W108 SimpleMAC library overview SimpleMAC library API naming conventions The following naming conventions are used: General prefix ● All SimpleMAC APIs are prefixed with “ST_” followed by the general API family (e.g. Radio, AES). Callback suffix ● The functions which are implemented in the application and called from the SimpleMAC library are suffixed with “Callback”.
  • Page 16: Stm32W108 Simplemac Demonstration Applications

    UM0893 STM32W108 SimpleMAC demonstration applications Four simpleMAC demonstration applications are delivered within the SimpleMAC software library package which is available from the STM32W 32-bit RF microcontroller web pages at www.st.com/stm32w: ● SimpleMAC sample demonstration applications (sun and planet roles) ●...
  • Page 17: Boards Supported

    UM0893 STM32W108 SimpleMAC demonstration applications 4.1.3 Boards supported Table 6. Boards supported Board Board name STM32W108xB STM32W108CC Planet revision Primer2 + MB850 A A,B,C MB851 MB954 MB953A MB950A + MB953 MB953B MB951 X = supported - = not supported NA = not applicable Doc ID 16995 Rev 10 17/54...
  • Page 18: Serial I/O

    STM32W108 SimpleMAC demonstration applications UM0893 4.1.4 Serial I/O The application listens for commands sent over the serial port. The serial port configuration Table 7. Serial I/O Parameter name Value Unit Baud rate 15200 bit/sec Data bits Parity None Stop bits 4.1.5 LED description Table 8.
  • Page 19: Serial Commands Supported

    UM0893 STM32W108 SimpleMAC demonstration applications The sample applications demonstrate: ● Management of a simple direct transmission queue ● Management of a simple indirect transmit queue including interaction with the receive ISR, in order to handle the setting of the ACK frame pending bit, in response to a data poll ●...
  • Page 20: Table 11. Detailed Command Description

    STM32W108 SimpleMAC demonstration applications UM0893 Table 11. Detailed command description Command Description Display status information displays the status of the node including information such as: – Network role – Radio on/off state – In or out of a network – Channel –...
  • Page 21 UM0893 STM32W108 SimpleMAC demonstration applications Table 11. Detailed command description (continued) Command Description Leave a network can only be executed while already in a network. On sun nodes, this command simply clears out key persistent state indicating it is no longer active in a network.
  • Page 22 STM32W108 SimpleMAC demonstration applications UM0893 Table 11. Detailed command description (continued) Command Description Adjust send/poll rates can only be executed while already in a network. Sending data at a regular rate is valid on both sun and planets, but polling at a regular rate is only valid on sleepy planets.
  • Page 23 UM0893 STM32W108 SimpleMAC demonstration applications Notes Packet Reception: Commands print status information while the commands are operating. For example, when forming a network, the form command displays the selected channel, the channel energy, and the chosen PAN ID. For received packets, only data (unicast) messages are printed. These messages are the result of the send command or the rate command.
  • Page 24: Running The Sample Demonstration Application On The Stm32-Primer2

    STM32W108 SimpleMAC demonstration applications UM0893 You need to use at least two boards to perform the demonstration. Follow the instructions: Load the one board with the sun role application. Load the remaining boards with the planet role application. Open a terminal on the sun board and type f. Push the S1 button on all the planet role boards in sequence, waiting for LED D3 to switch on indicating a successful connection to the sun.
  • Page 25: Simplemac Pc Sun Gui Application

    UM0893 STM32W108 SimpleMAC demonstration applications is obtained by selecting SM SUN from the LCD menu. The The scenario shown in Figure 8 input commands listed in Table 12 can then be issued by selecting the corresponding item from the related LCD menu. Table 12.
  • Page 26: Table 13. Simplemac Sun Pc Applet Command Options

    STM32W108 SimpleMAC demonstration applications UM0893 Figure 13. SimpleMAC sun PC applet flash image check Push the button to allow the sun node to form a network. If everything is done properly, you get the following picture: Figure 14. SimpleMAC sun node forms an IEEE 802.15.4 network The SimpleMAC sun PC applet also offers these command options: Table 13.
  • Page 27: Build, Download And Run The Sample Planet Application On The Application Board

    UM0893 STM32W108 SimpleMAC demonstration applications 4.2.2 Build, download and run the sample planet application on the application board To build, download and run the sample planet application on an application board, use the related IAR project provided within the SimpleMAC software library package following the instructions described in Section 3.3.
  • Page 28: Figure 16. Planet Sending Data To The Sun

    STM32W108 SimpleMAC demonstration applications UM0893 Figure 16. Planet sending data to the sun This identifies which planet is in transmission mode, if there is more than one planet device (up to 5 planets supported by the SimpleMAC sun PC applet) Figure 17.
  • Page 29: Simplemac Talk Demonstration Application

    UM0893 STM32W108 SimpleMAC demonstration applications SimpleMAC talk demonstration application This is an example of an RF application that demonstrates point-to-point 802.15.4 wireless communication using the STM32W108 microcontroller. 4.3.1 IAR project Follow these steps to use the project with IAR Embedded Workbench for ARM: Open the Embedded Workbench for ARM.
  • Page 30: Serial I/O

    STM32W108 SimpleMAC demonstration applications UM0893 NA = not applicable 4.3.4 Serial I/O The application listens for keys typed in one node and sends them to the remote node. The remote node listens for RF messages, which it outputs to the serial port. Everything typed in one node is visible to the other node and vice versa.
  • Page 31: Usage

    UM0893 STM32W108 SimpleMAC demonstration applications 4.3.7 Usage This demonstration illustrates two use cases: ● RS232 cable replacement This scenario illustrates an existing point-to-point communication based on a wired RS232 connection, which is replaced by 802.15.4 2.4GHz RF link. ● Simple remote control implementation This scenario illustrates a button push on one board (remote control), resulting in LED activities on the other board (actuator).
  • Page 32: Simplemac Mouse Demonstration Application

    NON-INFRINGEMENT, MERCHANTABILITY, SATISFACTORY QUALITY AND FITNESS FOR A PARTICULAR PURPOSE. WITHOUT LIMITING THE GENERALITY OF THE FOREGOING, ST EXPRESSLY DOES NOT WARRANT THE ACCURACY, SAFETY, OR USEFULNESS FOR ANY PURPOSE, OF THE SOFTWARE APPLICATION. ST HEREBY DISCLAIMS, TO THE FULLEST EXTENT...
  • Page 33: Jumper Settings

    UM0893 STM32W108 SimpleMAC demonstration applications 4.4.2 Jumper settings Table 19. Jumper settings Jumper name STM32W108xB_TX STM32W108xB_RX JP1, if available Fitted Irrelevant P1, if available 2 (battery) 5-6 (USB) 4.4.3 Boards supported Table 20. Boards supported Board STM32W108x STM32W108 Board name revision Primer2 + MB850 A MB851...
  • Page 34: Button Description

    SimpleMAC OTA bootloader demonstration application The SimpleMAC OTA bootloader demonstration application is a simple program that demonstrates the Over the Air (OTA) ST bootloader protocol (see AN3262). 34/54 Doc ID 16995 Rev 10...
  • Page 35: Iar Project

    UM0893 STM32W108 SimpleMAC demonstration applications 4.5.1 IAR project Follow these steps to use the project with the IAR Embedded Workbench for ARM: Open the IAR Embedded Workbench for ARM. From the File > Open > Workspace menu, open the related IAR workspace. Select the configuration you want to build.
  • Page 36: Table 25. Serial I/O

    STM32W108 SimpleMAC demonstration applications UM0893 Table 25. Serial I/O Parameter name Value Unit Baud rate 115200 bit/sec Data bits Parity None Stop bits The list of supported commands is: Table 26. Support commands Command name Command parameters Description Find first node in bootloader mode and load test loadImage None image to it...
  • Page 37: Led Description

    UM0893 STM32W108 SimpleMAC demonstration applications ● eui64 format: hexadecimal array (for example, {0080E10200000798}) ● address format: decimal number or hexadecimal number (for example, 0xaabbccdd) ● bytes format: decimal number or hexadecimal number ● data format: hexadecimal array (for example, {aabbccddeeff0011}) ●...
  • Page 38: Simplemac Nodetest Application

    STM32W108 SimpleMAC demonstration applications UM0893 SimpleMAC nodetest application The SimpleMAC nodetest application is a low-level test program meant for the functional testing of RF modules (either your own custom-manufactured devices or those provided in the STM32W108 Kits), including token viewing, range testing, RSSI measurement, and special test modes of transmission as required for FCC and CE certification.
  • Page 39: Designing An Application Using The Simplemac Library Apis

    UM0893 Designing an application using the SimpleMAC Library APIs Designing an application using the SimpleMAC Library APIs This section provides information and code examples on how to design and implement a SimpleMAC application. The following functions are described: ● Initialization ●...
  • Page 40: Configuring The Radio

    Designing an application using the SimpleMAC Library APIs UM0893 assert(ST_RadioInit(ST_RADIO_POWER_MODE_RX_ON)==ST_SUCCESS); while(1) /* Simple MAC application specific steps */ Configuring the radio 5.2.1 Radio sleep and wakeup Call ST_RadioSleep and ST_RadioWake APIs to turn the radio off and on, respectively: /* Turning off the radio */ ST_RadioSleep();...
  • Page 41: Setting Radio Channel, Power Level And Power Mode

    UM0893 Designing an application using the SimpleMAC Library APIs 5.2.3 Setting radio channel, power level and power mode Before starting transmitting or receiving a packet, select the radio channel and configure the transmit power and transmit power mode. Pseudocode example for setting the radio channel uint8_t channel = USER_CHANNEL;...
  • Page 42: Transmitting Packets And Managing Transmit Callbacks

    Designing an application using the SimpleMAC Library APIs UM0893 Transmitting packets and managing transmit callbacks 5.3.1 Configuring the radioTransmitConfig variable Before transmitting a packet, declare a variable, radioTransmitConfig, of RadioTransmitConfig type. The RadioTransmitConfig type corresponds to a structure containing the parameters and modes related to the packet transmission features (see Table 29).
  • Page 43: Table 30. Packet Fcf Configuration As 0X0821

    UM0893 Designing an application using the SimpleMAC Library APIs The packet has to be configured according to the MAC frame format described in IEEE 802.15.4 general MAC frame format Set the packet FCF, the packet source and the destination address mode. Refer to Table 30 for an example of FCF configuration.
  • Page 44: Isr Callbacks For Packet Transmission

    Designing an application using the SimpleMAC Library APIs UM0893 If radioTransmitConfig.chechCCA equals TRUE, the CSMA-CA backoff(s) and CCA check(s) are performed using the default energy level (-75 dBm). Below is a pseudocode example of energy threshold setting for the CCA assessment: int8_t ed_cca_value = USER_ED_CCA_VALUE /* Set the energy level used for CCA assessment */ ST_RadioSetEdCcaThreshold (ed_cca_value);...
  • Page 45: Sfd Event

    UM0893 Designing an application using the SimpleMAC Library APIs Note: The “framePending” parameter is TRUE if the received ACK indicates that a frame is pending. This is a very important information to notify the sender node that the destination node has pending data for it. 5.3.4 SFD event It is possible to be notified of an SFD event (see...
  • Page 46 Designing an application using the SimpleMAC Library APIs UM0893 ST_RadioEnableReceiveCrc(TRUE); When the address filtering mode is enabled, perform the following actions: Set the radio PAN identifier: uint16_t panid = USER_PAN_ID; /* set the panid for filtering received packets */ ST_RadioSetPanId(panid); Set the node identifier if the user application requires filtering on the 16-bit short address (or node identifier): uint16_t nodeid = USER_NODE_ID;...
  • Page 47: Isr Callbacks For Packet Reception

    UM0893 Designing an application using the SimpleMAC Library APIs 5.4.2 ISR callbacks for packet reception Each time a packet is received, the ST_RadioReceiveIsrCallback(packet, ackFramePendingSet, time, errors, rssi) callback is automatically called by the library. The pseudocode below gives an example of a simple implementation of the ST_RadioReceiveIsrCallback() callback: /* buffer where storing the received packet */ uint8_t rxPacket[128];...
  • Page 48: Configuring The Coordinator Filter Mode

    Designing an application using the SimpleMAC Library APIs UM0893 Configuring the coordinator filter mode The IEEE 802.15.4 standard supports the coordinator filter mode configuration. This feature allows receiving 802.15.4. data frames which have no destination address: the packets sent must have a destination addressing mode set to 00b (destination PAN identifier and destination short address not present).
  • Page 49: Radio Aes Security

    UM0893 Designing an application using the SimpleMAC Library APIs Radio AES security Refer to the pseudocode below for an example of how to encrypt a block of data using an encryption key: /* pointer to 128 bits of key data */ uint8_t key[128] = USER_KEY;...
  • Page 50: Radio Cca

    Designing an application using the SimpleMAC Library APIs UM0893 5.8.2 Radio CCA To read the current status (clear or busy) of the selected channel, call the ST_RadioChannelIsClear API: boolean channel_status; /* Get the channel status (clear or busy) */ channel_status = ST_RadioChannelIsClear(); 5.8.3 Radio packet trace interface (PTI) The STM32W108xx includes a packet trace interface (PTI) module which performs robust...
  • Page 51: References

    UM0893 References References Table 32. List of references Title Content IEEE 802.15.4 standard specification IEEE 802.15.4 standard description STM32W108 SimpleMAC library APIs HTML document describing the SimpleMAC library APIs documentation 1. This HTML file is provided within the SimpleMAC library. List of acronyms Table 33.
  • Page 52: Revision History

    Revision history UM0893 Revision history Table 34. Document revision history Date Revision Changes 12-Feb-2010 Initial release. Updated API prefixes in Section 3.3: SimpleMAC library API naming conventions. Updated Section 4.1: SimpleMAC sample demonstration application. Modified sample image and removed Note 1 in Section 4.1.9.
  • Page 53 UM0893 Revision history Date Revision Changes Minor text edits: STM32W108xx in Introduction The radio power ranges from -43 to 8 dBm on Pseudocode example for 22-Nov-2011 setting the radio transmit power on page 41 Add uint8_t minimumBackoff to Table 29: RadioTransmitConfig members on page 42 Updated to adapt to SimpleMAC release 2.0.0: Updated...
  • Page 54 No license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted under this document. If any part of this document refers to any third party products or services it shall not be deemed a license grant by ST for the use of such third party products or services, or any intellectual property contained therein or considered as a warranty covering the use in any manner whatsoever of such third party products or services or any intellectual property contained therein.

Table of Contents