embedded work

11
Embedded Work Outdated work report [ESC] Used TGY source code, ported on Blue series NFET hardware converted code into I2C protocol Could not simulate in proteusdue to some unknown reasons. ARDUINO Arduino code written on Atmega2560 board to send master i2c commands to four ESC devices to write speed parameter, and get two optional parameters from ESC. [hardcode 0x55, 0xaa] There is a way to convert arduinoino files into avrstudio project Imported example of Blink Compiled in arduino See the hidden folder C:\Users\Masood Alam\AppData\Local\Temp There are certain buildxxxxx.tmp folders

Upload: masood-alam

Post on 07-Feb-2016

2 views

Category:

Documents


0 download

DESCRIPTION

AvrStudio for Arduino based projects

TRANSCRIPT

Page 1: Embedded Work

Embedded Work

Outdated work report [ESC]

Used TGY source code,

ported on Blue series NFET hardware converted code into I2C protocol

Could not simulate in proteusdue to some unknown reasons.

ARDUINO

Arduino code written on Atmega2560 board to send master i2c commands to four ESC devices to write speed parameter, and get two optional parameters from ESC. [hardcode 0x55, 0xaa]

There is a way to convert arduinoino files into avrstudio project

Imported example of Blink

Compiled in arduino

See the hidden folder C:\Users\Masood Alam\AppData\Local\Temp

There are certain buildxxxxx.tmp folders

Page 2: Embedded Work

Here is blink.ino generated by arduino ide

Copy the Blink.cpp and core.a [rename as libcore.a into your work folder

Set the properties of Blink, C++ compiler, Directories as under

This will solve include errors in avrstdio when compiling

Now set the linker library properties as under

Core.a is renamed as libcore.a and put in the blink folder.

the project should compile ok

Page 3: Embedded Work

Now set the Tool, New Tool setting

Command is set

C:\arduino-1.0.1\hardware\tools\avr\bin\avrdude.exe

Arguments are set

-CC:\arduino-1.0.1\hardware\tools\avr\etc\avrdude.conf -p m2560 -c wiring -P COM3 -b115200 -D -Uflash:w:"$(ProjectDir)Debug\$(ItemFileName).hex":i

COM3 will be identified when we see My Computer\Properties\Device\Port properties

-c wiring is important for the Arduino board (uses patched version where reset is used )

Page 4: Embedded Work

25th Feb, 2013.

CBlink is avrstudio project based on avrgccC compiler instead of C++

Here are source files

Page 5: Embedded Work

The main.c is copied from original main.cpp present in arduino core files

The wiring.c and wiring_digital.c are present in arduino core files

Note libcore.a is not needed anymore

Page 6: Embedded Work

I2C ESC TESTER IN AVRSTUDIO

Making a master_writer from wire example is somewhat complicated. Any way the results are here

The project source files include Wire.cpp and twi.c

That’s all.

Page 7: Embedded Work

Using USBasp programmer in avrstudio, we have following avrdude command in tool settings

Command: C:\Program Files (x86)\Atmel\AVR Tools\AVR Toolchain\bin\avrdude.exe

Arguments: -c usbasp -p m32 -u -Uflash:w:"$(ProjectDir)default\$(ItemFileName).hex":i

This short cut was used to program e.g. lipo charger circuit.

Page 8: Embedded Work

Arduino based project in avrstudio

Page 9: Embedded Work

Properties in Directories

Page 10: Embedded Work

Using Avrdude in AVrstudio 4.xx

Opon Tools/Options window and create new tool

Command: C:\Program Files (x86)\Atmel\AVR Tools\AVR Toolchain\bin\avrdude.exe

Argument: -c usbasp -p m32 -u -Uflash:w:"imaxb6.hex":i

Now you have tool to run