-Kipling
The purpose of this project is to build a Client-Server application which can enable the Beaglebone Black to control the pulse and direction signals for up to six stepper motors.
A Windows based C# application (TiloWinServer) acts as a controller to send the frequency and direction information to a C# Mono based client (TiloClient) running on the Beaglebone Black. Both the Server and the client share a common code library (TiloCommon).
Since the Linux operating systems (in general) offered for the Beaglebone Black are not designed for realtime operations, one of the Programmable Realtime Units (PRU1) on the Beaglebone Black is used to control the stepper motor step and direction signals. This means the train of pulses to the stepper motors is both continuous, consistent and not affected by the operating system swapping processes in and out of memory.
The flow of information proceeds from the TiloWinServer via TCP/IP to the TiloClient which then hands it off to a program running in the PRU1 which sets the direction signals and forms the pulses at the appropriate frequency. The information is transmitted from the Server to the Client (and back) via an instantiated C# object. If your interest is primarily in the ability to send information via TCP/IP wrapped in an object container, then you should probably have a look at the RemCon project - this project is specifically designed to demonstrate that functionality. The Client/Server aspect of the Tilo project is directly derived from the RemCon project.
The program running in the PRU1 (PRU1_StepperIO.p) is a PASM Assembly language program. It is designed to produce consistently timed pulse frequencies irregardless of how many other steppers are running or if they are enabled or disabled while others are running. It does this by setting up "blocks" for each stepper that take an equal number of steps (10) on every branch. Thus, if the motor is disabled the block takes 10 steps, if the motor is enabled and sending pulses it takes 10 steps. Even the special circumstances during the transition of the output pin from low to high (or vice-versa) also take 10 steps. This makes the output very stable with no "short" or "long" pulses while other motors activate or de-activate. Quite high frequencies (around 1.5MHz) are possible and significantly higher frequencies would be possible if the number of supported steppers was reduced and/or other optimizations undertaken.
The PASM Assembler is available online as C source and a pre-compiled version can be obtained at the following address https://github.com/OfItselfSo/PASM_Assembler. The TiloClient has a post build step that will compile the PRU1_StepperIO.p file. You will need to obtain the PASM Assembler or you can just ignore the error and use the compiled version of PRU1_StepperIO.p which ships with the source code.
The PRU1 outputs its signals on the following pins on the P8 header of the Beaglebone Black
STEP0_OUTPUTREG P8_45 // the pin we toggle to set the state STEP0_DIRREG P8_46 // the pin we toggle to set the direction STEP1_OUTPUTREG P8_43 // the pin we toggle to set the state STEP1_DIRREG P8_44 // the pin we toggle to set the direction STEP2_OUTPUTREG P8_41 // the pin we toggle to set the state STEP2_DIRREG P8_42 // the pin we toggle to set the direction STEP3_OUTPUTREG P8_39 // the pin we toggle to set the state STEP3_DIRREG P8_40 // the pin we toggle to set the direction STEP4_OUTPUTREG P8_29 // the pin we toggle to set the state STEP4_DIRREG P8_30 // the pin we toggle to set the direction STEP5_OUTPUTREG P8_27 // the pin we toggle to set the state STEP5_DIRREG P8_28 // the pin we toggle to set the directionIt should be noted that the pins used by the PRU1 conflict with those used by the HDMI video and thus the Beaglebone Black must run headless in order to output the signals. In the authors test system the eMMC memory was also disabled.
A suitable Device Tree Overlay with the appropriate PinMux configuration is included in the source code of the project. A help page which provides advice on implementing the overlay is also available, please see the Beaglebone Black And Device Tree Overlays page.
The process of getting the Tilo Project software operational has numerous pre-requisites.
The Tilo Sample Applications are open source and released under the MIT License. You can download, clone or fork the Tilo Sample Projects at the following address:
https://github.com/OfItselfSo/Tilo
The example screenshot below is the main form of the TiloWinServer sample application after it has sent several messages to the TiloClient.
The contents of this web page are provided "as is" without any warranty of any kind and without any claim to accuracy. Please be aware that the information provided may be out-of-date, incomplete, erroneous or simply unsuitable for your purposes. Any use you make of the information is entirely at your discretion and any consequences of that use are entirely your responsibility. All source code is provided under the terms of the MIT License.