/Modules/AVR/AVRUSB01A/SW/fw_i2c_tiny_usb/Makefile-avrusb.tiny45
File deleted
/Modules/AVR/AVRUSB01A/SW/fw_i2c_tiny_usb/Makefile-avrusb.mega8
File deleted
/Modules/AVR/AVRUSB01A/SW/fw_i2c_tiny_usb/Makefile-usbtiny.mega8
File deleted
/Modules/AVR/AVRUSB01A/SW/fw_i2c_tiny_usb/Makefile-usbtiny.tiny45
File deleted
/Modules/AVR/AVRUSB01A/SW/fw_i2c_tiny_usb/Makefile
0,0 → 1,25
# Supported targets:
# atmega8 atmega88 attiny45 (attiny45 is not usable in a board AVRUSB01A, it has different package)
 
ALL_TARGETS=atmega8 atmega88 attiny45
 
# Execute these steps for each target CPU
# Do not remove empty line in this definition!
define EXEC
echo ************* $(1) ************* avrusb *************
rm -f i2c_tiny_usb_avrusb_$(1).hex
make -f Makefile-avrusb.$(1) clean
make -f Makefile-avrusb.$(1) all
cp firmware.hex i2c_tiny_usb_avrusb_$(1).hex
make -f Makefile-avrusb.$(1) clean
echo ************* $(1) ************* usbtiny *************
rm -f i2c_tiny_usb_usbtiny_$(1).hex
make -f Makefile-usbtiny.$(1) clobber
make -f Makefile-usbtiny.$(1) all
cp main.hex i2c_tiny_usb_usbtiny_$(1).hex
make -f Makefile-usbtiny.$(1) clobber
 
endef
 
ALL:
@$(foreach III,$(ALL_TARGETS),$(call EXEC,$(III)))
/Modules/AVR/AVRUSB01A/SW/fw_i2c_tiny_usb/Makefile-avrusb.atmega8
38,7 → 38,8
$(COMPILE) -S $< -o $@
 
# Fuse high byte:
# 0xc9 = 1 1 0 0 1 0 0 1 <-- BOOTRST (boot reset vector at 0x0000)
# 0xD9 = 1 1 0 1 1 0 0 1 = Factory Default Value
# 0xC9 = 1 1 0 0 1 0 0 1 <-- BOOTRST (boot reset vector at 0x0000)
# ^ ^ ^ ^ ^ ^ ^------ BOOTSZ0
# | | | | | +-------- BOOTSZ1
# | | | | + --------- EESAVE (don't preserve EEPROM over chip erase)
47,7 → 48,8
# | +------------------ WDTON (WDT not always on)
# +-------------------- RSTDISBL (reset pin is enabled)
# Fuse low byte:
# 0x9f = 1 0 0 1 1 1 1 1
# 0xE1 = 1 1 1 0 0 0 0 1 = Factory Default Value
# 0x9F = 1 0 0 1 1 1 1 1
# ^ ^ \ / \--+--/
# | | | +------- CKSEL 3..0 (external >8M crystal)
# | | +--------------- SUT 1..0 (crystal osc, BOD enabled)
/Modules/AVR/AVRUSB01A/SW/fw_i2c_tiny_usb/Makefile-avrusb.atmega88
0,0 → 1,91
# Name: Makefile
# Project: USB I2C
# Author: Christian Starkjohann, modified for I2C USB by Till Harbaum
# Creation Date: 2005-03-20
# Tabsize: 4
# Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH
# License: Proprietary, free under certain conditions. See Documentation.
# This Revision: $Id: Makefile-avrusb.mega8,v 1.1 2006/12/03 21:28:59 harbaum Exp $
 
SERIAL = `echo /dev/tty.[Uu][Ss]*`
UISP = uisp -dprog=stk200
# UISP = uisp -dprog=avr910 -dserial=$(SERIAL) -dpart=auto
# The two lines above are for "uisp" and the AVR910 serial programmer connected
# to a Keyspan USB to serial converter to a Mac running Mac OS X.
# Choose your favorite programmer and interface.
 
