## 4 The SensoTube Architecture's Implementation Reference Model
### Expandability and Inter-Layer Services Mechanisms
#### 4.2.3 Inter-Layer Programming and Debugging Service Mechanism  
The embedded MCUs at the end-systems can be programmed through the method of the in-system programming (ISP). Basically, the SPI-bus is mainly used for this task together with certain signal, such as the reset, the voltage supply, and the ground signals of the devices that are to be programmed.  
Figure 19: Schematic drawing of the S-BEC 2.  
SensoTube supports the ISP method by providing all of the SPI-bus signals to its S-BEC 1 expansion pins, i.e., the MOSI, MISO, CLK and SEL pins. Several MCUs of the interconnected functional shields can be programmed via the very same ISP circuits and by addressing them using some of the general purpose input/output pins of the S-BECs.  
Regarding the debugging function, the majority of the in-system emulation and code tracing is traditionally accomplished using specific external devices, which support the IEEE 1149.1 standard for boundary scans, and are widely known as the JTAG debuggers [106; 148]. All the necessary signals for the JTAG have been provided at the S-BEC 2 (see Figure 11). The JTAG debuggers are also used for the programming task. From the side of the end-system, a sizable JTAG connector of ten up to twenty pins must be permanently soldered in the PCB. Despite the fact, that there is no use of all of the signal pins of a JTAG connector, its soldering to the end-system is mandatory, in order to ensure the connection compatibility with the JTAG devices. To overcome this design limitation, in the SensoTube, the JTAG signal pins can be routed to a particular PDL shield, on which there is the necessary JTAG connector. The PDL shield could be removed from the final WSAN system, when the latter is ready for installation in the field.  
In case of the ARM-based MCUs, which are becoming more and more popular in embedded systems [149], the IEEE 1149.1 boundary scan standard can support the debugging of two or more cores, simultaneously. Therefore, through a single interface, the designers are able to perform synchronized debugging of multi-core systems. The multiple cores can be either identical (symmetric multi-core processing--SMP), or different (asymmetric multi-core processing--AMP). The only drawback in the multi-core debugging is the need to use two, instead of one, JTAG connectors at the end systems, in order to implement the necessary scan chain. In particular, the JTAG data output signal from a target system (TDO signal) must be the JTAG data input signal to the next target system (TDI signal) in the chain. To enable the multi-core debugging, the SensoTube reference model has been enriched with the J-BEC expansion mechanism, with which the MCUs of the functional shields can have their JTAG_TDI and JTAG_TDO daisy-chained (see Figure 20). More specifically, two dual-pin connectors have been incorporated for this goal. Since the through-hole BECs cannot be daisy-chained, two dual-pin surface-mount connectors have been employed, one soldered at the top side (the white connector shown at Figure 10) and the other at the bottom side of the PCB. The signal connections, between the two connectors, can be achieved by PCB metal-plated through-holes (known as signal vias). Every SensoTube functional shield should have its own J-BEC connectors soldered onto its PCB. In cases where this feature is not used in a shield, then, the JTAG_TDI and JTAG_TDO signal should be shorted, in order to allow the signals to pass through the neighboring shields.  
The J-BEC mechanism can be incorporated by designers by simply use the sheet symbol depicted in Figure 21 which represents the j-BEC circuit.  
Figure 20: The J-BEC mechanism for the JTAG TDI and TDO data signals’ chain.