Skip to content

Commit 3bfc468

Browse files
committed
Add platformio.ini and Makefile
1 parent 98f5528 commit 3bfc468

File tree

7 files changed

+229
-58
lines changed

7 files changed

+229
-58
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@
99
*~
1010
\#*\#
1111
.\#*
12+
.pio
13+
.venv

.metadata/README.org

Lines changed: 76 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
* Library Information
1414
- Name :: TMC2209
15-
- Version :: 9.0.10
15+
- Version :: 9.0.11
1616
- License :: BSD
1717
- URL :: https://github.com/janelia-arduino/TMC2209
1818
- Author :: Peter Polidoro
@@ -688,13 +688,6 @@ current since the driver will adjust the offset automatically.
688688

689689
* Examples
690690

691-
The example *.ino files use "Serial1" to be compatible with most boards.
692-
693-
The following wiring examples uses "Serial3" so the same pins can be used to
694-
test both HardwareSerial and Software serial on each of the boards.
695-
696-
To test this wiring, change "Serial1" in the example files to "Serial3".
697-
698691
** Wiring
699692

700693
*** Teensy 4.0
@@ -741,41 +734,102 @@ To test this wiring, change "Serial1" in the example files to "Serial3".
741734

742735
* Host Computer Setup
743736

744-
** GNU/Linux
737+
** Download this repository
745738

