-
Notifications
You must be signed in to change notification settings - Fork 0
Installation and Setup
Throughout the development of the project, we used the texas instruments Tiva TM4C123GH6PM Microcontroller. Thus, these hardware setup instructions will only apply to this microcontroller.

- PA6 and PA7 connect to M0 and M1 on the driver for sending information from the tiva to configure the stepper motor's microstep resolution with the following configs:
- (M0, M1)
- (Low, Low) - full step
- (High, Low) - half step
- (Low, High) - quarter step
- PA2 connects to the "Step" pin to send a signal to the driver to step the motor to the next position
- PA3 configures the direction of the stepper motor where:
- Low - clockwise
- High - anticlockwise
- VMOT and GND MOT connect directly to the positive and negative 12V power supply terminals
- GND Logic connects to one of the microcontroller's GND pins.
- Both PB GPIO pins connect to the N0 limit switch pins with ground connected in parallel with a 1 Ω resistor inbetween.
- The C pin on the limit switches connects directly to one of the microcontroller's 3.3v pins.
- PE3 is the pin where ADC reads in the analog voltage signal and converts it to a digital smaple value. This signal ranges in voltages from 3.3V to 0V, which translates to values between
- (A1, B1) and (A2, B2) connect to the separate bipolar stepper motor coils
- Unzip the DLS.zip file into your preferred installation location
- Run the DLS.exe file
- Install the latest version of python 3
- pip install the following libraries
- PyQt5
- matplotlib
- numpy
- pathlib
- pyserial
- pycrc
- Run the program from the GUI folder with the command:
python app.py
Release builds are created for the user interface using the PyInstaller library. Pyinstaller uses a spec file to configure the build of the application, including the name of the application and files to bundle together with the build.
The spec file app.spec in the GUI folder contains the requried configuration for creating the release build. By running the following command the build will be created within the dist folder of the current terminal directory.
pyinstaller (path to GUI folder)/app.spec
After the dist folder is created, move it the desired installation location and optionally create a shortcut to the .exe file.
This software was written for and tested on the Tiva C TM4C123GH6PM microcontroller, but it has been written to minimally coupled so that it may be used across other microcontrollers. The exception being the setup code, although the tm4c123gh6pm.h header file uses a common naming scheme, allowing it to be swapped out for other tiva microcontrollers. You can find these header files here (https://github.com/speters/CMSIS/tree/master/Device/TI/TM4C/Include) or use the CMSIS library.
The code is written in and compiled tiva c++ 11. This compiler is specific to tiva microcontrollers and doesn't support all functions of the c++ 11 language. For a reference on what features are supported see.
All required software is also located within the resources folder of the repository.
- Install Keil µVision IDE for Cortex and Arm devices (https://www.keil.com/demo/eval/arm.htm)
- Install the drivers for the TM4C123GH6PM microcontroller or other relevant drivers.
- Install the stellaris ICDI drivers to communicate over usb for debugging. (https://www.ti.com/tool/STELLARIS_ICDI_DRIVERS). An alternative is ULink
Compiler Control String may be subject to change depending on your version of keil. Also ensure that your keil supports compilation to C++. To change the compiler configuration go to Options for target -> C/C++
-c --cpu Cortex-M4.fp -D__EVAL -g -O0 --apcs=interwork --split_sections --cpp11-I./RTE/_Target_1 -IC:/Users/newuser/AppData/Local Arm/Packs/ARM/CMSIS/5.6.0/CMSIS/Core/Include -IC:/Users/newuser/AppData/Local/Arm/Packs/Keil/TM4C_DFP/1.1.0/Device/Include/TM4C123 -D__UVISION_VERSION="528" -D_RTE_ -DTM4C123GH6PM -o .\Objects\*.o --omf_browse .\Objects\*.crf --depend .\Objects\*.d

It's recommended to use a lower optimization setting like Level 0 when debugging source code so that the debugger allows you to step over each line that's been written or to avoid unwanted changes by the compiler.
- If using the Stellaris ICDI driver, go to Options for Target -> Debug and change to use Stellaris ICDI in the top right drop down menu.

- Build the project (Shortcut - F7)
- Start Debugging Session (Shortcut - Ctrl + F5)
Terminal Mode allows you to use a SSH client to send off individual commands to the microcontroller for custom behaviour. Only instructions specified within the instruction.py and Instruction.cpp files collectively may be used. The format for each command is as follows:
instruction x1 x2 ... xn\n
Other debugging commands that have been implemented for use include:
-
state\n- prints all state variables of the microcontroller. -
p\n- prints all elements in the queue from front to end.
In order to enable terminal mode you must change the settings.ini file to include "terminalmode = true" under [Default] and the boolean variable "terminalMode" in main.cpp must be set to true.
Examples of programs to use are:
- Windows:
- PuTTY - (use Ctrl + J to enter newline characters)
- Mac:
- Termius