In the first week of the lab final, we were tasked with setting up the serial communication between the Spyder Console and the Nucleo.
Instead of relying on time to send data at regular intervals, it's more important to be able to request data whenever wanted and get the data in a timely manner. To implement this, the front end (Spyder Console) was set up to interact through the serial port. The data was sent through one of the USBs, and read on the board. In order to send data back, a script was created to send data through the UART port, which would send it back through serial to the front end. In addition, the two USBs allowed for debugging commands to show up in PuTTy, whereas only specific commands would be displayed in the Spyder Console. This is important because a user doesn't want to see all the commands and debugging code when testing the final product.
To test the program, when the letter g was pressed, a command was sent to the Nucleo to start sampling data. For this first week, this just took in time and found a value from an exponentially decaying periodic function. Once the time limit either ran out, or if the s key was pressed, the data collection stopped. The uiTask.py, which was the file that had the exponetially decaying function on it, then sent the data through serial back to the front end for plotting.
Code for this part of the project has since been written over, but their final forms can be viewed at the following files.
Additionally, a plot of the response to the function was created to ensure that the data collection method and keyboard commands were working. This can be seen in Figure 1, the function correctly was sampled at a reasonable interval (as can be seen by the resolution of the function).
Below is a summary of the state diagrams utilized for the week. These stayed fairly consistent between weeks (the overall flow stayed the same, we were just exporting/sending more data with each week).