From 485a6ded88dc46a0d96629291e9b1104673c88d1 Mon Sep 17 00:00:00 2001 From: LongHairedHacker Date: Tue, 8 Dec 2015 19:03:27 +0100 Subject: [PATCH] Made things more consisten Clearified docs --- firmware/demo/Makefile | 4 ++-- firmware/demo/README.md | 6 ++++-- firmware/demo/cube_demo.py | 2 +- firmware/demo/main.c | 2 +- firmware/testrig/Makefile | 8 ++++---- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/firmware/demo/Makefile b/firmware/demo/Makefile index c9e3a5a..aec955e 100644 --- a/firmware/demo/Makefile +++ b/firmware/demo/Makefile @@ -1,6 +1,6 @@ AVRMCU ?= atmega8 F_CPU ?= 16000000 -ISPPORT ?= /dev/ttyACM0 +ISPPORT ?= /dev/ttyUSB0 VERSION = 0.1 @@ -65,7 +65,7 @@ clean : flash : all avrdude -c arduino \ -p $(AVRMCU) -P $(ISPPORT) \ - -U flash:w:$(OBJDIR)/$(TARGET).hex + -U flash:w:$(OBJDIR)/$(AVRMCU)/$(TARGET).hex test : flash screen $(ISPPORT) 38400 diff --git a/firmware/demo/README.md b/firmware/demo/README.md index b218444..bc057f5 100644 --- a/firmware/demo/README.md +++ b/firmware/demo/README.md @@ -20,12 +20,14 @@ The makefile takes 3 optional parameters: If you want to run the code on your Arduino try: ``` - make AVRMCU=atmega32p - make AVRMCU=atmega32p flash + make AVRMCU=atmega32p ISPPORT=/dev/ttyACM0 + make AVRMCU=atmega32p ISPPORT=/dev/ttyACM0 flash ``` Afterwards connect the encoder and start a terminal emulator of your choice on your serial interface. +Configure it for **38400** Baud, **8** Bit, **N**o Parity and **1** stop bit. If you start sending newlines to the microcontroller, you should see it respond with measurements in plain ASCII. +If your are seeing binary garbage, you either have the wrong baudrate or degree_mode not set to 1. 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. diff --git a/firmware/demo/cube_demo.py b/firmware/demo/cube_demo.py index ce0e5ff..391ccc3 100644 --- a/firmware/demo/cube_demo.py +++ b/firmware/demo/cube_demo.py @@ -64,7 +64,7 @@ def idle(): -ser = serial.Serial(SERIAL, 9600, timeout=0.032) +ser = serial.Serial(SERIAL, 38400, timeout=0.032) if not ser: print "Unable to open serial port" sys.exit(1) diff --git a/firmware/demo/main.c b/firmware/demo/main.c index 51f1e99..b82cbc9 100644 --- a/firmware/demo/main.c +++ b/firmware/demo/main.c @@ -5,7 +5,7 @@ #include "AS5043.h" #include "uart.h" -const uint8_t degree_mode = 0; +const uint8_t degree_mode = 1; int main(void) { diff --git a/firmware/testrig/Makefile b/firmware/testrig/Makefile index 6f0a72b..d9adebb 100644 --- a/firmware/testrig/Makefile +++ b/firmware/testrig/Makefile @@ -1,6 +1,6 @@ AVRMCU ?= atmega8 F_CPU ?= 16000000 -ISPPORT ?= /dev/ttyACM0 +ISPPORT ?= /dev/ttyUSB0 VERSION = 0.1 @@ -63,9 +63,9 @@ clean : @rm -rf $(OBJDIR) flash : all - avrdude -c arduino \ - -p $(AVRMCU) -P $(ISPPORT) \ - -U flash:w:$(OBJDIR)/$(TARGET).hex + avrdude -c arduino \ + -p $(AVRMCU) -P $(ISPPORT) \ + -U flash:w:$(OBJDIR)/$(AVRMCU)/$(TARGET).hex test : flash screen $(ISPPORT) 38400