DEFINES += -DDEBUG
DEFINES += -DDEBUG_LEVEL=1
COMPILE = avr-gcc -Wall -O2 -Iusbdrv -I. -mmcu=atmega88 $(DEFINES)
 
OBJECTS = usbdrv/usbdrv.o usbdrv/usbdrvasm.o usbdrv/oddebug.o main.o
 
 
# symbolic targets:
all: firmware.hex
 
.c.o:
$(COMPILE) -c $< -o $@
 
.S.o:
$(COMPILE) -x assembler-with-cpp -c $< -o $@
# "-x assembler-with-cpp" should not be necessary since this is the default
# file type for the .S (with capital S) extension. However, upper case
# characters are not always preserved on Windows. To ensure WinAVR
# compatibility define the file type manually.
 
.c.s:
$(COMPILE) -S $< -o $@
 
# Fuse extended byte:
# 0xF9 = 1 1 1 1 1 0 0 1 <<<----Default Value (default value is used)
# 0xF9 = 1 1 1 1 1 0 0 1 <-- BOOTRST (select vetor)
# \+/
# +----- BOOTSZ1..0 (Select Boot Size)
# Fuse high byte:
# 0xDF 1 1 0 1 1 1 1 1 <<<----Default Value (default value may be used)
# 0xDE = 1 1 0 1 1 1 1 0
# ^ ^ ^ ^ ^ \-+-/
# | | | | | +------ BODLEVEL (1.7-2.0V)
# | | | | +---------- EESAVE (don't preserve EEPROM over chip erase)
# | | | +-------------- WDTON (WDT not always on)
# | | +---------------- SPIEN (allow serial programming)!!!
# | +------------------ DWEN (debug wire not enabled)
# +-------------------- RSTDISBL (reset pin is not disabled)
# Fuse low byte:
# 0x62 0 1 1 0 0 0 1 0 <<<----Default Value (must be programmed to use xosc)
# 0xD7 = 1 1 0 1 0 1 1 1
# ^ ^ \ / \--+--/
# | | | +------- CKSEL 3..0 (full swing xosc, BOD enabled)
# | | +--------------- SUT 1..0 (startup timer - see CKSEL)
# | +------------------ CKOUT (clock output is not enabled)
# +-------------------- CLKDIV8 (clock divider is not enabled)
fuse:
$(UISP) --wr_fuse_h=0xDE --wr_fuse_l=0xD7
 
 
clean:
rm -f firmware.hex firmware.lst firmware.obj firmware.cof firmware.list firmware.map firmware.eep.hex firmware.bin *.o usbdrv/*.o firmware.s usbdrv/oddebug.s usbdrv/usbdrv.s
 
# file targets:
firmware.bin: $(OBJECTS)
$(COMPILE) -o firmware.bin $(OBJECTS)
 
firmware.hex: firmware.bin
rm -f firmware.hex firmware.eep.hex
avr-objcopy -j .text -j .data -O ihex firmware.bin firmware.hex
./checksize firmware.bin 8192 960
# do the checksize script as our last action to allow successful compilation
# on Windows with WinAVR where the Unix commands will fail.
 
program: firmware.hex
avrdude -c usbasp -p atmega88 -U lfuse:w:0xD7:m -U hfuse:w:0xDE:m -U flash:w:firmware.hex
 
program-nodep:
avrdude -c usbasp -p atmega88 -U lfuse:w:0xD7:m -U hfuse:w:0xDE:m -U flash:w:firmware.hex
 
disasm: firmware.bin
avr-objdump -d firmware.bin
 
cpp:
$(COMPILE) -E main.c
/Modules/AVR/AVRUSB01A/SW/fw_i2c_tiny_usb/Makefile-avrusb.attiny45
48,7 → 48,8
# +-------------------- CKDIV8 (divide clock by eight disabled)
 
clean:
rm -f firmware.lst firmware.obj firmware.cof firmware.list firmware.map *.bin *.o */*.o *~ */*~ firmware.s usbdrv/oddebug.s usbdrv/usbdrv.s
# rm -f firmware.hex firmware.lst firmware.obj firmware.cof firmware.list firmware.map *.bin *.o */*.o *~ */*~ firmware.s usbdrv/oddebug.s usbdrv/usbdrv.s
rm -f firmware.hex firmware.lst firmware.obj firmware.cof firmware.list firmware.map firmware.eep.hex firmware.bin *.o usbdrv/*.o firmware.s usbdrv/oddebug.s usbdrv/usbdrv.s
 
# file targets:
firmware.bin: $(OBJECTS)
/Modules/AVR/AVRUSB01A/SW/fw_i2c_tiny_usb/Makefile-usbtiny.atmega88
0,0 → 1,17
# ======================================================================
# Makefile for i2c-tiny-usb
#
# Copyright (C) 2006 Till Harbaum
#
# This is free software, licensed under the terms of the GNU General
# Public License as published by the Free Software Foundation.
# ======================================================================
USBTINY = ./usbtiny
TARGET_ARCH = -DF_CPU=12000000 -DUSBTINY -mmcu=atmega88
OBJECTS = main.o
FLASH_CMD = avrdude -c usbasp -p atmega88 -U lfuse:w:0xD7:m -U hfuse:w:0xDE:m -U flash:w:main.hex
STACK = 32
FLASH = 8192
SRAM = 1024
 
include $(USBTINY)/common.mk
/Modules/AVR/AVRUSB01A/SW/fw_i2c_tiny_usb/config.h
0,0 → 1,46
#ifndef __CONFIG_H_
#define __CONFIG_H_
 
// Define USB pin names
// --------------------
 
#if! defined (__AVR_ATtiny45__)
#define CONFIG_USB_PORT D
#define CONFIG_USB_DPLUS 2
#define CONFIG_USB_DMINUS 4
#else
#define CONFIG_USB_PORT B
#define CONFIG_USB_DPLUS 2
#define CONFIG_USB_DMINUS 0
#endif
 
 
// SPI Config
// ----------
 
#define ENABLE_SCL_EXPAND // wait for slow target device (SCL L state hold in L state)
 
// CPU Compatibility
// -----------------
 
// ATmega88 --> ATmega8 (USART0 Registers to USART Registers)
#ifdef UDR0
#define UDR UDR0
#endif
 
#ifdef UDRE0
#define UDRE UDRE0
#endif
 
#ifdef UCSR0A
#define UCSRA UCSR0A
#endif
 
// Macros for Port (enables to easily define IO signals)
// ---------------
#define GLUE(A,B) A##B
#define DDR(PORT_LETTER) GLUE(DDR, PORT_LETTER) // Makes DDRC from DDR(C) etc.
#define PORT(PORT_LETTER) GLUE(PORT,PORT_LETTER) // Makes PORTC from PORT(C)
#define PIN(PORT_LETTER) GLUE(PIN, PORT_LETTER) // Makes PINC from PIN(C)
 
#endif
/Modules/AVR/AVRUSB01A/SW/fw_i2c_tiny_usb/main.c
44,33 → 44,24
 
#include <util/delay.h>
 
#include "config.h"
 
// Include USB library (AVRUSB or USBTINY)
// -------------------
 
#ifndef USBTINY
// use avrusb library
#include "usbdrv.h"
#include "oddebug.h"
// use avrusb library
#include "usbdrv.h"
#include "oddebug.h"
#else
// use usbtiny library
#include "usb.h"
#include "usbtiny.h"
typedef byte_t uchar;
 
#if! defined (__AVR_ATtiny45__)
#define USBDDR DDRC
#define USB_CFG_IOPORT PORTC
#else
#define USBDDR DDRB
#define USB_CFG_IOPORT PORTB
// use usbtiny library
#include "usb.h"
#include "usbtiny.h"
typedef byte_t uchar;
#define usbInit() usb_init()
#define usbPoll() usb_poll()
#endif
 
#define USB_CFG_DMINUS_BIT USBTINY_DMINUS
#define USB_CFG_DPLUS_BIT USBTINY_DPLUS
 
#define usbInit() usb_init()
#define usbPoll() usb_poll()
#endif
 
#define ENABLE_SCL_EXPAND
 
/* commands from USB, must e.g. match command ids in kernel driver */
#define CMD_ECHO 0
#define CMD_GET_FUNC 1
553,16 → 544,16
#endif
 
