Close

Hardware!

A project log for Scraptop

Laptop made out of scrap - Combined with a FairPhone2 a possible step in the journey toward a fair laptop.

RonaldRonald 07/13/2017 at 18:300 Comments

For Hardware I'll use an ATmega8.

Circuitry is based on https://github.com/baerwolf/USBaspLoader

With this diff:

zeekoe@teunedesktop:~/code/USBaspLoader$ git diff
diff --git a/Makefile b/Makefile
index 21e5b75..3904aff 100644
--- a/Makefile
+++ b/Makefile
@@ -8,7 +8,7 @@
 include Makefile.inc
 
 
-all: do_firmware do_updater
+all: do_firmware
 
 flash: firmware
        $(MAKE) -C firmware flash
diff --git a/Makefile.inc b/Makefile.inc
index 537444f..d2f09d5 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -37,6 +37,7 @@ DANGEROUS=0
 
 # PROGRAMMER contains AVRDUDE options to address your programmer
 # PROGRAMMER = -c pony-stk200
-PROGRAMMER = -c usbasp
+PROGRAMMER = -c usbtiny

 #  since USBaspLoader supports HAVE_BLB11_SOFTW_LOCKBIT...

"Schematics" from the docs:

USBD+ (green) --> PIN4  (PD2)       (usually INT0 PIN)
USBD- (white) --> PIN13 (PD7, AIN1) (new since Rev.3)

BUTTON SWITCH --> PIN12 (PD6, AIN0) (new since Rev.3)

The USB port is connected with zeners to be able to run the uC at 5 V. Not sure if this is really necessary, but it's not spec'd-but-will-probably-work for <4.5 V and I thought I had enough challenges.

The USB part with zeners looks a lot like:

https://dicks.home.xs4all.nl/avr/usbtiny/

Except on diffent pins. Sorry, I'm lazy for now... Perhaps a full schematic will follow, but you'll get the idea.

The ATmega has the option of locking the bootloader. The boot loader is stored at the end of the flash, and when you don't lock it and flash a program of >6K your bootloader is screwed. I didn't manage to lock it using my programmer, so I have to be somewhat careful.

OK, so now I have this:

A circuit where I can press the 'switch' on USB insert to have it behave as a programmer to program itself.

Looking for reference firmware for keyboard, the best thing I could find was something I made a while ago: http://tuxgraphics.org/electronics/200810/avr-usb-slideshow-presenter.shtml

A two-button keyboard. I have one 'button' (the same as used to put it into programming mode), hacked the firmware a bit to use this button, and it worked. A good base to start diving into the keyboard matrix.

Discussions