Babygnusbuino: Difference between revisions

From SGMK-SSAM-WIKI
Jump to navigation Jump to search
Line 108: Line 108:
**seems the easy logger just has a 2.2k resistor from vcc to D-....
**seems the easy logger just has a 2.2k resistor from vcc to D-....
*can i send info/data to a computer? to use it in pd or similar software?
*can i send info/data to a computer? to use it in pd or similar software?
**UPDATE: MIDI seems to work now on the Babygnusbuino, too. Use svn update to get the newest version<striketrough>I'll try to adapt the Midignusbuino core for the Attiny85 as soon as I can</striketrough>. The first idea was to emulate a standard serial-class-device (CDC-Class) but apparently that could prove to be more difficult: "The back door to the low-speed bulk transfer is gradually closing on the newer OS. After enjoying this USB technology, switch to the HID protocol or to MCU having on-chip USB controller." [http://www.recursion.jp/avrcdc/] (mirdej)
**UPDATE: MIDI seems to work now on the Babygnusbuino, too. Use svn update to get the newest version<del>I'll try to adapt the Midignusbuino core for the Attiny85 as soon as I can</del>. The first idea was to emulate a standard serial-class-device (CDC-Class) but apparently that could prove to be more difficult: "The back door to the low-speed bulk transfer is gradually closing on the newer OS. After enjoying this USB technology, switch to the HID protocol or to MCU having on-chip USB controller." [http://www.recursion.jp/avrcdc/] (mirdej)
** what are they doing http://www.obdev.at/products/vusb/easylogger.html
** what are they doing http://www.obdev.at/products/vusb/easylogger.html
*I choose the Babygnusbuino in the arduino /Tools/Board but which programmer?
*I choose the Babygnusbuino in the arduino /Tools/Board but which programmer?

Revision as of 20:22, 19 December 2012

A ridiculously small Arduino with USB interface for bootloading and/or MIDI connection, based on the gnusb / Gnusbuino project.

Really bare-bones, no protection, no FTDI chip, single-sided PCB, no holes. The USB connector is directly etched on the board, so you actually plug in the PCB itself to upload a new sketch to the Arduino.

Attention This project is still work in progress - more of a proof of concept. I'm able to upload a blink sketch and it works, but there is some testing to be done. Hardware design could change - not sure if this is the best pin configuration - and the bootloader is a bit sketchy...

Building

Parts List

The only parts needed are:

  • 1 Atmel Attiny85 microprocessor
  • 2 resistors 68 Ohms
  • 2 zeners 3.3V
  • 1 resistor 1k6
  • 1 capacitor 100n

Circuit Schematic


PCB

File the board so that the brackets around the DIY USB connector are just barely visible, this should give the right fit.

Most PCB material is a little too thin, so this connector wiggles a lot inside the USB port - it's best to glue some cardboard or thin aluminum to the back of the board to make it slightly thicker.

Full SMD version

Scaled 400%

File:Babygnusbuino smd.pdf

DIL version

Scaled 400%

File:Babygnusbuino dil.pdf

Programming

Source Code

The source code can be found in the SVN repository of the Gnusbuino [[1]]

Flashing the bootloader

The Bootloader is based on the USBasploader-tiny85 [[2]] - and of course on V-USB [[3]], the virtual USB driver from objective-development.

To get as small as possible, the board does not contain a ISP connector. We'd need it only once to flash the bootloader, anyway. From then on the chip can be reprogrammed directly trough USB. In order to flash the small outline smd chip, I made an adapter plate for the Gnusb-Prog (see: [[4]]) - where the chip is mounted temporarily and held in place with a paper clip:

File:Babygnusb programmer eagle.zip

File:Tiny prog smd.pdf

Avrdude issues

Unfortunately, the current ATTINY85 bootloader does not cope well with the speed at which it gets its data from avrdude, so the Arduino IDE does not work out of the box to program the Babygnusbuino. You'll have to compile a slower version of avrdude and replace the one that comes with Arduino (inside the Arduino Application).

(from my read me file:)

  • download avrdude source code here[[5]] (I was using 5.11)
  • replace the file usbasp.c with the one in variants/attiny85/avrdude patch
  • compile avrdude:
        ./configure
          make
  • replace the file /Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avrdude with the newly compiled one

see also https://github.com/embedded-creations/USBaspLoader-tiny85/issues/1

Still, I sometimes have to try uploading three times until the "broken pipe" errors go away. Still work to do on this bootloader, guys…


Precompiled Binaries

