odroid U3 / shield

Ein Nachbau des ODROID U3 IO Shield mit folgenden Funktionen:

  • AVR ATMega 1284p
    • 20MHz
    • 2x USART, davon einer am U3
    • 3.3V I2C Pegelwandler für U3
    • 5V I2C Pegelwandler für U3
    • RTC PCF8515
    • USART-Bootloader
    • 3 LEDs
    • Pinleisten für USART, I2C, PWM, IOs, 3.3V, 5V
    • 3.3V DC/DC Regler
    • 5V DC/DC Regler für Versorgung des U3

PIN-Header

PA0 (ADC0/PCINT0)
PA1 (ADC1/PCINT1)
PA2 (ADC2/PCINT2)
PA3 (ADC3/PCINT3)
PA4 (ADC4/PCINT4)
PA5 (ADC5/PCINT5)
PA6 (ADC6/PCINT6)
PA7 (ADC7/PCINT7)
GND +5V +3V3 PC5 (TDI/PCINT21)
GND +5V +3V3 PC4 (TDO/PCINT20)
GND +5V +3V3 PC3 (TMS/PCINT19)
GND +5V +3V3 PC2 (TCK/PCINT18)
GND OC0A (PB3/PCINT11/OC0A/AIN1)
GND OC0B (PB4/PCINT12/OC0B/!SS)
GND OC1A (PD5/PCINT29/OC1A)
GND OC1B (PD4/PCINT28/XCK1/OC1B)
GND OC2A (PD7/OC2A/PCINT31)
GND OC2B (PD6/PCINT30/OC2B/ICP)
GND TOSC1 (PC6/TOSC1/PCINT22)
GND TOSC2 (PC7/TOSC2/PCINT23)
I2C
5V SCL SDA GND
3V3 SCL SDA GND
I2C_M1284
5V SCL SDA GND
SIO_M1284
GND RXD TXD 5V

LEDs

LED 1 PB0 (low)
LED 2 PB1 (low)
LED 3 PB2 (low)

USART

RXD0/TXD0 vom Atmega sind mit /dev/ttySAC0 verbunden.

Bootloader

Der Bootloader startet sofort nach !RESET und ist für ca. 3s aktiv. Um den Bootloader zu aktivieren wird eine spezielle Zeichenkette erwartet, andernfalls startet das Programm an Adresse 0.

#!/usr/bin/env python
 
import serial
 
import time
import os.path
import sys
 
import subprocess
 
GPIO_NR=204
GPIO_DIR='/sys/class/gpio/gpio%i/'%GPIO_NR
BOOT_ENTER_STR="DEADBEEF"
BOOT_REQUIRED_STR="BOOT.RUN"
SER_DEVICE="/dev/ttySAC0"
BAUDRATE=57600
 
AVRDUDE_ARGS=[
	"avrdude",
	"-P", SER_DEVICE,
	"-c", "avr109",
	"-p", "m1284p",
	"-b", "%i"%BAUDRATE
]
if not os.path.isdir(GPIO_DIR):
	f=open('/sys/class/gpio/export','w')
	f.write('%i\n'%GPIO_NR)
	f.flush()
	f.close()
 
def doReset():
	reset_gpio=open(GPIO_DIR+'direction','w')
	reset_gpio.write("out\n")
	reset_gpio.flush()
	time.sleep(0.1)
	reset_gpio.write("in\n")
	reset_gpio.flush()
	time.sleep(0.1)
	reset_gpio.close()
 
ser=serial.Serial(SER_DEVICE,baudrate=BAUDRATE)
while True:
	print("Searching for bootloader.")
	doReset()
 
	boot_response=ser.readline().replace('\x00','').strip()
 
	print('greeting:', boot_response)
	ser.write(BOOT_ENTER_STR)
	boot_response=ser.readline().replace('\x00','').strip()
	print('enter-response:',boot_response)
	if boot_response==BOOT_REQUIRED_STR:
		break
 
ser.close()
 
print("calling AVRDUDE")
subprocess.call(AVRDUDE_ARGS+sys.argv[1:])
/usr/local/bin/exynos_load -U flash:w:/root/ledtest.hex
hardware/odroid/u3_shield/odroid_u3_shield.txt · Zuletzt geändert: 2014.06.13 - 09:36 von alexander.krause
 
Copyright 2014, e-design Alexander Krause