More docs

This commit is contained in:
Sebastian 2015-12-07 16:31:04 +01:00
parent 9f87895497
commit 4644496a32
2 changed files with 49 additions and 2 deletions

46
firmware/demo/README.md Normal file
View File

@ -0,0 +1,46 @@
Running the Demo
================
Compiling
---------
To compile this example you will need make, avrgcc avr-binutils and the avrlibc.
If you are reading this I assume you already have an avr toolchain in place.
Also you'll need avrdude to flash your avr.
The makefile takes 3 optional parameters:
* **F_CPU** Clock speed of your controller in Hertz (default: 16000000)
* **AVRMCU** The name of your microcontroller, currently only atmega8 and atmega32p are supported (default: atemga8)
* **ISPPORT** The serial interface for `make flash` (default: /dev/ttyACM0)
To compile and flash the code run (assuming there is a serial bootloader like optiboot present on your controller):
```
make
make flash
```
If you want to run the code on your Arduino try:
```
make AVRMCU=atmega32p
make AVRMCU=atmega32p flash
```
Afterwards connect the encoder and start a terminal emulator of your choice on your serial interface.
If you start sending newlines to the microcontroller, you should see it respond with measurements in plain ASCII.
You can also run cube_demo.py on this interface if you have PyOpengl and PySerial installed.
It might be necessary to change the SERIAL constant on line 16 to the correct interface.
Connecting the encoder
----------------------
Simply onnect the encoder according to the following table:
| AS5043 | AVR | Arduino |
|--------|------------|----------------|
| PROG | GND | GND |
| DO | PB4 (MISO) | digital pin 12 |
| CLK | PB5 (SCK) | digital pin 13 |
| CS | PB2 (SS) | digital pin 10 |
| MODE | GND | GND |
| VDD5V | +5v | +5v |
| VSS | GND | GND |

View File

@ -13,6 +13,7 @@ ERROR: PyOpenGL not installed properly.
import serial
SERIAL = '/dev/ttyUSB0'
angle = 0
pos = 0
@ -53,7 +54,7 @@ def idle():
while len(line) == 0:
ser.write("a")
line = ser.readline()
angle = int(line[:-2])
print "angle: %d" % angle
@ -63,7 +64,7 @@ def idle():
ser = serial.Serial('/dev/ttyUSB0', 9600, timeout=0.032)
ser = serial.Serial(SERIAL, 9600, timeout=0.032)
if not ser:
print "Unable to open serial port"
sys.exit(1)