CALPOLY MECHATRONICS
Documentation for all Mechatronics Labs
SERIAL COMMUNICATION

Data is transmitted between the Nucleo and a connected PC using serial communication.

There are two tasks to perform serial communication, Front End which is a python script that runs on the PC, and nucleoSerial.NucleoSerial which is a task running on the Nucleo. FrontEnd prompts the user to send single ASCII characters to the Nucleo and listens for motor position data sent from the Nucleo. nuceloSerial listens for ASCII characters from the PC and sends motor position data to the PC while the Nucleo is performing motion profile tracking.
nuceloSerial.NucleoSerial is set up as a state machine to allow for rapid execution on the single threaded Nucleo without interrupting other tasks. The state machine cycles between listening for user input, logging motor position data, and transmitting motor position data, as shown in Figure 1 below.

nucleoSerial gets motor position data from the controller task via shares , which is used to share data between tasks on the Nucleo.