This is a message dispatcher and protocol interpreter between Sensapex SMCPv1 and Trinamic/Analog Devices TCML protocols.
This is a message dispatcher and protocol interpreter between Sensapex SMCPv1 and Trinamic/Analog Devices TCML protocols.
## Device
Run this code on a raspberry PI B3 or higher.
It should be connected via ethernet to one of the two ports of the sensapex controller.
The sensapex controller should be powered (via usb C).
An usb port should be connected from the trinamic controller (any controller that works and can be tested with TMCL IDE is compatible).
## Executing the software
- Go into the executeable subfolder (see what is in this repository section).
- choose wether you want to run the latest locally built/compiled exec or a different version (by doing ``cd ./0.2.29.400`` for example, to goat that version's location)
- run with the command :
```
./smcp1_proxy -s /dev/ttyACM0
```
``/dev/ttyACM0`` is usually the serial port used for the com with the trinamic controller. However, with unplugging / replugging, it can happen that this port is not ACM0 but ACM1, or it might even be something else. To test it out, you can use the comand :
```bash
ls /dev
```
or look at the ports in current use with this command :
```bash
dmesg | grep tty
```
## Parameters :
-``-s`` : ``SERIAL_PORT`` Specify the serial port to use (from / to trinamic ctl)
-``-u`` : ``UDP_ADDRESS`` Specify the UDP address to use (from / to sensapexctl )
-``-p`` : ``UDP_PORT`` Specify the UDP port to use (from / to sensapex ctl)
-``-n`` : ``NOTIF_FREQ`` Specify the notification frequency to use, in ms
-``-h`` Displays the help (this parameters list)
## What is in this repository :
The code sits on the `/sensapex` folder, on the root of the raspberry.
To go there, do :
```bash
cd /sensapex
```
This folder is a git repository folder. If the raspberry has internet, you can pull the lates changes done to this repository with the command : `sudo git pull` (use yourcomputer as a wifi hotspot to provide internet, so that the ethernet port stays free for communication with the senapex controller)
The folder contains :
- the src folder (the sources)
- a build folder that is created when you build the sources on the raspberry using the cmake command, through the shell scripts included here.
- the executeable folder (where the executable binaries are, that are generated by the build)
In the executeable folder, you have the latest built file (smcp1_proxy file)
as well as different versions in the form of folders, each containing an executeable built at that version.
## Building
## Building
To build the project, navigate to the project directory and run the `cmake` command:
To build the project, navigate to the project directory and run the `cmake` command:
...
@@ -30,16 +93,6 @@ sudo mv ./build/smcp1_proxy .
...
@@ -30,16 +93,6 @@ sudo mv ./build/smcp1_proxy .
This will move the executable to the root directory.
This will move the executable to the root directory.
## Running
After building the project, you can run the application with the following command:
```bash
./cmake-build-debug/smcp1_proxy
```
This will execute the `main` function defined in `main.c`.
## Make it run at start :
## Make it run at start :
...
@@ -62,12 +115,17 @@ To make it log infos into a file :
...
@@ -62,12 +115,17 @@ To make it log infos into a file :