Coder Social home page Coder Social logo

tsessebe / microbridge-arduino-atmega2560 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from haugenmitch/microbridge-arduino-atmega2560

0.0 0.0 0.0 636 KB

Modified BootLoader to load firmware from sd or flash

C++ 1.75% C 83.93% Assembly 2.59% Makefile 11.72%

microbridge-arduino-atmega2560's Introduction

USB and SDCARD Firmware flashing for the ARDUINO ATMEGA 2560 and ADK

โš ๏ธNote: This fork has been modified to work with the Arduino Mega2560 rev3 with an Arduino Ethernet Shield (which includes an SD card reader). Keep in mind, on the Mega, the hardware SS pin, 53, is not used to select either the W5100 or the SD card, but it must be kept as an output or the SPI interface won't work. Also, this fork changes the EEPROM flag address from 0x1FF to 0xFFF, the last EEPROM address on the Mega2560.

master branch is sdcard flash bootloader_from_flash is flash from an spi chip

mechanics :

The bootloader looks for byte in eeprom at address 0xFFF:

-if it is set to 0xF0 bootloader will look for a bin file on the sdcard named 
 firmware.bin and use it to flash the firmware then reset the byte to 0xFF so it
 does this only once

-otherwise no action is taken and bootloader works as a arduino bootloader except
 some of the debugging functions are missing

Setup ADAFruit micro sdcard 5V ready:

SDCARD on ATMEGA 2560 or ADK

pin 50  -  DO

pin 51  -  DI

pin 52  -  CLK

pin 53  -  CS

if you have an sd card shield which is different from this setup you need to change 
the pinout in asmfunc.S and recompile the bootloader !!!

Flashing bootloader :

- copy the entire 'hardware' folder to your mydocuments/arduino folder 

- restart arduino ide

- you should now see under tools -> boards  -> Arduino mega 2560 (Dual sd bootloader) (select this)

- set the appropriate programmer

- burn bootloader

Using arduino ISP bootloader :

- connect arduino atmega 2560

- upload sketch 'Arduino ISP' (found in file -> examples)

Atmega2560 to Atmega 2560 connections:
	programmer	-	receiver
	pin 50			pin 50
	pin 51			pin 51
	pin 52			pin 52
	pin 53			reset
	5v				5v
	ground			ground
aditionally on programmer you have to put a capacitor between reset and ground (2.2microf works)
if you don't do this it won't work !!!

Compile bootloader:

install Crosspack (http://www.obdev.at/products/crosspack/index.html)

Navigate to My Documents/arduino/hardware/microbridge/bootladers/microbridge/

issue :

- make clean

- make all

bootloader output :

Size after:
AVR Memory Usage
----------------
Device: atmega2560

Program:    6116 bytes (2.3% Full)
(.text + .data + .bootloader)

Data:        333 bytes (4.1% Full)
(.data + .bss + .noinit)

Generate BIN file:

To generate a bin file you need issue the following command on you apps elf executable :

avr-objcopy -I elf32-avr -O binary firmware.cpp.elf firmware.bin

this generates firmware.bin which can be put on the sd for flashing your firmware. You can find the elf file in you apps build directory.

Using olimex usb to upload bootloader: avrdude -c stk500v2 -p m2560 -P /dev/tty.usbmodemfd131 -B 500 -e -u -U lock:w:0x3F:m -U efuse:w:0xFD:m -U hfuse:w:0xD8:m -U efuse:w:0xFF:m -F

avrdude -p m2560 -c stk500v2 -P /dev/tty.usbmodemfa131 -F -U flash:w:stk500boot.hex -b 115200 -B1 -U lock:w:0x0F:m

avrdude -p m168 -c usbtiny -e -u -U lock:w:0x3f:m -U efuse:w:0x00:m -U hfuse:w:0xDD:m -U lfuse:w:0xFF:m


avrdude -p m2560 -c stk500v2 -P /dev/tty.usbmodemfd131 -U flash:w:stk500boot_v2_mega2560.hex -U lock:w:0x0F:m -v 
avrdude -c stk500v2 -p m2560 -P /dev/tty.usbmodemfd131 -U lock:w:0x3F:m -U efuse:w:0xFD:m -U hfuse:w:0xD8:m -U lfuse:w:0xFF:m -e -v

microbridge-arduino-atmega2560's People

Contributors

haugenmitch avatar mesger1 avatar j54n1n avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.