/* clear usb ports */
USB_CFG_IOPORT &= (uchar)~((1<<USB_CFG_DMINUS_BIT)|(1<<USB_CFG_DPLUS_BIT));
PORT(CONFIG_USB_PORT) &= (uchar)~((1<<CONFIG_USB_DMINUS)|(1<<CONFIG_USB_DPLUS));
 
/* make usb data lines outputs */
USBDDR |= ((1<<USB_CFG_DMINUS_BIT)|(1<<USB_CFG_DPLUS_BIT));
DDR(CONFIG_USB_PORT) |= ((1<<CONFIG_USB_DMINUS)|(1<<CONFIG_USB_DPLUS));
 
/* USB Reset by device only required on Watchdog Reset */
_delay_loop_2(40000); // 10ms
 
/* make usb data lines inputs */
USBDDR &= ~((1<<USB_CFG_DMINUS_BIT)|(1<<USB_CFG_DPLUS_BIT));
DDR(CONFIG_USB_PORT) &= ~((1<<CONFIG_USB_DMINUS)|(1<<CONFIG_USB_DPLUS));
 
usbInit();
 
/Modules/AVR/AVRUSB01A/SW/fw_i2c_tiny_usb/python
0,0 → 1,2
#!/bin/sh
echo Dummy python for WinAVR compilation
/Modules/AVR/AVRUSB01A/SW/fw_i2c_tiny_usb/usbconfig.h
19,26 → 19,22
 
