 Durante questo video tutorial, ci mostreremo come è possibile implementare su un dispositivo di ISPU il vostro algoritmo custom iniziando da un esempio template che puoi trovare nel package di Xcube ISPU Per questo tutorial, useremo il package di Xcube ISPU, l'idea STM32Cube e finalmente la grafica user interface unicleo. Se vuoi capire come è il hardware usato per l'ISPU, che software bisogna, e iniziare a settare l'environmento, scegliete i video per l'ultimo tema. Iniziamo a costruire il tuo nuovo progetto da un template. Il primo step è di ottenere il package di Xcube ISPU e andare nel folder di ISPU. Selezionando l'applicazione, trovete un folder template che useremo per costruire l'esempio. Il primo step che voglio aiutare è che bisogna ottenere il file del ridim per vedere tutte le domande che saranno relevanti per il vostro sviluppo. Per prima volta, è esplorata tutto il struttore dei template che sono i file e cosa sono usate. Seconda volta è esplorata un file .jason esplorando i sintax e provando alcuni esempi. Poi, come è il template, copriamo il folder dove vuoi, nel nostro caso, copriamo il file nel desktop e lo rinamiamo. Questo sarà il nostro folder progetto. Per questo tutorial, ci mostreremo come puoi facilmente implementare alcuni algoritmi di conto nel device di ISPU. Questo è il motivo di rinamare il folder come folder di conto. Ora, andiamo ad ottenere il progetto e vediamo cosa è dentro del folder. Troverete diversi subfolder. Andiamo ad esplorare. Il primo è Eclipse. In questo folder, there are files to use the project with the stm32qbyd among other eclipse-based ID. In the make folder, there is the make file in case you want to use the command line to make your program. Since in our case we want to use the stm32qbyd, let's open it. The first step you need to do is to import the project. Go fetch our project folder, meaning the counter one. We select the whole folder, and the project is correctly imported. When importing the project, it has a generic name ISPU. We can rename it and call it counter. Ok, so let's check which are the different blocks that we have here. The first folder from the top that we see is the ISPU utils folder, which has different files which are necessary to have, but no need to modify them. Just we will use them during the code generation. We have first the linker script where it is defined the memory layout of the ISPU. Then we have the register map which contains the definition of the addresses of all the registers which you can access in the ISPU. Then there is the peripheral which contains other useful defines that we will use during this tutorial. There is the assembly, the CRT0, which is the startup file which runs at the startup. And finally there is the global which contains some macro in assembly. The main and most interesting part is the main.c Where the user needs to write its own code and where we will write and implement our counter algorithms. In this file we need to write our own code. So what do we see here? There are two main functions. Igo00 in it and Igo00 which are the two functions where the user needs to implement its own algorithm. Then there is the main function which has not to be modified by the user which deal with the processing flow and the interrupt generation. Since for this example we want to generate two counting algorithms, one incrementing the counter and the other one decrementing we need to define them. So let's define the counter as uint8 I define the counter forward and the counter backward. Since they are defined as uint8 we need to include the standard int. So let's start building the forward counter. We define the forward counter in the Igo00 initialization function. The initialization function runs one time only after the algorithm has been enabled. It is therefore needed to initialize the algorithm. So we give to the counter the initial value of 0. Then in the run function that is the Igo00 function it is needed to implement the algorithm step which is executed at every sample generated by the sensor. So we need to increment the counter. Now to read it externally it is needed to bring it to the output registers. In order to do so we need to consult the register map and there is the define of the output register. So let's copy paste it but how to address it? Well we need to open the peripherals where there are the defines. Since the counter variable is a uint8 we use this macro to cast the address and we assign the counter forward. We can delete the comment in this line and we generate the interrupt for the first algorithm. Now to set the backward counter we can copy and paste what we just did changing the name of the functions 201. We implement the backward counter in the initialization function and we give it the value once again equal to 0. On the other side in the run function it is needed to make a backward counting decrementing the values. Then we need to copy it not in the same register so again we check the register map and we select the next byte for the output. We can select the output byte that is 00 underscore b and we write the backward counter. In this case we set for the interrupt the second bit to differentiate the two interrupts. Let's now build the project. So there is one more step to be done. If we open the project folder there is a configuration.txt file conf.txt Let's open it. It contains some parameters for the sensors and for the ISPU itself. In this file we see some parameter for example of the accelerometer such as the odier, the full scale and we can see that the accelerometer is in high performance. Then there are some settings of the ISPU. At the bottom of the page there is the possibility to enable the algorithm 0 and the interrupt 1 for the algorithm 0. Since we have two algorithms for this exercise we just need to copy and paste the lines to enable the algorithm 1. In this way also our second algorithm can run and generate an interrupt. So let's build once more the project the configuration.txt file is used in the last step of the building process. Ok, so now we want to check if what we did works. So let's go in our project folder then we go in the eclipse and then the release folder. The ISPU.h and the ISPU.ucf file which were created after building the project with a Q by D. Since for this tutorial I want to try our algorithms using a unique geographical user interface I will need to use the UCF file but to do so we are missing the JSON file to write the output. So how to build the JSON file to the XQ by ISPU folder And once again it is needed to check the readme file that we open at the beginning of this tutorial. There we can see a JSON example which has been written in two different ways we can copy one of them and we can use it to create the JSON file. Let's write a new txt file txt documenter which has to be named and we paste here the example. The JSON file has to have the same name as the UCF file and so we keep the name ISPU. Since for this project we build two algorithms with two outputs we need to give the name to only two outputs. There is the forward counter and the backward counter We don't have the third output so we can remove it. Moreover we don't have output in the int16 format but in the uint8 so we substitute the script and we save the file. Finally, let's check the results. We connect the nuclear board and we click on start. Let's go fetch the project and let's import the ISPU.UCF file that we created. Here we see two algorithms output as expected, one counting forward and one counting backward. I hope that you enjoyed this hands-on on how to build your first example starting from the template folder in the XQBiSPU software package.