Gen7T

From RepRap
Revision as of 19:34, 11 February 2012 by Bryanandaimee (talk | contribs) (Created page with '{{Languages|Gen7T Board 0.1}} {{Gen7Board}} {{Development |name = Gen7T Electronics Board |status = partially tested |image = |description = Generation 7 Electronics with tosh…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Gen7 Board History   --   Gen7 Board is part of Generation 7 Electronics
Crystal Clear action run.png
Gen7T Electronics Board

Release status: partially tested

[[image:|center|190px]]

Description
Generation 7 Electronics with toshiba drivers
License
Author
Contributors
Based-on
[[]]
Categories
CAD Models
External Link
(none)


How to get it

PCBs

Components

Mouser project nearly completed

Parts Lists

Electronic Components

Miscellaneous

Generation 7 Toshiba Electronics uses a TTL header for serial communications to the host. As many modern PCs lack a serial port, these need an appropriate USB to TTL cable:

USB to TTL Cable DigiKey Mouser Adafruit Industries MAKE Store MakerBot Industries Watterott

An alternative to the USB to TTL cable is the same electronics in form of a small breakout board:

USB to TTL Breakout Board Watterott Sparkfun
Cable for the above Watterott

Another alternative is the E'go USB-TTL adapter, see instructions and limitations below.


Assembly Instructions

Assembly in Pictures

Setup

Possible Power Sources

Generation 7 Toshiba Electronics should probably only be run from an ATX supply as the power-on sequence needs to be carefully enforced to prevent smoke emission. The 5V power supply can come from any of the standard Gen7 options as seen below.

Gen7 v1.3 Power Options.jpeg

Option 1

This is the recommended one. Take your PC power supply and plug in the ATX24, as well as both Disk Power connectors. This will supply the electronics with everything needed.

PC PSUs have two strings with several Disk Power connectors on each string. Each of the strings can supply about 10 Ampéres only, so make sure you plug in only one connector of each string into Gen7's headers.

In this scenario, the ATmega can run and talk to the host with the PSU turned "off" (in Standby mode). So, don't be surprised if you start working with your Mendel and the PSU is still quiet. Each G-code command requiring more juice will turn the PSU on, and some time after the last command off again.

Note: the ATX24 header is backwards compatible to the older ATX20 connector, so if you have a PSU with an ATX20 connector, plug in that. There's only one position where it fits (without pushing very hard) and there is no drawback in using an older supply:

Gen7 ATX20 in ATX24.jpeg


Option 2

This is for people with a non-PC power supply. Make connectors feeding 5 V to the upper Disk Power header, as well as 12 V into both of them. The ATX24 is left empty.

No standby feature here, ATmega, Pololus, motors and heaters are supplied all the time.

Option 3

This allows talking to the ATmega only and may be useful for firmware programming. Leave the ATX24 as well as both Disk Power headers empty. The ATmega will be fed through the serial header. This assumes your serial header actually supplies 5 V actually, some USB-TTL converters need soldering to enable this feature.

As said, this option won't allow to move the motors or to heat the extruder.

Power Source Selection

After choosing an option for the power supply, you have to tell the board where to get 5 V from.

Gen7 v1.3 Power Selection.jpeg

In the lower right corner of the board you see three jumper headers.

  • ATX24: recommended for option 1.
  • Disk Power: recommended for option 2.
  • Serial: required for option 3.

You may jumper one, and only one of them.

NOTE: Actually combinations "ATX24+Serial" and "Disk Power+Serial" are also possible and usefull if you need to drain power from Generation 7 board via serial connector (for example to power max232 based converter board).

Power Supply Checks

With the 5 V selection jumper and all power connectors inserted, you can take a few measurements to make sure your brand new ATmega won't blow up when inserted.

Gen7 v1.3 Power Checks.jpeg
  • Red: power supply inserted according to any option. In case of an Option 1, PSU not yet activated.
  • Blue: as above, with PSU activated or power supply according to Option 2. Not applicable to Option 3.

Note: in the picture, no 5 V selection jumper is inserted, but you need the right one here.

Checks:

  1. No smoke? Great.
  2. The yellow LED in the lower right corner is lighted? Even better.
  3. If you've chosen Option 1, short the two wire bridges like the dashed green line in the picture. This should activate the power supply.
  4. At the same time, the green LED in the lower right corner should go on as well.
  5. If you have a voltage meter, measure the voltages shown in the picture.
  6. Also, check each of the pins of the ATmega socket, none of them should have more than 5.5 volts.
  7. For extra security, check the pins in the lower row of the Pololus. Neither of them should exceed 5.5 volts as well.

With everything within the limits, you can pretty safely assume to not blow up the expensive parts when inserting them.

Insert Semiconductors

Now, with some safety tests done, it's a good time to insert semiconductors.

Gen7 v1.3 Semiconductors.jpeg
  • Disconnect the power supply entirely.
  • Solder the MOSFETs with the flat side towards the center of the board into their place. Use sufficient solder, as high currents are flowing here.
  • Mount the heatsinks. The picture shows the recommended placement.
  • Insert the ATmega into it's socket. Like every integrated circuit with such a housing, there's a groove on one of the ends of the black box. This groove shows towards the MOSFET side of the board, the non-grooved end is close to the ATX24 header. Done right, you can read the text on the housing from the ATX24 header side correctly.

Another, perhaps more sensitive heat handling solution is to put a big heatsink onto the MOSFET for the heated bed while leaving the other one free:

Gen7 v1.3 Single Heatsink.jpeg

Prepare your Arduino IDE

Note:: This is for using the Arduino 0018 ... 0023 IDE. The recently released Arduino 1.0 changed some rules, so this doesn't work "out of the box". Hints on solutions include: [1] and [2]

  • Download and unpack or install the Arduino IDE.
  • Download and unpack the latest Gen7 Arduino IDE Support package.
  • Find the folder Gen7 in this package and move it into the hardware folder inside the Arduino package. There are also install instructions inside the Gen7 Arduino IDE Support package.
  • Fire up your Arduino IDE.
  • Under Menu -> Tools -> Board, select your variant of Gen7 board (there should be four new entries). They differ in processor type and clock speed.
  • Under Menu -> Tools -> Serial Port, select the correct serial/com port.

Note: for Linux/Unix users, if you install using your package manager it may be difficult to find your arduino/hardware folder, and even after you find it you might not be able to copy to it. Just make a "hardware" folder in the "sketchbook" folder of your home directory and put the Gen7 support folder in there. The "sketchbook" folder appears when you run the IDE the first time.

Note 2: recent Linux distributions, e.g. Ubuntu 11.10, come with avr-gcc 4.5.3, which conflicts with the Arduino libraries coming with the Gen7 Arduino IDE Support Package. To fix this, open the file <package installation directory>/Gen7/cores/arduino/wiring.h with a text editor and replace:

#define round(x)     ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))
with
//#define round(x)     ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))

Bootloader

If you bought your ATmega with one of the Gen7 kits, the bootloader should have already been uploaded. Any other bootloader, like the one used for the Sanguino, RAMPS, Sanguinololu or whatever is also fine.

If you bought a factory fresh ATmega, e.g. from a general electronics supplier, see the Bootloader Upload section below.

If you're in doubt, just continue with the setup. A missing bootloader will result in a timeout error when attempting to upload a firmware.

Serial Connection

It's recommended to either use a USB to TTL cable or USB to TTL breakout board. Custom solutions are possible, see #Customisations & Others.

Here's how you connect them, GND is always the pin to the left:

Gen7 Serial Connection With USB2TTL Breakout Board.jpeg Gen7 Serial Connection With USB2TTL Cable.jpeg

Simply plug the connector in, connect USB to your PC and a new serial port should show up in your PC's operating system.

Your First Firmware Upload

After all this assembling, and with this complex firmware thing ahead, whouldn't it be a good idea to upload some test firmware to test wether basic things work? Of course!

You can find such a test firmware in Gen7's Github repository.

  1. Download that file SetupText.pde. If it opens in the browser window, do a "Save as...".
  2. Prepare your Gen7 by inserting power plugs, the serial converter, the USB plug of that converter and so on.
  3. Start your Arduino IDE.
  4. With the IDE, open SetupTest.pde. You'll be asked if you want to create a folder of the same name, click "Yes".
  5. Make sure the right serial port and the right type of board is still selected in the Test menu.
  6. Hit the "Upload" button (the second from the right).

After a second or two, you should see something like

Binary sketch size: 2142 bytes (of a 63488 byte maximum)

in the black text field, and after another second of blinking on the serial connector, it should say "Done uploading." right above that text field.

Gen7 v1.3 SetupTest.png

Now you can safely assume uploading a firmware works. The test firmware has a few more features:

  1. If you open the IDE's serial monitor and listen at 9600 baud, you can read what the ATmega is doing. If you can read clear text, the serial line is working.
  2. Three or four seconds after the upload, the power supply should spring to life, blink the LED of HEATER1 a few times and turn the PSU off again.
  3. The same happens after each hit of the Reset button on the board, independently from the IDE or the serial connection.

Microstepping

Last not least, you probably want to set up microstepping to something other than the default. The default is halfstepping. Smaller microsteps make the motors run smoother, but also raise the computing load for the ATmega. The smallest steps possible are 1/16 microstepping.

Feel free to select different settings for each of the motors, e.g. 1/8 microstepping for threaded rod axes (Z) and 1/16 microstepping for belt driven axes (X, Y).

Selecting microstepping is done with the jumpers in front of each of the Pololus, they refer to MS2 and MS3. Allegro documents also know about MS1, which is hard wired to High in Gen7. Plugging a jumper sets High, while leaving the header free sets Low. Here's a detail picture of a Gen7, with MS2 set to High, MS3 set to Low:

Gen7 Microstepping Jumpers.jpeg

The following table shows what you get with each combination:

MS2 MS3 Microstep Resolution
Open Open Half step
Open Plugged Not allowed!
Plugged Open Eighth step
Plugged Plugged Sixteenth step

Firmware

In principle, you can run any of the RepRap Firmwares on this board. Adjust the I/O pin layout, adjust compile time options for no secondary board/no RS485 and proceed. Just like Gen2, RAMPS or similar electronics.

Teacup Firmware

Teacup's Simple Installation instructions show nicely how to do this. Some tweaks are required for Gen7:

  • Have your Arduino IDE prepared for Gen7, as explained above.
  • Download the Gen7 branch instead of the standard download.
  • Use the config.gen7.h and ThermistorTable.gen7.h you find there.

With config.h left untouched, at least something should move. This is fine for first tests, but not sufficient to have everything right for your machine. Edit your config.h further to match your machine and your setup. Config.h has a lot of comments inside the file, helping on the details. For example, STEPS_PER_MM_X should be set according to your choice of microstepping.

Note that to test the extruder heat sensor, the extruder heater must be turned on!

Reprap software is in constant flux, so try to use recent software both for host software and slicing, or you may run into compatibility problems. For example, the original reprap host software may not report the temperature correctly (if at all). Using Pronterface for host software solved this problem for one user. Using Slic3r rather than Skeinforge solved another problem where the Teacup firmware would be stuck forever 'waiting for target temp'.

Repetier Firmware

Tested on 644 @ 20Mhz. See this post for sample config and pins files. Should be integrated into the default firmware soon.

Here is the github download page, and documentation is on the github wiki

FiveD Firmware

FiveD has been run succssfully on Gen7. As the ATmega pin layout of v1.3 almost matches that of v1.2, firmwares running on v1.2 continue to work on v1.3. Snuggles has kindly contributed his sources:

File:FiveD 20100610 for Gen7 v1.2.zip

To upload the Firmware do the following:

  • Have your Arduino IDE prepared for Gen7, as explained above.
  • Open the FiveD_GCode_Interpreter.pde file inside the FiveD_GCode_Interpreter folder with the IDE.
  • Press the upload button in the IDE's toolbar.
  • If there are no errors, you're done.

This should get you started, but don't forget to adjust STEPS_PER_MM in configuration.h to match your mechanics.

Other Configurations

The following should help to configure other firmwares.

Pinout

Sanguino pin bindings
Function ATMega Name Teacup Original firmware Direction in firmware
X Step PC3 DIO19 19 Digital Output
X Direction PC2 DIO18 18 Digital Output
X Min PB7 DIO7 7 Digital Output
X Max PB6 DIO6 6 Digital Output
Y Step PC7 DIO23 23 Digital Output
Y Direction PC6 DIO22 22 Digital Output
Y Min PB5 DIO5 5 Digital Output
Y Max PB2 DIO2 2 Digital Output
Z Step PA5 DIO26 26 Digital Output
Z Direction PA6 DIO25 25 Digital Output
Z Min PB1 DIO1 1 Digital Output
Z Max PB0 DIO0 0 Digital Output
Extruder Step PA3 DIO28 28 Digital Output
Extruder Direction PA4 DIO27 27 Digital Output
Power Enable PD7 DIO15 15 Open Drain Output, active low
Motors Enable PA7 DIO24 24 Digital Output
Heater 1 PB4 DIO4 4 Digital Output
Heater 2 PB3 DIO3 3 Digital Output
Temp 1 PA1 AIO1 1 Analog Input
Temp 2 PA2 AIO2 2 Analog Input

Changes from v1.2:

  • Fan 1 (PA0 / DIO31 / 31) is gone.

Customisations & Others

This part describes possible modifcations for advanced users only.

Non-12-V-Voltages

While it's very practical to use 12 volts as they come out of the power supply, Gen7 is prepared for other voltages, too. Even better, you can supply different voltages for motors and heaters.

Possible usages:

  • 12 V for the heaters, 24  for the motors. This will still allow to use standard Reprap heating elements for the extruder and heated bed, while the motors can now run faster. Motor supply voltage is only limited by the Pololus and can go up to 35 volts.
  • 12 V for the motors, 5 V for the heaters. This whould wear your power supply more evenly.
  • 12 V for the motors, 3.3 V for something like EDM or inductive heated nozzles. Remember, the IRFZ44N can switch pretty fast, and the ATmega has frequency/PWM generators on board.
  • ...

On where to supply what, see the picture above. Simply rewire the disk power connectors to your needs and make sure all power sources contact at least one GND pin, to give them a common ground.

The 5 volts on the upper disk power connector is not needed if you use the ATX20/24 connector, but don't supply there a different voltage, or a voltage from a different power supply, either.

Serial Connection

If you want a custom solution, you can create one, of course. Just connecting an RS-232 port to the serial connector won't work, however, even if you ignored the different voltage levels. ATmega's serial signal is inverted (Logical 0 = 5V, Logical 1 = 0V). Here's the serial connector's pinout:

Gen7 Serial Pinout.png

 

1 2 3 4 5 6
GND CTS (set to GND) +5 Volts RxD TxD Reset

RxD is ATmega's pin 14 (data to the chip); TxD is ATmega's pin 15 (data from the chip).

With pin 3 you can feed the ATmega, if you have no other current source. If you have another current source, e.g. your power supply, you might have slightly different potentials of 5V though, so you better keep this pin unconnected.

Pin 6 is usually connected to the serial line's RTS. This triggers a reset each time you start a connection to the ATmega and is very convenient when uploading firmware - no pressing of the reset button needed, then. Arduinos have this hardwired. If you keep pin 6 free, press the reset button each time your IDE (avrdude) attempts an upload.

Using an E'go USB-TTL adapter

This converter is cheap, uses the Silicon Labs CP2102 chip and basically works:

E'go USB-TTL Converter on Gen7.jpeg

 

Gen7 GND (Pin 1) +5 Volts (Pin 3) RxD (Pin 4) TxD (Pin 5)
USB-TTL adapter GND (Pin 5) +5 Volts (Pin 6) TxD (Pin 3) RxD (Pin 4)

Important here is to not connect both Reset pins.

What you can't get is auto-reset. So you have to press the reset button when uploading a firmware.

Suppliers of this adapter

Bootloader Upload

Note: this section only applies if you have a blank, factory fresh ATmega on your board. Friendly Gen7 vendors will do these steps for you before shipping, so you don't need a programmer.

This section describes how to program the bootloader using a programmer. These programmers usually cost some $20 to $30. Even cheaper is to build a bit banging parallel port adapter. Another alternative is to use an Arduino or second electronics as a programmer.

How to go:

  • Disconnect all connectors, including the power supply.
  • Insert the ATmega644 into it's socket. Make sure you do it the right way, the small nut on the housing goes towards the heater connectors, the numbers on the housing can be read looking from the ATX20 connector side.
  • Re-connect the power supply.

Note: The pins used for the programmer conflict with the pins used for the X_MAX, X_MIN and Y_MIN endstops. This isn't an issue in normal operation, but make really sure you have these endstops disconnected before hooking up the programmer.

  • Connect your programmer. Again, watch out for insertion of the plug the right way.

Now you should see something like this - the red LED indicates the PSU is still without juice:

Gen7 Programmer Setup.jpeg

Programming the bootloader using the command line

  • Have your Arduino IDE prepared for Gen7, as explained above.
  • Connect your power supply, at least one of the power connector indicators should be lighted.
  • Open a terminal and change directory into Arduino IDE's folder. All required tools are there, even if you haven't installed them system-wide.
Linux

The following sequence was done on Linux and should apply similarly on other OSs.

cd hardware/tools
./avrdude -C ./avrdude.conf -c ?  # find your programmer, e.g. "avrispv2"

### For the ATmega644:
# write fuses
./avrdude -C ./avrdude.conf -c <your programmer> -p atmega644 -P /dev/ttyACM0 \
    -B 5 -U lfuse:w:0xF7:m -U hfuse:w:0xDC:m -U efuse:w:0xFC:m
# upload bootloader
./avrdude -C ./avrdude.conf -c <your programmer> -p atmega644 -P /dev/ttyACM0 \
    -B 1 -U flash:w:../Gen7/bootloaders/Gen7/bootloader-<your variant>.hex
# lock the bootloader
# this gives an expected "verification error 0xcf != 0x0f"
./avrdude -C ./avrdude.conf -c <your programmer> -p atmega644 -P /dev/ttyACM0 \
    -B 1 -U lock:w:0xCF:m

### For the ATmega644P:
# like above, but swap "-p atmega644" with "-p atmega644p"

Watch your programmer a few seconds blinking and you're done. Note that if you're using the Arduino as programmer, you may need to add the flag "-b 19200" for it to work correctly.

Windows

On Windows, you'll have to find out which COM port your board is connected to. Or simply try COM1 ... COM8 until it works. Similarly to the above, the commands on Windows are:

cd hardware\tools\avr\bin
avrdude -C ..\..\etc\avrdude.conf -c ?  # find your programmer, e.g. "avrispv2"

### For the ATmega644:
# write fuses
avrdude -C ..\..\etc\avrdude.conf -c <your programmer> -p atmega644 -P COM1 \
   -B 5 -U lfuse:w:0xF7:m -U hfuse:w:0xDC:m -U efuse:w:0xFC:m
# upload bootloader
avrdude -C ..\..\etc\avrdude.conf -c <your programmer> -p atmega644 -P COM1 \
    -B 1 -U flash:w:..\..\..\Gen7\bootloaders\Gen7\bootloader-<your variant>.hex
# lock the bootloader
# this gives an expected "verification error 0xcf != 0x0f"
avrdude -C ..\..\etc\avrdude.conf -c <your programmer> -p atmega644 -P COM1 \
    -B 1 -U lock:w:0xCF:m 

### For the ATmega644P:
# like above, but swap "-p atmega644" with "-p atmega644p"

Watch your programmer a few seconds blinking and you're done.

Programming the bootloader using Arduino IDE and a USBtinyISP

  • Disconnect all connectors, including the power supply.
  • Remove jumper No.3 from the USBtinyISP programmer.
  • Plug in the USB cable to the USBtinyISP.
  • Plug the 6 pin cable from the USBtinyISP into your Gen 7 Electronics. Again, watch out for insertion of the plug the right way.
  • Re-connect the power supply and turn on.
  • Start up Arduino IDE.
  • Select the correct ATmega chip you are using in the Tools->Board menu.
  • Do not select a COM/Serial port.
  • Select Tools->Burn Bootloader->w/USBtinyISP

The USBtinyISP red LED should light up. It will take a minute or two to program the chip When it is done, the IDE will tell you it has completed and the red LED will be off.

Debugging hint: Arduino obviously doesn't attempt to use the "-B 5" flag when writing fuses onto a factory fresh chip. This is needed if the programmer was set to a higher speed earlier, as an ATmega running at 1 MHz (factory default) can't keep up with 115200 baud.

Specials

One user had a power supply delivering just 4.5 volts in standby. That's tight, because at 4.3 V the brown-out detector jumps in and resets the board.

To deal with this, you can change the extended fuse from 0xFC to 0xFD. This sets the brown-out detector's trigger level lower, to 2.7 V. While the ATmega will run out of specification for short periods of time, then, this is obviously better than no brown-out detector at all.

References

./avrdude -C ./avrdude.conf -c <your programmer> -p atmega644p -P /dev/ttyACM0 -n -v