/* ---------------------------- Hardware Config ---------------------------- */
 
#if! defined (__AVR_ATtiny45__)
#define USB_CFG_IOPORTNAME C
#include "config.h"
 
#define USB_CFG_IOPORTNAME CONFIG_USB_PORT
/* This is the port where the USB bus is connected. When you configure it to
* "PORTB", the registers PORTB, PINB (=PORTB+2) and DDRB (=PORTB+1) will be
* used.
*/
#define USB_CFG_DMINUS_BIT 0
#define USB_CFG_DMINUS_BIT CONFIG_USB_DMINUS
/* This is the bit number in USB_CFG_IOPORT where the USB D- line is connected.
* This MUST be bit 0. All other values will result in a compile error!
*/
#define USB_CFG_DPLUS_BIT 1
#define USB_CFG_DPLUS_BIT CONFIG_USB_DPLUS
/* This is the bit number in USB_CFG_IOPORT where the USB D+ line is connected.
* This may be any bit in the port. Please note that D+ must also be connected
* to interrupt pin INT0!
*/
#else
#define USB_CFG_IOPORTNAME B
#define USB_CFG_DMINUS_BIT 0
#define USB_CFG_DPLUS_BIT 2
#endif
 
/* --------------------------- Functional Range ---------------------------- */
 
/Modules/AVR/AVRUSB01A/SW/fw_i2c_tiny_usb/usbtiny.h
10,16 → 10,13
// The D+ and D- USB signals should be connected to two pins of the same
// I/O port. The following macros define the port letter and the input
// bit numbers:
#if! defined (__AVR_ATtiny45__)
#define USBTINY_PORT C
#define USBTINY_DPLUS 1
#define USBTINY_DMINUS 0
#else
#define USBTINY_PORT B
#define USBTINY_DPLUS 2
#define USBTINY_DMINUS 0
#endif
 
#include "config.h"
 
#define USBTINY_PORT CONFIG_USB_PORT
#define USBTINY_DPLUS CONFIG_USB_DPLUS
#define USBTINY_DMINUS CONFIG_USB_DMINUS
 
// The D+ signal should be connected to an interrupt input to trigger an
// interrupt at the start of a packet. When you use the same pin for the
// D+ USB signal and the interrupt input, only two I/O pins are needed