1 Introduction

Nowadays, computing is extensively used everywhere and appears in most of embedded application. These applications integrate a smart device that can communicate and exchange data between them without human intervention. In another hand, these devices can take decision automatically to repair a fault in the application. These systems are known ubiquitous computing or Internet of Things (IoT).

The main objective of such systems is to create an embedded and flexible architecture to facilitate the using of application, especially for people having low programming skills. This technique is known by Firmware On-The-air (FOTA) that can upgrade the software of multi devices with multicast transmission [1]. In this way, we can program several MCU, instead of taking them to service center and updating them with special equipment.

Mr. Ian Drew, the Vice President of ARM marketing department has mentioned that an exponential increasing of connected devices that will be around 1 trillion devices, by 2025 [2].

Mr. Drew explained that by the tendency to embed objects in a computer, it can be noted that these systems surrounding us and very popular in the future. Using the FOTA technique, these devices have a specification to being intelligent and communicate together autonomously, and execute thread without any human contribution.

Most of these devices are based on microcontrollers with low speed to assure low dissipation energy. By 2020, according to Mr. Drew, microcontrollers market will have exponential growth, especially those with high performance and used in communication, mobile phone and personal computers [2].

To make a system based on a ubiquitous computing, it is necessary to use an intelligent computer that can execute tasks to adapt the application to the customer. These computers are expected to be integrated into our daily activities and objects such as furniture’s tables, chairs, and even clothes, introducing therefore, the new concept of internet of things [3]. The internet of thing requires multidisciplinary knowledge such as systems design and engineering, systems modeling, wireless sensor communication, computer networking, security and energy supply.

In this paper, we present a proof of concept for a ubiquitous computing using universal wireless programmer with broadcast communication option. We also, use FOTA technique to design our multi point and universal wireless programmer that we called (MPUW) for MCU, which make the operation of upgrading firmware for nodes connected in network, easier and faster.

Our approaches tested and validated on most popular microcontroller based on Cortex microprocessor. We have verified our approaches and performed our algorithm on STM32F4xx microcontroller based on last processor developed by ARM Company Cortex-M4. This MCU contains the most popular processor that is why we have selected and worked with it. Therefore, we can apply our MPUW programmer to any other MCU.

The remainder of this paper is organized as follows. Section 2 presents the problem formulation in which we focus on the needs of an application. Section 3 entitled related works. We study related works and we compare them with our proposer programmer. Therefore, the new MPUW programmer is presented in Sect. 4, followed by experimental result in Sect. 5. Finally, Sect. 6 concludes the paper.

2 Problem Formulation

In this research, we focus on the issues of reliability, flexibility, and hard-to-reach area, while using wireless connectivity in ubiquitous applications such as updating and upgrading firmware.

According to Mr. Gartner [4], in a smart city for example there is about 1.6 billion device are connected and there is 5.5 million new devices will be connected every day.

We notice that the IoT is applied in various applications, such as health, agriculture, military, automobile etc…

In some application like agricultural, sensor node are placed in unreachable location [5], same as in defense organization, which nodes are placed in risky site [5], also in automobile [6], vehicles in the future will be connected together using network communication, they also, can link with their environment in proximity. Using OTA software update vehicles will enable to configure of their software application. That way the owner car can avoid the placement to the authorized workshop for updating software.

These studies prove the necessity to design and to develop a programmer that can be able to upgrade several sensor nodes firmware in order to efficient use of battery live time, quickly response, safety and security communication. Then, we propose our MPUW, a wireless programmer for a microcontroller to be able to communicate with other nodes based on microcontroller and to update their firmware remotely supporting almost required features needed for IoT application.

3 Related Works

Many research and industrial works are carried-on to design a programmer for microcontrollers such as PIC [3], STM [7] and ATMEL [7]. However, few of them are interested to develop a wireless programmer.

Authors in [3] present a prototype for a wireless programmer for PIC. The computer communicate with the only dedicate programmer kit which contain target PIC connected via socket. The communication between computer and programmer kit is done over Bluetooth USB dongle in order to send the new image file, then we should get the target PIC and put it manually to desired sensor node.

