-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcute_avr32.txt
260 lines (204 loc) · 9.96 KB
/
cute_avr32.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
================================================================================
Connection map for the EVK1101 (for CUTE position control):
NOTE: PA32-PA43 are labelled PB0-PB11 on the EVK1101!
ADCs (as used by current resurfacer task)
----
0 - PA03
1 - PA04
2 - PA30 (light)
3 - PA31 (temperature)
Motors (pulse output/direction/on)
------
m0 - PB00/PB01/PB05
m1 - PB02/PB03/PB06
m2 - PB10/PB11/PB08
PWM (pulse-width modulation output)
---
p6 - PA31
LEDs
----
0 - PA07
1 - PA08
2 - PA21
3 - PA22 (used for wdt)
Push buttons (not used)
------------
0 - PB02
1 - PB03
Joystick (not used)
--------
push - PA13
left - PB06
right - PB09
up - PB07
down - PB08
SD card (not used)
-------
detect - PB00
wr prot. - PB01
AVR32 Channels
--------------
GPIO Function A Function B Function C I/O EVK1101 Usage
---- ------------ ---------- ----------- --- ---------------------------
PA00 Y/Y JTAG1
PA01 Y/Y JTAG2
PA02 Y/Y JTAG3
PA03 ADC0 GCLK0 USB_ID 3/Y input power supply voltage
PA04 ADC1 GCLK1 USB_VBOF 3/Y accelerometer X
PA05 EXTINT0 ADC2 USART1 DCD 3/Y accelerometer Y
PA06 EXTINT1 ADC3 USART1 DSR 3/Y accelerometer Z
PA07 PWM0 ADC4 USART1 DTR 3/Y LED0
PA08 PWM1 ADC5 USART1 RI 3/Y LED1
PA09 TWI SCL SPI0 NPCS2 USART1 CTS Y/Y SPI0 CS2 + TWI SCL
PA10 TWI SDC SPI0 NPCS3 USART1 RTS Y/Y TWI SDA
PA11 USART0 RTS TC A2 PWM0 3/Y Xin32
PA12 USART0 CTS TC B2 PWM1 3/Y Xout32
PA13 EIC NMI PWM2 USART0 CLK Y/Y joystick push button
PA14 SPI0 MOSI PWM3 EXTINT2 Y/Y SPI0 MOSI
PA15 SPI0 SCK PWM4 USART2 CLK Y/Y SPI0 SCK + NEXUS EVTO
PA16 SPI0 NPCS0 TC CLK1 PWM4 Y/Y SPI0 CS0
PA17 SPI0 NPCS1 TC CLK2 SPI0 SCK Y/Y SPI0 CS1
PA18 USART0 RXD PWM5 SPI0 MISO 3/N Xin0 (doesn't work as output)
PA19 USART0 TXD PWM6 SPI0 MOSI 3/N Xout0 (doesn't work as output)
PA20 USART1 CLK TC CLK0 USART2 RXD Y/Y VBUS over current detection
PA21 PWM2 TC A1 USART2 TXD N/Y LED2
PA22 PWM6 TC B1 ADC TRIGGER N/Y LED3 + audio filter 1
PA23 USART1 TXD SPI0 NPCS1 EXTINT3 N/Y U1 Tx
PA24 USART1 RXD SPI0 NPCS0 EXTINT4 N/Y U1 Rx
PA25 SPI0 MISO PWM3 EXTINT5 Y/Y SPI0 MISO
PA26 USB_ID USART2 TXD TC A0 Y/Y USB ID
PA27 USB_VBOF USART2 RXD TC B0 Y/Y VBUS enable?
PA28 USART0 CLK PWM4 SPI0 MISO 3/Y audio filter 2 + Xin1
PA29 TC CLK0 TC CLK1 SPI0 MOSI 3/Y Xout1
PA30 ADC6 EIC SCAN0 PM GCLK2 3/Y light + NEXUS MCKO
PA31 ADC7 EIC SCAN1 PWM6 3/Y temperature + NEXUS MD00
PB00 TC A0 EIC SCAN2 USART2 CTS N/Y SD detect + NEXUS MD01
PB01 TC B0 EIC SCAN3 USART2 RTS Y/Y SD wr prot. + NEXUS MD02
PB02 EXTINT6 TC A1 USART1 TXD N/Y push button 0 + NEXUS MD03
PB03 EXTINT7 TC B1 USART1 RXD Y/Y push button 1 + NEXUS MD04
PB04 USART1 CTS SPI0 NPCS3 TC CLK2 N/N U1 CTS + NEXUS MD05 (doesn't work as output)
PB05 USART1 RTS SPI0 NPCS2 PWM5 Y/Y U1 RTS + NEXUS EVTIn
PB06 SSC RX_CLOCK USART1 DCD EIC SCAN4 Y/Y joystick left + NEXUS MSEO1
PB07 SSC RX_DATA USART1 DSR EIC SCAN5 Y/Y joystick up + NEXUS MSEO0
PB08 SSC RX_SYNC USART1 DTR EIC SCAN6 Y/Y joystick down
PB09 SSC TX_CLOCK USART1 RI EIC SCAN7 Y/Y joystick right
PB10 SSC TX_DATA TC A2 USART0 RXD Y/Y
PB11 SSC TX_SYNC TC B2 USART0 TXD Y/Y
I/O legend: Y = OK, 3 = 3.6 V max, N = doesn't work
AVR32 I/O characteristics
-------------------------
Input voltage limits:
-0.3V to 3.6V: PA03-08,PA11-12,PA18-19,PA28-31
-0.3V to 5.5V: PA00-02,PA09-10,PA13-17,PA20-27,PB00-11
Ouput current limits:
4mA: PA00-PA19,PA24-PA31,PB00-PB11
8mA: PA20-23
265mA total
================================================================================
CUTE AVR32 embedded code
------------------------
To burn AVR32 code from PC
>>>>>>>>>>>>>>>>>>>>>>>>>>
1) Run AVR32 studio on PC
2) Select "Build All" from toolbar
3) Plug in EVK1101 to PC USB port
4) Press EVK1101 RST button while holding down joystick button
5) Open DOS window on PC
6) Change to directory "c:\Documents and Settings\Phil\My Documents\workspace"
7) Type the following command: "burn cute_avr32"
burn.bat
--------
batchisp -hardware usb -device at32uc3b0256 -operation erase f loadbuffer "c:\Documents and Settings\Phil\My Documents\workspace\%1\Debug\%1.elf" program verify start reset 0
To burn AVR32 code from Mac
>>>>>>>>>>>>>>>>>>>>>>>>>>>
Step 1: Generate hex image file
-------------------------------
1) (on Mac) cd ~/source/cute
2) (on Mac) scp cute_avr32.c owl:avr32studio/as4e-ide/workspace/resurfacer_task/src/resurfacer_task.c
3) (on owl) run /home/phil/avr32studio/as4e-ide/avr32studio
4) (on owl) build the executable (elf)
5) (on owl) cd /home/phil/avr32studio/as4e-ide/workspace/resurfacer_task
6) (on owl) ../../plugins/com.atmel.avr.toolchains.linux.x86_64_3.0.0.201009140852/os/linux/x86_64/bin/avr32-objcopy -O ihex Debug/resurfacer_task.elf cute_avr32.hex
7) (on Mac) scp owl:avr32studio/as4e-ide/workspace/resurfacer_task/resurfacer_task.hex cute_avr32.hex
Step 2: Program the AVR32 on the Mac
------------------------------------
1) hold joystick down on AVR32 while pressing reset
2) sudo ~/source/dfu-programmer/src/dfu-programmer at32uc3b0256 erase
3) sudo ~/source/dfu-programmer/src/dfu-programmer at32uc3b0256 flash --suppress-bootloader-mem cute_avr32.hex
4) sudo ~/source/dfu-programmer/src/dfu-programmer at32uc3b0256 reset
Available commands implemented on the AVR32 (ver 1.14)
------------------------------------------------------
pa#[-#] [0|1|-|+] - get/set/reset/pull-up programmable i/o A channel
pb#[-#] [0|1|-|+] - get/set/reset/pull-up programmable i/o B channel
eg) pa0 - gets state of PA00
pa5 0 - drives PA05 output to logic 0
pa12 - - stops driving PA12 (changes from output to input mode)
pb5 + - stops driving PB05 and enables pull-up resistor
pa0-7 - gets state of PA00 through PA07 (low bit first)
pa7-0 - gets state of PA00 through PA07 (high bit first)
pa0-7 - - set PA00-PA07 to input mode
pa0-7 0 - set PA00-PA07 to output all zeros
pa7-0 11000101 - set PA00-PA07 to hex 0xc5 (pa7-0 sets high bit first)
m# ramp SPD - ramp motor # to speed SPD (# is 0-2; SPD is integer steps/sec)
SPD = integer steps/sec
m# spd SPD [CLK] - run motor at speed SPD from specified clock source.
SPD = floating point steps/sec (or 0 to stop)
CLK = 1(32kHz),2(6MHz),3(1.5MHz),4(375kHz),5(93.75kHz)
- minimum speed is CLK/65535
- CLK starts out as 3, and only changes if specified
- CLK must be set back to 3 before using ramp command again
- Note: there is currently no hard limit on the maximum
motor speed, but speeds that are too high (>~15kHz) may
cause the code to hang due to CPU speed limitations
- CLK 1 is currently disabled (because it may use PA11/PA12)
m# stop - stop motor by ramping down slowly
m# halt - halt motor immediately
m# stat - get status of motor
m# pos [POS] - get/set motor position (in number of steps)
m# on [ON] - get/set power to motor windings (ON is 0, 1, + or -)
0 = turn off motor windings
1 = turn on motor windings
+ = motor windings output is high when on
- = motor windings output is low when on (inverted)
m# dir [DIR] - get/set motor direction (DIR is 0, 1, + or -)
0 = positive direction
1 = negative direction
+ = direction signal is high for negative direction
- = direction signal is low for negative direction (inverted)
m# acc [ACC] - get/set motor acceleration (integer steps/sec/sec)
m0 step POS SPD
- step motor 0 to specified POS, ramping to specified SPD
(motor must be on, but direction is set automatically)
adc# - read value of internal AVR 10-bit ADC # (0-3)
adc0 = AVR32 ADC0 (pa03)
adc1 = AVR32 ADC1 (pa04)
adc2 = AVR32 ADC6 (pa30, light sensor)
adc3 = AVR32 ADC7 (pa31, temperature sensor)
halt - halt all motors immediately
wdt [SECS] - get/set watchdog timer (SECS is integer seconds, 0 to disable)
p6 spd [SPD] - run PWM6 at specified speed
SPD = floating point steps/sec (or 0 to stop)
- speed range is 0.2 Hz to 37.5 kHz
- pulse width is 10.6 microseconds
p6 halt - stop PWM immediately ("stop" also works)
p6 stat - get status of PWM
ser - get AVR32 serial number
ver - get software version number
help - show some available commands
nop - no operation
LED's
-----
LED's 0-3 are connected to PA7, PA8, PA21 and PA22
LED3 - Turns on if the AVR32 has performed a watchdog timer reset.
Turned off again by a "wdt #" command.
Watchdog Timer
--------------
The first command received after power up activates the programmed AVR32
watchdog timer with a default wait time of 1 second. This will cause the
AVR32 to reset after 1 second without receiving any commands. To disable
this, the first command sent to the AVR32 should be "wdt 0".
Command/response synchronization
--------------------------------
Commands may be prefixed by a single character ID followed by a "." which
is echoed back in the response message.
================================================================================