Commit 48d5c0f7 authored by Jake Read's avatar Jake Read

firmware alive, replies to test

parent 67dbd7b2
......@@ -10,6 +10,8 @@ Power is bussed to the board with two M3 Screw Terminals. The board includes roo
## Notes
- label lights
- might have to go to DRV8320 - newer, available
- CSD88548 is CSD88599 but more amps less volts, use these
- use RDT RTD for BLDC - 223-1563-1-ND
......
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE eagle SYSTEM "eagle.dtd">
<eagle version="9.0.0">
<eagle version="9.1.1">
<drawing>
<settings>
<setting alwaysvectorfont="no"/>
......@@ -226,6 +226,9 @@ they cannot often be in them</text>
<wire x1="35.5" y1="12.5" x2="32" y2="16" width="0.1524" layer="20" curve="-90"/>
<dimension x1="32" y1="63.5" x2="100.5" y2="63.5" x3="66.25" y3="67.5" textsize="0.6096" textratio="10" layer="47"/>
<dimension x1="102.5" y1="62" x2="102.5" y2="12.5" x3="107" y3="37.25" textsize="0.6096" textratio="10" layer="47"/>
<dimension x1="35.5" y1="58.5" x2="76" y2="58.5" x3="55.75" y3="71" textsize="0.6096" textratio="10" layer="47"/>
<dimension x1="35.5" y1="58.5" x2="35.5" y2="16" x3="28" y3="37.25" textsize="0.6096" textratio="10" layer="47"/>
<dimension x1="35.5" y1="58.5" x2="32" y2="58.5" x3="33.75" y3="65.5" textsize="0.6096" textratio="10" layer="47"/>
</plain>
<libraries>
<library name="fab">
......@@ -959,6 +962,9 @@ design rules under a new name.</description>
<param name="checkRestrict" value="1"/>
<param name="checkStop" value="0"/>
<param name="checkValues" value="0"/>
<param name="checkNames" value="1"/>
<param name="checkWireStubs" value="1"/>
<param name="checkPolygonWidth" value="0"/>
<param name="useDiameter" value="13"/>
<param name="maxErrors" value="50"/>
</designrules>
......@@ -3123,18 +3129,6 @@ design rules under a new name.</description>
<wire x1="48.65" y1="51.71894375" x2="48.65" y2="51.1" width="0.1524" layer="1"/>
<wire x1="49.02625625" y1="52.0952" x2="48.65" y2="51.71894375" width="0.1524" layer="1"/>
</signal>
<signal name="EN-GATE">
<contactref element="U2" pad="P$16"/>
<contactref element="S3" pad="P$2"/>
<contactref element="S3" pad="P$5"/>
<wire x1="66.000009375" y1="46" x2="64.5232875" y2="46" width="0.1524" layer="1"/>
<wire x1="64.5232875" y1="46" x2="64.1946875" y2="45.6714" width="0.1524" layer="1"/>
<wire x1="61.4053125" y1="45.6714" x2="61.2" y2="45.8767125" width="0.1524" layer="1"/>
<wire x1="64.1946875" y1="45.6714" x2="61.4053125" y2="45.6714" width="0.1524" layer="1"/>
<wire x1="61.2" y1="57.488" x2="61.66" y2="57.948" width="0.1524" layer="1"/>
<wire x1="61.2" y1="45.8767125" x2="61.2" y2="57.488" width="0.1524" layer="1"/>
<wire x1="61.66" y1="57.948" x2="61.66" y2="60.748" width="0.1524" layer="1"/>
</signal>
<signal name="V-W">
<contactref element="R37" pad="2"/>
<contactref element="R36" pad="1"/>
......@@ -3194,27 +3188,6 @@ design rules under a new name.</description>
<wire x1="47.15" y1="51.1" x2="47.15" y2="51.58105625" width="0.1524" layer="1"/>
<wire x1="47.15" y1="51.58105625" x2="47.74514375" y2="52.1762" width="0.1524" layer="1"/>
</signal>
<signal name="EN-GATE-MC">
<contactref element="S3" pad="P$1"/>
<contactref element="S3" pad="P$4"/>
<wire x1="64.16" y1="57.948" x2="64.16" y2="60.748" width="0.1524" layer="1"/>
<via x="64.16" y="57.948" extent="1-16" drill="0.3"/>
<wire x1="64.16" y1="57.948" x2="58.048" y2="57.948" width="0.1524" layer="16"/>
<wire x1="58.048" y1="57.948" x2="56.5048" y2="56.4048" width="0.1524" layer="16"/>
<wire x1="56.5048" y1="56.4048" x2="55.47374375" y2="56.4048" width="0.1524" layer="16"/>
<via x="44.1428" y="52.3" extent="1-16" drill="0.3"/>
<contactref element="U1" pad="27"/>
<wire x1="44.65" y1="51.1" x2="44.65" y2="51.59905" width="0.1524" layer="1"/>
<wire x1="44.65" y1="51.59905" x2="44.369" y2="51.88005" width="0.1524" layer="1"/>
<wire x1="44.369" y1="51.88005" x2="44.369" y2="52.0738" width="0.1524" layer="1"/>
<wire x1="44.369" y1="52.0738" x2="44.1428" y2="52.3" width="0.1524" layer="1"/>
<wire x1="55.47374375" y1="56.4048" x2="53.17374375" y2="54.1048" width="0.1524" layer="16"/>
<wire x1="53.17374375" y1="54.1048" x2="46.47374375" y2="54.1048" width="0.1524" layer="16"/>
<wire x1="44.99994375" y1="52.631" x2="44.68005" y2="52.631" width="0.1524" layer="16"/>
<wire x1="44.34905" y1="52.3" x2="44.1428" y2="52.3" width="0.1524" layer="16"/>
<wire x1="44.68005" y1="52.631" x2="44.34905" y2="52.3" width="0.1524" layer="16"/>
<wire x1="46.47374375" y1="54.1048" x2="44.99994375" y2="52.631" width="0.1524" layer="16"/>
</signal>
<signal name="N$26">
<contactref element="S3" pad="P$3"/>
<contactref element="R3" pad="1"/>
......@@ -3631,7 +3604,49 @@ design rules under a new name.</description>
<wire x1="46.2214" y1="29.7738" x2="46.2214" y2="20.4714" width="0.1524" layer="16"/>
<wire x1="46.96" y1="31.4332875" x2="45.9952" y2="30.4684875" width="0.1524" layer="1"/>
</signal>
<signal name="DRV_EN">
<contactref element="S3" pad="P$1"/>
<contactref element="S3" pad="P$4"/>
<wire x1="56.5048" y1="56.4048" x2="58.048" y2="57.948" width="0.1524" layer="16"/>
<wire x1="56.5048" y1="56.4048" x2="55.47374375" y2="56.4048" width="0.1524" layer="16"/>
<via x="44.1428" y="52.3" extent="1-16" drill="0.3"/>
<contactref element="U1" pad="27"/>
<wire x1="44.65" y1="51.1" x2="44.65" y2="51.59905" width="0.1524" layer="1"/>
<wire x1="44.65" y1="51.59905" x2="44.369" y2="51.88005" width="0.1524" layer="1"/>
<wire x1="44.369" y1="51.88005" x2="44.369" y2="52.0738" width="0.1524" layer="1"/>
<wire x1="44.369" y1="52.0738" x2="44.1428" y2="52.3" width="0.1524" layer="1"/>
<wire x1="55.47374375" y1="56.4048" x2="53.17374375" y2="54.1048" width="0.1524" layer="16"/>
<wire x1="53.17374375" y1="54.1048" x2="46.47374375" y2="54.1048" width="0.1524" layer="16"/>
<wire x1="44.99994375" y1="52.631" x2="44.68005" y2="52.631" width="0.1524" layer="16"/>
<wire x1="44.34905" y1="52.3" x2="44.1428" y2="52.3" width="0.1524" layer="16"/>
<wire x1="44.68005" y1="52.631" x2="44.34905" y2="52.3" width="0.1524" layer="16"/>
<wire x1="46.47374375" y1="54.1048" x2="44.99994375" y2="52.631" width="0.1524" layer="16"/>
<wire x1="64.16" y1="60.748" x2="64.16" y2="57.948" width="0.1524" layer="1"/>
<via x="64" y="58" extent="1-16" drill="0.3"/>
<wire x1="58.048" y1="57.948" x2="63.948" y2="57.948" width="0.1524" layer="16"/>
<wire x1="63.948" y1="57.948" x2="64" y2="58" width="0.1524" layer="16"/>
<wire x1="64" y1="58" x2="64.16" y2="57.948" width="0" layer="19" extent="1-1"/>
</signal>
<signal name="DRV_EN_DRV">
<contactref element="S3" pad="P$2"/>
<contactref element="S3" pad="P$5"/>
<wire x1="61.66" y1="57.948" x2="61.66" y2="60.748" width="0.1524" layer="1"/>
<contactref element="U2" pad="P$16"/>
<wire x1="66.000009375" y1="46" x2="64.5232875" y2="46" width="0.1524" layer="1"/>
<wire x1="64.5232875" y1="46" x2="64.1946875" y2="45.6714" width="0.1524" layer="1"/>
<wire x1="61.4053125" y1="45.6714" x2="61.2" y2="45.8767125" width="0.1524" layer="1"/>
<wire x1="64.1946875" y1="45.6714" x2="61.4053125" y2="45.6714" width="0.1524" layer="1"/>
<wire x1="61.2" y1="45.8767125" x2="61.2" y2="57.488" width="0.1524" layer="1"/>
<wire x1="61.2" y1="57.488" x2="61.66" y2="57.948" width="0" layer="19" extent="1-1"/>
</signal>
</signals>
<mfgpreviewcolors>
<mfgpreviewcolor name="soldermaskcolor" color="0xC8008000"/>
<mfgpreviewcolor name="silkscreencolor" color="0xFFFEFEFE"/>
<mfgpreviewcolor name="backgroundcolor" color="0xFF282828"/>
<mfgpreviewcolor name="coppercolor" color="0xFFFFBF00"/>
<mfgpreviewcolor name="substratecolor" color="0xFF786E46"/>
</mfgpreviewcolors>
</board>
</drawing>
<compatibility>
......
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE eagle SYSTEM "eagle.dtd">
<eagle version="9.0.0">
<eagle version="9.1.1">
<drawing>
<settings>
<setting alwaysvectorfont="no"/>
......@@ -5572,18 +5572,6 @@ high speed (Philips)</description>
<label x="-48.26" y="63.5" size="1.778" layer="95"/>
</segment>
</net>
<net name="EN-GATE" class="0">
<segment>
<pinref part="U2" gate="G$1" pin="EN_GATE"/>
<wire x1="78.74" y1="30.48" x2="60.96" y2="30.48" width="0.1524" layer="91"/>
<label x="60.96" y="30.48" size="1.778" layer="95"/>
</segment>
<segment>
<pinref part="S3" gate="G$1" pin="2"/>
<wire x1="-60.96" y1="134.62" x2="-50.8" y2="134.62" width="0.1524" layer="91"/>
<label x="-58.42" y="134.62" size="1.778" layer="95"/>
</segment>
</net>
<net name="V-W" class="0">
<segment>
<pinref part="R37" gate="G$1" pin="2"/>
......@@ -5629,18 +5617,6 @@ high speed (Philips)</description>
<label x="-48.26" y="55.88" size="1.778" layer="95"/>
</segment>
</net>
<net name="EN-GATE-MC" class="0">
<segment>
<pinref part="S3" gate="G$1" pin="1"/>
<wire x1="-71.12" y1="132.08" x2="-86.36" y2="132.08" width="0.1524" layer="91"/>
<label x="-86.36" y="132.08" size="1.778" layer="95"/>
</segment>
<segment>
<pinref part="U1" gate="G$1" pin="PD1/XCK0"/>
<wire x1="-50.8" y1="45.72" x2="-33.02" y2="45.72" width="0.1524" layer="91"/>
<label x="-48.26" y="45.72" size="1.778" layer="95"/>
</segment>
</net>
<net name="N$26" class="0">
<segment>
<pinref part="S3" gate="G$1" pin="3"/>
......@@ -5980,6 +5956,30 @@ high speed (Philips)</description>
<wire x1="-109.22" y1="121.92" x2="-124.46" y2="121.92" width="0.1524" layer="91"/>
</segment>
</net>
<net name="DRV_EN" class="0">
<segment>
<pinref part="S3" gate="G$1" pin="1"/>
<wire x1="-71.12" y1="132.08" x2="-86.36" y2="132.08" width="0.1524" layer="91"/>
<label x="-86.36" y="132.08" size="1.778" layer="95"/>
</segment>
<segment>
<pinref part="U1" gate="G$1" pin="PD1/XCK0"/>
<wire x1="-50.8" y1="45.72" x2="-33.02" y2="45.72" width="0.1524" layer="91"/>
<label x="-48.26" y="45.72" size="1.778" layer="95"/>
</segment>
</net>
<net name="DRV_EN_DRV" class="0">
<segment>
<pinref part="S3" gate="G$1" pin="2"/>
<wire x1="-60.96" y1="134.62" x2="-50.8" y2="134.62" width="0.1524" layer="91"/>
<label x="-58.42" y="134.62" size="1.778" layer="95"/>
</segment>
<segment>
<pinref part="U2" gate="G$1" pin="EN_GATE"/>
<wire x1="78.74" y1="30.48" x2="60.96" y2="30.48" width="0.1524" layer="91"/>
<label x="60.96" y="30.48" size="1.778" layer="95"/>
</segment>
</net>
</nets>
</sheet>
</sheets>
......
[Eagle]
Version="09 00 00"
Version="09 01 01"
Platform="Windows"
Globals="Globals"
Desktop="Desktop"
......@@ -42,7 +42,7 @@ UsedLibrary="D:/Dropbox (Personal)/CBA/doc/libraries_jake/eagle/sparkfun/SparkFu
Type="Board Editor"
Number=1
File="atkbldcdriver.brd"
View="38.026 5.39031 118.602 72.4968"
View="46.0222 19.7572 101.977 66.359"
WireWidths=" 0.0762 0.127 0.15 0.508 0.6096 0.8128 2.54 1.016 1.27 0.3048 0.254 0.2 0.4064 0.1016 0.2032 0.1524"
PadDiameters=" 0.254 0.3048 0.4064 0.6096 0.8128 1.016 1.27 1.4224 1.6764 1.778 1.9304 2.1844 2.54 3.81 6.4516 0"
PadDrills=" 0.2 0.25 0.35 0.4 0.45 0.5 0.55 0.65 0.7 0.75 0.8 0.85 0.9 1 0.6 0.3"
......@@ -58,7 +58,7 @@ DimensionExtWidths=" 0.127 0.254 0.1 0.13 0.26 0"
DimensionExtLengths=" 1.27 2.54 1 2 3 0"
DimensionExtOffsets=" 1.27 2.54 1 2 3 0"
SmdSizes=" 0.3048 0.1524 0.4064 0.2032 0.6096 0.3048 0.8128 0.4064 1.016 0.508 1.27 0.6604 1.4224 0.7112 1.6764 0.8128 1.778 0.9144 1.9304 0.9652 2.1844 1.0668 2.54 1.27 3.81 1.9304 5.08 2.54 6.4516 3.2512 1.27 0.635"
WireBend=3
WireBend=1
WireBendSet=0
WireCap=1
MiterStyle=0
......@@ -80,13 +80,13 @@ SwapLevel=0
ArcDirection=0
AddLevel=2
PadsSameType=0
Layer=47
Layer=1
[Win_2]
Type="Schematic Editor"
Number=2
File="atkbldcdriver.sch"
View="-500.418 -241.803 754.198 327.64"
View="-199.977 -15.3886 91.806 117.046"
WireWidths=" 0.0762 0.1016 0.127 0.15 0.2 0.2032 0.254 0.3048 0.4064 0.508 0.6096 0.8128 1.016 1.27 2.54 0.1524"
PadDiameters=" 0.254 0.3048 0.4064 0.6096 0.8128 1.016 1.27 1.4224 1.6764 1.778 1.9304 2.1844 2.54 3.81 6.4516 0"
PadDrills=" 0.2 0.25 0.3 0.35 0.4 0.45 0.5 0.55 0.65 0.7 0.75 0.8 0.85 0.9 1 0.6"
......@@ -125,7 +125,7 @@ ArcDirection=0
AddLevel=2
PadsSameType=0
Layer=91
Views=" 1: -500.418 -241.803 754.198 327.64"
Views=" 1: -199.977 -15.3886 91.806 117.046"
Sheet="1"
[Win_3]
......
......@@ -5,3 +5,8 @@ Firmware for the board follows the [automatakit](https://gitlab.cba.mit.edu/jake
Communication is handled asynchronously: bytes received on the UART are loaded into a ringbuffer, where they are later parsed in to packets. Parsing happens as oven as possible.
Firmware for the xmega is under development, but you can see [firmware notes for the atsamd51 board](/embedded/atsamd51.md), and incidentally I've also done this with the [atsams70](/embedded/atsams70.md). Clearly, a few trips around the same yak. To shave. If you know what I mean.
## Fast and Dirty 6-Step Timer-Based Commutation Mode
To get spindles spinning with only a wee amount of c-programming time, I'm going to write a dirty/nasty/simple commutation scheme.

Microsoft Visual Studio Solution File, Format Version 12.00
# Atmel Studio Solution File, Format Version 11.00
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "atkbldcdriver", "atkbldcdriver\atkbldcdriver.cproj", "{DCE6C7E3-EE26-4D79-826B-08594B9AD897}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|AVR = Debug|AVR
Release|AVR = Release|AVR
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Debug|AVR.ActiveCfg = Debug|AVR
{DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Debug|AVR.Build.0 = Debug|AVR
{DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Release|AVR.ActiveCfg = Release|AVR
{DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Release|AVR.Build.0 = Release|AVR
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
SHELL := cmd.exe
RM := rm -rf
USER_OBJS :=
LIBS :=
PROJ :=
O_SRCS :=
C_SRCS :=
S_SRCS :=
S_UPPER_SRCS :=
OBJ_SRCS :=
ASM_SRCS :=
PREPROCESSING_SRCS :=
OBJS :=
OBJS_AS_ARGS :=
C_DEPS :=
C_DEPS_AS_ARGS :=
EXECUTABLES :=
OUTPUT_FILE_PATH :=
OUTPUT_FILE_PATH_AS_ARGS :=
AVR_APP_PATH :=$$$AVR_APP_PATH$$$
QUOTE := "
ADDITIONAL_DEPENDENCIES:=
OUTPUT_FILE_DEP:=
LIB_DEP:=
LINKER_SCRIPT_DEP:=
# Every subdirectory with source files must be described here
SUBDIRS :=
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../atkhandler.c \
../atkport.c \
../fastmath.c \
../main.c \
../pin.c \
../ringbuffer.c \
../spiport.c \
../ams5047.c \
../uartport.c
PREPROCESSING_SRCS +=
ASM_SRCS +=
OBJS += \
atkhandler.o \
atkport.o \
fastmath.o \
main.o \
pin.o \
ringbuffer.o \
spiport.o \
ams5047.o \
uartport.o
OBJS_AS_ARGS += \
atkhandler.o \
atkport.o \
fastmath.o \
main.o \
pin.o \
ringbuffer.o \
spiport.o \
ams5047.o \
uartport.o
C_DEPS += \
atkhandler.d \
atkport.d \
fastmath.d \
main.d \
pin.d \
ringbuffer.d \
spiport.d \
ams5047.d \
uartport.d
C_DEPS_AS_ARGS += \
atkhandler.d \
atkport.d \
fastmath.d \
main.d \
pin.d \
ringbuffer.d \
spiport.d \
ams5047.d \
uartport.d
OUTPUT_FILE_PATH +=atkbldcdriver.elf
OUTPUT_FILE_PATH_AS_ARGS +=atkbldcdriver.elf
ADDITIONAL_DEPENDENCIES:=
OUTPUT_FILE_DEP:= ./makedep.mk
LIB_DEP+=
LINKER_SCRIPT_DEP+=
# AVR32/GNU C Compiler
./%.o: .././%.c
@echo Building file: $<
@echo Invoking: AVR/GNU C Compiler : 5.4.0
$(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -x c -funsigned-char -funsigned-bitfields -DDEBUG -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAA_DFP\1.1.68\include" -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -g2 -Wall -mmcu=atxmega256a3u -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAA_DFP\1.1.68\gcc\dev\atxmega256a3u" -c -std=gnu99 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<"
@echo Finished building: $<
# AVR32/GNU Preprocessing Assembler
# AVR32/GNU Assembler
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C_DEPS)),)
-include $(C_DEPS)
endif
endif
# Add inputs and outputs from these tool invocations to the build variables
# All Target
all: $(OUTPUT_FILE_PATH) $(ADDITIONAL_DEPENDENCIES)
$(OUTPUT_FILE_PATH): $(OBJS) $(USER_OBJS) $(OUTPUT_FILE_DEP) $(LIB_DEP) $(LINKER_SCRIPT_DEP)
@echo Building target: $@
@echo Invoking: AVR/GNU Linker : 5.4.0
$(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -o$(OUTPUT_FILE_PATH_AS_ARGS) $(OBJS_AS_ARGS) $(USER_OBJS) $(LIBS) -Wl,-Map="atkbldcdriver.map" -Wl,--start-group -Wl,-lm -Wl,--end-group -Wl,--gc-sections -mmcu=atxmega256a3u -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAA_DFP\1.1.68\gcc\dev\atxmega256a3u"
@echo Finished building target: $@
"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objcopy.exe" -O ihex -R .eeprom -R .fuse -R .lock -R .signature -R .user_signatures "atkbldcdriver.elf" "atkbldcdriver.hex"
"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objcopy.exe" -j .eeprom --set-section-flags=.eeprom=alloc,load --change-section-lma .eeprom=0 --no-change-warnings -O ihex "atkbldcdriver.elf" "atkbldcdriver.eep" || exit 0
"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objdump.exe" -h -S "atkbldcdriver.elf" > "atkbldcdriver.lss"
"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objcopy.exe" -O srec -R .eeprom -R .fuse -R .lock -R .signature -R .user_signatures "atkbldcdriver.elf" "atkbldcdriver.srec"
"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-size.exe" "atkbldcdriver.elf"
# Other Targets
clean:
-$(RM) $(OBJS_AS_ARGS) $(EXECUTABLES)
-$(RM) $(C_DEPS_AS_ARGS)
rm -rf "atkbldcdriver.elf" "atkbldcdriver.a" "atkbldcdriver.hex" "atkbldcdriver.lss" "atkbldcdriver.eep" "atkbldcdriver.map" "atkbldcdriver.srec" "atkbldcdriver.usersignatures"
\ No newline at end of file
################################################################################
# Automatically-generated file. Do not edit or delete the file
################################################################################
atkhandler.c
atkport.c
fastmath.c
main.c
pin.c
ringbuffer.c
spiport.c
ams5047.c
uartport.c
/*
* ams5047x.c
*
* Created: 2/7/2018 10:17:39 PM
* Author: Jake
*/
#include "ams5047.h"
void ams5047_init(ams5047_t *ams, spiport_t *spi, pin_t *en, pin_t *sg){
ams->spi = spi;
ams->en_pin = en;
ams->sg_pin = sg;
}
void ams5047_write(ams5047_t *ams, uint32_t word){
// ?
uint8_t bytes[3];
bytes[0] = word >> 16;// | 0b11110000; // top 4 & mask for visibility
bytes[1] = word >> 8; // middle 8
bytes[2] = word; // last 4 and 0's
spi_txchars_polled(ams->spi, bytes, 3);
}
void ams5047_start(ams5047_t *ams){
//
}
void ams5047_update(ams5047_t *ams){
uint32_t smarten = 0b10100000000000000000;
ams5047_write(ams, smarten);
}
void ams5047_enable(ams5047_t *ams){
pin_clear(ams->en_pin);
}
void ams5047_disable(ams5047_t *ams){
pin_set(ams->en_pin);
}
\ No newline at end of file
/*
* ams5047.h
*
* Created: 2/7/2018 10:17:49 PM
* Author: Jake
*/
#ifndef AMS5047_H_
#define AMS5047_H_
#include "spiport.h"
#include "pin.h"
// TODO: adding updates (microstep, current)
// in that, calculating current
// TODO: reading stallguard, understanding if is already doing closed loop?
typedef struct{
spiport_t *spi;
pin_t *en_pin;
pin_t *sg_pin;
}ams5047_t;
void ams5047_init(ams5047_t *ams, spiport_t *spi, pin_t *en, pin_t *sg);
void ams5047_write(ams5047_t *ams, uint32_t word);
void ams5047_start(ams5047_t *ams);
void ams5047_update(ams5047_t *ams);
void ams5047_enable(ams5047_t *ams);
void ams5047_disable(ams5047_t *ams);
#endif /* AMS5047_H_ */
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Store xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="AtmelPackComponentManagement">
<ProjectComponents>
<ProjectComponent z:Id="i1" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/">
<CApiVersion></CApiVersion>
<CBundle></CBundle>
<CClass>Device</CClass>
<CGroup>Startup</CGroup>
<CSub></CSub>
<CVariant></CVariant>
<CVendor>Atmel</CVendor>
<CVersion>1.1.0</CVersion>
<DefaultRepoPath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs</DefaultRepoPath>
<DependentComponents xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" />
<Description></Description>
<Files xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d4p1:anyType i:type="FileInfo">
<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAA_DFP\1.1.68\include</AbsolutePath>
<Attribute></Attribute>
<Category>include</Category>
<Condition>C</Condition>
<FileContentHash i:nil="true" />
<FileVersion></FileVersion>
<Name>include</Name>
<SelectString></SelectString>
<SourcePath></SourcePath>
</d4p1:anyType>
<d4p1:anyType i:type="FileInfo">
<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAA_DFP\1.1.68\include\avr\iox256a3u.h</AbsolutePath>
<Attribute></Attribute>
<Category>header</Category>
<Condition>C</Condition>
<FileContentHash>Ogej+KWLQ2y+wOiUkMjAUg==</FileContentHash>
<FileVersion></FileVersion>
<Name>include/avr/iox256a3u.h</Name>
<SelectString></SelectString>
<SourcePath></SourcePath>
</d4p1:anyType>
<d4p1:anyType i:type="FileInfo">
<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAA_DFP\1.1.68\templates\main.c</AbsolutePath>
<Attribute>template</Attribute>
<Category>source</Category>
<Condition>C Exe</Condition>
<FileContentHash>W0NBHkkZq5Rx0zexX2tYMw==</FileContentHash>
<FileVersion></FileVersion>
<Name>templates/main.c</Name>
<SelectString>Main file (.c)</SelectString>
<SourcePath></SourcePath>
</d4p1:anyType>
<d4p1:anyType i:type="FileInfo">
<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAA_DFP\1.1.68\templates\main.cpp</AbsolutePath>
<Attribute>template</Attribute>
<Category>source</Category>
<Condition>C Exe</Condition>
<FileContentHash>YXFphlh0CtZJU+ebktABgQ==</FileContentHash>
<FileVersion></FileVersion>
<Name>templates/main.cpp</Name>
<SelectString>Main file (.cpp)</SelectString>
<SourcePath></SourcePath>
</d4p1:anyType>
<d4p1:anyType i:type="FileInfo">
<AbsolutePath>C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAA_DFP\1.1.68\gcc\dev\atxmega256a3u</AbsolutePath>
<Attribute></Attribute>
<Category>libraryPrefix</Category>
<Condition>GCC</Condition>
<FileContentHash i:nil="true" />
<FileVersion></FileVersion>
<Name>gcc/dev/atxmega256a3u</Name>
<SelectString></SelectString>
<SourcePath></SourcePath>
</d4p1:anyType>
</Files>
<PackName>XMEGAA_DFP</PackName>
<PackPath>C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/XMEGAA_DFP/1.1.68/Atmel.XMEGAA_DFP.pdsc</PackPath>
<PackVersion>1.1.68</PackVersion>
<PresentInProject>true</PresentInProject>
<ReferenceConditionId>ATxmega256A3U</ReferenceConditionId>
<RteComponents xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d4p1:string></d4p1:string>
</RteComponents>
<Status>Resolved</Status>
<VersionMode>Fixed</VersionMode>
<IsComponentInAtProject>true</IsComponentInAtProject>
</ProjectComponent>
</ProjectComponents>
</Store>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
<ProjectVersion>7.0</ProjectVersion>
<ToolchainName>com.Atmel.AVRGCC8.C</ToolchainName>
<ProjectGuid>dce6c7e3-ee26-4d79-826b-08594b9ad897</ProjectGuid>
<avrdevice>ATxmega256A3U</avrdevice>
<avrdeviceseries>none</avrdeviceseries>
<OutputType>Executable</OutputType>
<Language>C</Language>
<OutputFileName>$(MSBuildProjectName)</OutputFileName>
<OutputFileExtension>.elf</OutputFileExtension>
<OutputDirectory>$(MSBuildProjectDirectory)\$(Configuration)</OutputDirectory>
<AssemblyName>atkbldcdriver</AssemblyName>
<Name>atkbldcdriver</Name>
<RootNamespace>atkbldcdriver</RootNamespace>
<ToolchainFlavour>Native</ToolchainFlavour>