In fact, the prototype proposed by the authors in [3] support many weaknesses, in the first hand the non-use of a recommended protocol for WSN application due to higher power consumption. The communication protocol used is Bluetooth V4.0 witch point-to-point protocol and not dedicated to IoT application. Secondly, authors [3] do not require any security level while sending the new image, that way the presented prototype has not secure firmware update functionality.

Some other research like [8], use FOTA technique in the automobile field, to ensure vehicle ECU update remotely. The solution presented in [8] is based on the firmware on-the-air to update the code of the ECU, through the system memory (boot loader). The application presented in [8] support a basic point-to-point data link between the programmer and a target ECU to be upgraded.

By the way, the presented technique in [8] cannot support multiple nodes with broadcasting the image code to many devices at the same time. In literature [9, 10] point-to-point method is not the efficient communication due to power consumption overhead and the increase of the latency when sending new image code, especially in the case when the nodes are randomly distributed such as WSN in agriculture filed.

In addition, the checking code used in [8] is based on poplar data verification error code technique CRC. But this method support many faults and cannot guarantee security level when sending the new code for critical application such as defense organization, heath care, etc. [11]. Also, in [6], authors present a system of wireless software updating. The new code image is broadcasted to the targeted node using Block Chain (BC) as cryptographic security application. The image code is divided on many blocs chained together.

Nevertheless, the system presented in [6], make a static broadcast for a well-defined number of node, so it cannot support a dynamic broadcast.

As seen in cited works, we notice that the software OTA upgrading approach is used essentially in automotive field, in which the vehicle is considered as node. So the identification of such node is known in advance.

In our approach, we consider a system with a multiple node distributed in unknown area (agriculture field, health or defense organization). In such situation, we are facing a non-wired access and we are asked to upgrade the node even it is hard to reach it. Thereafter, we have to know the identification of the node to receive the new code image. The employment of a dynamic broadcasting is mandatory solution to tackle the problem of unknown and unreachable node, which will improves the efficiency of the system.

4 System Conception Overview

  1. A.

    On-The-Air (OTA) update application

For classical approach, MCU is updated via wire connection such us USB cable, JTAG, SWG, etc. However, as presented in previous section, upgrading firmware of MCU using OTA technique is highly required in IoT systems, due to the randomly distribution of nodes.

We present in this paper our wireless programmer as a solution to allow the firmware updating remotely of a node.

Our programmer, which we call MPUW, is a generic solution can be implemented in any MCU (STM, ATMEL, etc.). Our design is tested and validated on STM32 MCU which is most popular microcontroller based on CortexM4 core.

  1. B.

    MPUW features

In this section we present our wireless programmer MPUW and his features. The MPUW contain mainly tow characteristics: wireless and dynamic broadcasting.

Our wireless programmer MPUW can communicate with one or multiple nodes called device side, to upgrade their firmware. The new image code is sent to the slave device via wireless connection.

  1. (1)

    Wireless: There is many ways to make wireless communication in SWN system, but the most recommended interfaces are Bluetooth or Xbee, for their lower energy consumption [9]. In this paper, we choose the Bluetooth interface to make wireless communication between two entities: host side (master), device side (slave). In other hand, we guarantee the energy efficiency. The slave and the master node are equipped with Bluetooth wireless communication module.

  2. (2)

    Dynamic multipoint access: In this section, we present the dynamic broadcasting aspect of our MPUW. The network must take into account every new node which want to be added to the network. The new node sends a request to send to the host. It asks for communication with the network.

Then, the master indicates to the connected nodes that he will be not available for a clock ticks. That way the master will communicate only with the new node to enable it the access to the network, thereafter, it send his virtual identification (ID_V) which is calculated by CRC8 using his electronic identification. The result is an ID_V coded on one byte. On his side, the host resends the virtual ID as a confirmation to be added to the network.

