Difference between revisions of "USB-opto"

From BitWizard WIKI
Jump to: navigation, search
Line 13: Line 13:
<table border=1>
<table border=1>
<tr><td>1</td><td>Emitter opto 2A</td></tr>
<tr><td>1</td><td>Emitter opto 2A</td></tr>
<tr><td>2</td><td>Collector optO 2A</td></tr>
<tr><td>2</td><td>Collector opto 2A</td></tr>
<tr><td>3</td><td>Emitter opto 1A</td></tr>
<tr><td>3</td><td>Emitter opto 1A</td></tr>
<tr><td>4</td><td>Collector optO 1A</td></tr>
<tr><td>4</td><td>Collector opto 1A</td></tr>
<tr><td>5</td><td>Emitter opto 2B</td></tr>
<tr><td>5</td><td>Emitter opto 2B</td></tr>
<tr><td>6</td><td>Collector optO 2B</td></tr>
<tr><td>6</td><td>Collector opto 2B</td></tr>
<tr><td>7</td><td>Emitter opto 1B</td></tr>
<tr><td>7</td><td>Emitter opto 1B</td></tr>
<tr><td>8</td><td>Collector optO 1B</td></tr>
<tr><td>8</td><td>Collector opto 1B</td></tr>
<tr><td>9</td><td>Emitter opto 2C</td></tr>
<tr><td>9</td><td>Emitter opto 2C</td></tr>
<tr><td>10</td><td>Collector optO 2C</td></tr>
<tr><td>10</td><td>Collector opto 2C</td></tr>
<tr><td>11</td><td>Emitter opto 1C</td></tr>
<tr><td>11</td><td>Emitter opto 1C</td></tr>
<tr><td>12</td><td>Collector optO 1C</td></tr>
<tr><td>12</td><td>Collector opto 1C</td></tr>
<tr><td>13</td><td>Emitter opto 2D</td></tr>
<tr><td>13</td><td>Emitter opto 2D</td></tr>
<tr><td>14</td><td>Collector optO 2D</td></tr>
<tr><td>14</td><td>Collector opto 2D</td></tr>
<tr><td>15</td><td>Emitter opto 1D</td></tr>
<tr><td>15</td><td>Emitter opto 1D</td></tr>
<tr><td>16</td><td>Collector optO 1D</td></tr>
<tr><td>16</td><td>Collector opto 1D</td></tr>

Revision as of 15:58, 23 September 2011


This is the documentation page for the USB-opto PCB.


The USB-opto PCB has an USB connector and two 20-pin connectors. The brains of the PCB is an at90usb162 (or compatible) chip.


The 16 pin connectors is connected as follows

1Emitter opto 2A
2Collector opto 2A
3Emitter opto 1A
4Collector opto 1A
5Emitter opto 2B
6Collector opto 2B
7Emitter opto 1B
8Collector opto 1B
9Emitter opto 2C
10Collector opto 2C
11Emitter opto 1C
12Collector opto 1C
13Emitter opto 2D
14Collector opto 2D
15Emitter opto 1D
16Collector opto 1D
  • led1 is connected to VCC
  • led2 is connected to PD0
  • led3 is connected to PC2

Default operation


This section describes how you get your program into the processor.

In general what you need to know is that the processor will boot into the code you programmed into it on powerup. Once you're done developing your program, that's the way you'll use it: Powerup, run.

If there is no program loaded or if you press the reset button the chip comes up in "firmware upload mode". This is done by a bootloader. You should take care not to overwrite or erase the bootloader, because there is no way to put the bootloader back once it is gone.


Get the dfu-programmer for atmel chips package. (link?)

On sufficiently recent Ubunu distributions that is as simple as:

 sudo apt-get  install dfu-programmer

I recommend creating a script called "dfu":

if [ -z "$CHIP" ]  ; then 

sudo dfu-programmer $chip erase
sudo dfu-programmer $chip flash --suppress-bootloader-mem $hex
sudo dfu-programmer $chip start

TODO: figure out how to get rid of the "sudo" commands here...

Now downloading and starting a program is as simple as pressing the reset button and then:

dfu <yourbinary>.hex

TODO: When I'm developing, I'm likely to modify the code, and when I want to program the chip I hit the "reset" button on the board. Then the computer will see my chip re-enumerate as the Atmel DFU chip. A simple script could watchout for that and invoke dfu <mycurrentbinary>.hex the moment the chip has enumerated. Once that's running downloading and starting the latest code becomes as simple as hitting the reset button.

Apparently the FLIP program is now available for Linux too. See below.


Get the "flip" program from Atmel. http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3886

writing programs

The chip is an at90usb162. http://www.atmel.com/dyn/resources/prod_documents/doc7707.pdf

You can program the processor as if it is a normal AVR processor without USB. Just like an arduino. Or you can program it to have USB support. For this the LUFA package is very useful. http://www.fourwalledcubicle.com/LUFA.php

Depending on what you want you can start from these examples:

DONE: Find out if we can jump to the bootloader from our code so that we can issue a "go get yourself updated" command over the USB (yes, but the documentation says nothing about what address to jump to). This comes in handy if the reset button is difficult to reach because the device is built-in somewhere. http://www.atmel.com/dyn/resources/prod_documents/doc7618.pdf

future hardware enhancements

  • Make an ICSP connector.

future software enhancements

  • program the LUFA bootloader.
  • Program an even smaller bootloader. (512 bytes should be possible, CF teensy/halfkay).