746-
*** Drivers
739+
[[https://github.com/janelia-arduino/TMC2209.git]]
740+
741+
#+BEGIN_SRC sh
742+
git clone https://github.com/janelia-arduino/TMC2209.git
743+
#+END_SRC
747744

748-
GNU/Linux computers usually have all of the necessary drivers already installed,
749-
but users need the appropriate permissions to open the device and communicate
750-
with it.
745+
** PlatformIO
746+
747+
*** Install PlatformIO Core
748+
749+
[[https://docs.platformio.org/en/latest/core/installation/index.html]]
750+
751+
#+BEGIN_SRC sh
752+
python3 -m venv .venv
753+
source .venv/bin/activate
754+
pip install platformio
755+
pio --version
756+
#+END_SRC
751757

752-
Udev is the GNU/Linux subsystem that detects when things are plugged into your
753-
computer.
758+
*** 99-platformio-udev.rules
754759

755-
**** Download rules into the correct directory
760+
Linux users have to install udev rules for PlatformIO supported boards/devices.
756761

757-
***** Teensy
762+
**** Download udev rules file to /etc/udev/rules.d
758763

759-
#+BEGIN_SRC sh :noweb yes
760-
curl -fsSL https://www.pjrc.com/teensy/00-teensy.rules | sudo tee /etc/udev/rules.d/00-teensy.rules
764+
#+BEGIN_SRC sh
765+
curl -fsSL https://raw.githubusercontent.com/platformio/platformio-core/develop/platformio/assets/system/99-platformio-udev.rules | sudo tee /etc/udev/rules.d/99-platformio-udev.rules
761766
#+END_SRC
762767

763768
**** Restart udev management tool
764769

765-
#+BEGIN_SRC sh :noweb yes
770+
#+BEGIN_SRC sh
766771
sudo service udev restart
767772
#+END_SRC
768773

769-
**** Ubuntu/Debian users may need to add own “username” to the “dialout” group
774+
**** Add user to groups
770775

771-
#+BEGIN_SRC sh :noweb yes
776+
#+BEGIN_SRC sh
772777
sudo usermod -a -G dialout $USER && sudo usermod -a -G plugdev $USER
773778
#+END_SRC
774779

780+
**** Remove modemmanager
781+
782+
#+BEGIN_SRC sh
783+
sudo apt-get purge --auto-remove modemmanager
784+
#+END_SRC
785+
775786
**** After setting up rules and groups
776787

777788
You will need to log out and log back in again (or reboot) for the user group changes to take effect.
778789

779790
After this file is installed, physically unplug and reconnect your board.
780791

792+
*** Compile the firmware
793+
794+
**** Gnu/Linux
795+
796+
#+BEGIN_SRC sh
797+
make firmware
798+
#+END_SRC
799+
800+
**** Other
801+
802+
#+BEGIN_SRC sh
803+
pio run -e teensy35
804+
#+END_SRC
805+
806+
*** Upload the firmware
807+
808+
**** Gnu/Linux
809+
810+
#+BEGIN_SRC sh
811+
make upload
812+
#+END_SRC
813+
814+
**** Other
815+
816+
#+BEGIN_SRC sh
817+
pio run -e teensy35 -t upload
818+
#+END_SRC
819+
820+
*** Serial Terminal Monitor
821+
822+
**** Gnu/Linux
823+
824+
#+BEGIN_SRC sh
825+
make monitor
826+
#+END_SRC
827+
828+
**** Other
829+
830+
#+BEGIN_SRC sh
831+
pio device monitor --echo --eol=LF
832+
#+END_SRC
833+
834+
781835

Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.PHONY: clean
2+
clean:
3+
rm -rf .pio
4+
5+
firmware: clean
6+
pio run -e teensy41
7+
8+
.PHONY: upload
9+
upload: clean
10+
pio run -e teensy41 --target upload --upload-port /dev/ttyACM0
11+
12+
.PHONY: monitor
13+
monitor:
14+
pio device monitor --echo --eol=LF

README.md

Lines changed: 97 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
- [Library Information](#org90c2955)
2-
- [Stepper Motors](#org70e9129)
3-
- [Stepper Motor Controllers and Drivers](#org3801345)
4-
- [Communication](#org76570a9)
5-
- [Settings](#orgc9473ce)
6-
- [Examples](#org66b2186)
7-
- [Hardware Documentation](#org733ac67)
8-
- [Host Computer Setup](#org52dc625)
1+
- [Library Information](#org279b5c1)
2+
- [Stepper Motors](#org4bc6737)
3+
- [Stepper Motor Controllers and Drivers](#org26bfc5e)
4+
- [Communication](#org223fc68)
5+
- [Settings](#orgb8dcddf)
6+
- [Examples](#org22c0b13)
7+
- [Hardware Documentation](#org51b6a4b)
8+
- [Host Computer Setup](#org83c69bb)
99

1010
<!-- This file is generated automatically from metadata -->
1111
<!-- File edits may be overwritten! -->
1212

1313

14-
<a id="org90c2955"></a>
14+
<a id="org279b5c1"></a>
1515

1616
# Library Information
1717

1818
- **Name:** TMC2209
19-
- **Version:** 9.0.10
19+
- **Version:** 9.0.11
2020
- **License:** BSD
2121
- **URL:** <https://github.com/janelia-arduino/TMC2209>
2222
- **Author:** Peter Polidoro
@@ -30,7 +30,7 @@ The TMC2209 is an ultra-silent motor driver IC for two phase stepper motors with
3030
<img src="./images/trinamic_wiring-TMC2209-description.svg" width="1200px">
3131

3232

33-
<a id="org70e9129"></a>
33+
<a id="org4bc6737"></a>
3434

3535
# Stepper Motors
3636

@@ -41,7 +41,7 @@ A stepper motor, also known as step motor or stepping motor, is a brushless DC e
4141
[Wikipedia - Stepper Motor](https://en.wikipedia.org/wiki/Stepper_motor)
4242

4343

44-
<a id="org3801345"></a>
44+
<a id="org26bfc5e"></a>
4545

4646
# Stepper Motor Controllers and Drivers
4747

@@ -89,7 +89,7 @@ Another controller option is to use both a microcontroller and a separate step a
8989
<img src="./images/trinamic_wiring-TMC2209-stepper-controller.svg" width="1200px">
9090

9191

92-
<a id="org76570a9"></a>
92+
<a id="org223fc68"></a>
9393

9494
# Communication
9595

@@ -391,7 +391,7 @@ A library such as the Arduino TMC429 library may be used to control the step and
391391
[Arduino TMC429 Library](https://github.com/janelia-arduino/TMC429)
392392

393393

394-
<a id="orgc9473ce"></a>
394+
<a id="orgb8dcddf"></a>
395395

396396
# Settings
397397

@@ -546,16 +546,10 @@ In voltage control mode, the hold current scales the PWM amplitude, but the curr
546546
In current control mode, setting the hold current is the way to adjust the stationary motor current. The driver will measure the current and automatically adjust the voltage to maintain the hold current, even with the operating conditions change. The PWM offset may be changed to help the automatic tuning procedure, but changing the hold current alone is enough to adjust the motor current since the driver will adjust the offset automatically.
547547

548548

549-
<a id="org66b2186"></a>
549+
<a id="org22c0b13"></a>
550550

551551
# Examples
552552

553-
The example \*.ino files use "Serial1" to be compatible with most boards.
554-
555-
The following wiring examples uses "Serial3" so the same pins can be used to test both HardwareSerial and Software serial on each of the boards.
556-
557-
To test this wiring, change "Serial1" in the example files to "Serial3".
558-
559553

560554
## Wiring
561555

@@ -580,7 +574,7 @@ To test this wiring, change "Serial1" in the example files to "Serial3".
580574
<https://github.com/janelia-kicad/trinamic_wiring>
581575

582576

583-
<a id="org733ac67"></a>
577+
<a id="org51b6a4b"></a>
584578

585579
# Hardware Documentation
586580

@@ -615,42 +609,110 @@ To test this wiring, change "Serial1" in the example files to "Serial3".
615609
[Janelia Stepper Driver Web Page](https://github.com/janelia-kicad/stepper_driver)
616610

617611

618-
<a id="org52dc625"></a>
612+
<a id="org83c69bb"></a>
619613

620614
# Host Computer Setup
621615

622616

623-
## GNU/Linux
617+
## Download this repository
624618

619+
<https://github.com/janelia-arduino/TMC2209.git>
625620

626-
### Drivers
621+
```sh
622+
git clone https://github.com/janelia-arduino/TMC2209.git
623+
```
627624

628-
GNU/Linux computers usually have all of the necessary drivers already installed, but users need the appropriate permissions to open the device and communicate with it.
629625

630-
Udev is the GNU/Linux subsystem that detects when things are plugged into your computer.
626+
## PlatformIO
631627

632-
1. Download rules into the correct directory
633628

634-
1. Teensy
635-
636-
```sh
637-
curl -fsSL https://www.pjrc.com/teensy/00-teensy.rules | sudo tee /etc/udev/rules.d/00-teensy.rules
638-
```
629+
### Install PlatformIO Core
630+
631+
<https://docs.platformio.org/en/latest/core/installation/index.html>
632+
633+
```sh
634+
python3 -m venv .venv
635+
source .venv/bin/activate
636+
pip install platformio
637+
pio --version
638+
```
639+
640+
641+
### 99-platformio-udev.rules
642+
643+
Linux users have to install udev rules for PlatformIO supported boards/devices.
644+
645+
1. Download udev rules file to /etc/udev/rules.d
646+
647+
```sh
648+
curl -fsSL https://raw.githubusercontent.com/platformio/platformio-core/develop/platformio/assets/system/99-platformio-udev.rules | sudo tee /etc/udev/rules.d/99-platformio-udev.rules
649+
```
639650

640651
2. Restart udev management tool
641652

642653
```sh
643654
sudo service udev restart
644655
```
645656

646-
3. Ubuntu/Debian users may need to add own “username” to the “dialout” group
657+
3. Add user to groups
647658

648659
```sh
649660
sudo usermod -a -G dialout $USER && sudo usermod -a -G plugdev $USER
650661
```
651662

652-
4. After setting up rules and groups
663+
4. Remove modemmanager
664+
665+
```sh
666+
sudo apt-get purge --auto-remove modemmanager
667+
```
668+
669+
5. After setting up rules and groups
653670

654671
You will need to log out and log back in again (or reboot) for the user group changes to take effect.
655672

656673
After this file is installed, physically unplug and reconnect your board.
674+
675+
676+
### Compile the firmware
677+
678+
1. Gnu/Linux
679+
680+
```sh
681+
make firmware
682+
```
683+
684+
2. Other
685+
686+
```sh
687+
pio run -e teensy35
688+
```
689+
690+
691+
### Upload the firmware
692+
693+
1. Gnu/Linux
694+
695+
```sh
696+
make upload
697+
```
698+
699+
2. Other
700+
701+
```sh
702+
pio run -e teensy35 -t upload
703+
```
704+
705+
706+
### Serial Terminal Monitor
707+
708+
1. Gnu/Linux
709+
710+
```sh
711+
make monitor
712+
```
713+
714+
2. Other
715+
716+
```sh
717+
pio device monitor --echo --eol=LF
718+
```

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=TMC2209
2-
version=9.0.10
2+
version=9.0.11
33
author=Peter Polidoro <[email protected]>
44
maintainer=Peter Polidoro <[email protected]>
55
sentence=The TMC2209 is an ultra-silent motor driver IC for two phase stepper motors with both UART serial and step and direction interfaces.

0 commit comments

Comments
 (0)