In addition, if one node will be deleted from the network, the host can disconnected this node by erasing his virtual Id. Thereby; the host can add or delete a node to/from the network dynamically.

  1. C.

    Implementation design

  2. (1)

    Bloc overview: We consider two modules that constitute the main system architecture. As shown in Fig. 1. The first module is the master, which is the programmer device, and the second module is the slave node, which is the device to program.

    Fig. 1.
    figure 1

    MPUW system overview

  3. D.

    Flowchart and description

In this section, we present different flowchart of our MPUW programmer system. Figure 2, describe the function Get_Start() allowing new node to be added to the network dynamically. Figure 2, present the algorithm of device side. At first, the device calculates his virtual Identification (ID_V) based on his unique ID, which is on 96 bit, using CRC8 to define one byte. Secondly, the slave node send the command of requesting joining network after checking flow control HW (CTS/RTS). Finally, the new node send his virtual ID, when he received the confirmed commend from the host.

Fig. 2.
figure 2

Flowchart device side (request to enter network)

To end the communication between the host and the new node, the second, receive his own virtual ID as confirmation to be operational in the network, also, he receive ACK to finishing the transmission.

Figure 3 illustrate the host side, the host indicate that the way is free by sending CTS, and then he waiting for RTS. If he received, RTS and the command code 0x55, the master device knows that is a request of adding new node to the network. To confirm the slave’s request, the host sends confirmation code (0xAA), then, it will be waiting for the virtual ID. Once, the master device receive the virtual ID (one byte), the communication will be ended by resending the virtual ID for confirmation and ACK.

Fig. 3.
figure 3

Flowchart host side (add new node network)

Finally, sending clear CTS can finish the communication with the new node, and let other nodes to communicate with the master.

When the communication between the master and the slave about sending payload, the algorithm of sending and receiving message is illustrated respectively in Figs. 4 and 5. The device node is in waiting mode for CTS signal, which is made high by the master then it receive request to send (RTS) signal from the device, as far as, the host receive the ID_V and the number of byte of the message. Then the transmission of a coded payload is done in loop until finishing the number of bytes. From his side, the Host decoded the received message using the same algorithm and the confirmation code (0xAA) is sent to ensure that the information is transmitted.

Fig. 4.
figure 4

Flowchart device side (sending payload)

Fig. 5.
figure 5

Flowchart master side (receive payload)

Using the algorithms presented previously, we can ensure communication between the Host and all slaves’ nodes. This communication can be a firmware upgrading or getting information from node. According to the following Table 1, sending the code of each command, allows its performing.

Table 1. On The Air command

5 Experimental Results

In this section, we will validate the algorithm proposed in Sect. 4 and we provide a performance evaluation of our solution which tested on real wireless sensor based on X-NUCLEO-IDS01Ax kit [12] plugged to NUCLEO-F446RE board kit [13] under the following conditions (Fig. 6):

Fig. 6.
figure 6

Node based on X-NUCLEO-IDS01Ax plugged to STM32F446RE NUCLEO board.

  • Five nodes:

    • four nodes are used as device side connected together based on ring Topology.

    • one node: is used as host side.

  • CPU running at a frequency of 168 MHz

  • Real View Microcontroller Development Kit (MDK-ARM) toolchain 5.24a ST-Link

  • Optimization option: level 3(-O 3) for size.

The number of clock cycles measured for each command presented previously is illustrated in the following Table 2.

Table 2. The required clock cycles

Note: To calculate the number of cycles needed to perform “Send firmware code”.

Cycles = Process cycle of data page * number of sectors.

We present also, the memory footprint of our software application as shown in the following Table 3. We mention that the flash memory is presented as sector. The In application programming sector is 16 KB.

Table 3. Memory footprint

6 Conclusion

Among various sensor challenges, this work has focused on updating a firmware, which serves as a solution to make the deployment of wireless sensor networks more efficient and simply for ecosystem.

In this paper, we studied and proposed an efficient implementation for the upgrading Firmware using OTA technique with small size memory processing. We called our design MPUW since it is a multi-point MCU programmer and it support adding or deleting node dynamically. The proposed design has been implemented onSTM32F4 + Bluetooth shield and tested based on ring topology.