Here is a patched version of avrdude - compiled for MacOS X 10.7. Nut sure if it works with other versions.

File:Avrdude tiny85 hack.zip


Here is a version of avrdude - compiled for Windows 7 x64

File:Avrdude-5.11-win7-x64-Gnusbuino-Hack.zip

A manual on how to compile avrdude for windows from source can be found here: http://tomeko.net/other/avrdude/building_avrdude.php (Note for the manual: in the libusb version 1.2.6.0 you have to rename "lusb0_usb.h" to "usb.h" so the avrdude source compiles fine.)

Uploading a sketch

When you plug in the Babygnusbuino it will first start into the bootloader and present itself as "USBasp" to the host computer. After about five seconds, if there's no activity, it will automatically start the main program. To upload a sketch:

  1. plug in Babygnusbuino
  2. within 2-3 seconds hit the "upload" button in Arduino

Sometimes I have to try several times - the timing is not always easy to get right. Also, bootloader is still a bit shaky, doesn't work every time. Be sure to read the results in the debug window.

Questions

  • what to do with the boards.txt file? (dusjagr)
    • Just leave it in .Documents/Arduino/hardware/Gnusbuino/
  • where to put stuff in linux? (avrdude is here: ./arduino-1.0.1/hardware/tools/)
    • I'd rename ./arduino-1.0.1/hardware/tools/avrdude to avrdude_bak or something, just in case. Then put new hacked avrdude at its place
  • what about the reset pin, aka PB5?
    • still no sure about that one. I wanted to leave it a reset so I can jump into bootloader without unplugging/replugging the thing. But on my board that doesn't seem to work, somehow. Otherwise you can set fuses to have it as a normal pin - but then you cannot reflash the bootloader anymore. As this project is pretty fresh (and the bootloader seems somewhat crappy, that doesn't seem to be very clever, for the moment).
    • Another Pin that could probably be freed up is PB0 - and tying D- through 1k6 directly to VCC. I needed this mechanism on the original gnusb for usb disconnecting and reconnecting but I'm not sure if it is really needed in this case. Will make some more research (don't disable RESET, yet ;-)
    • seems the easy logger just has a 2.2k resistor from vcc to D-....
  • can i send info/data to a computer? to use it in pd or similar software?
    • UPDATE: MIDI seems to work now on the Babygnusbuino, too. Use svn update to get the newest versionI'll try to adapt the Midignusbuino core for the Attiny85 as soon as I can. The first idea was to emulate a standard serial-class-device (CDC-Class) but apparently that could prove to be more difficult: "The back door to the low-speed bulk transfer is gradually closing on the newer OS. After enjoying this USB technology, switch to the HID protocol or to MCU having on-chip USB controller." [6] (mirdej)
    • what are they doing http://www.obdev.at/products/vusb/easylogger.html
  • I choose the Babygnusbuino in the arduino /Tools/Board but which programmer?
    • no need to chose a programmer - the boards.txt file defines USBasp as the programmer
  • can i burn the bootloader from the Arduino IDE, with eg. Arduino-ISP? using an ISP connection?
    • should work (before soldering the chip on board)
  • on what internal clock is the Attiny85? 1MHZ? 8MHZ?
    • 16.5 Mhz internal PLL, calibrated to +/- 1% by listening to USB packets
    • avrdude -P /dev/ttyUSB0 -b 19200 -c avrisp -p t85 -U lfuse:w:0xe1:m -U hfuse:w:0xdd:m -U efuse:w:0xfe:m (something like this?)
      • exactly the fuses I used, too
  • my arduino IDE doesnt see the USBasp

Installing it on ubuntu 12.04/linux (dusjagr)

  • download the gnusbuino folder from here: http://gnusb.svn.sourceforge.net/viewvc/gnusb/branches/gnusbuino/
  • copy the folder ./gnusbuino/hardware/Gnusbuino into your personal arduino folder ~/sketchbook/hardware/* create the hardware folder yourself if needed.
  • make the avrdude as described above
    • had to install: (in addition to many things already there)
      • bison
      • flex
      • libusb-devel
    • and remove:
      • byacc-j
  • copy into folder ./arduino-1.0.1/hardware/tools
  • device showed up with "lsusb" as: Bus 001 Device 007: ID 16c0:05dc VOTI shared ID for use with libusb

other stuff

der frickelt auch mit ner spezial version von arduino.... http://www.kickstarter.com/projects/digistump/digispark-the-tiny-arduino-enabled-usb-dev-board/posts/350928