Прошивка микроконтроллера

From RepRap
Revision as of 15:45, 24 March 2010 by Senyor (talk | contribs)
Jump to: navigation, search
Разработка документации RepRap II "Мендель"


Это не законченный перевод статьи. Пожалуйста, сделайте свой вклад в перевод документации.
Motherboard-programming.jpg
RepRap has a Motherboard that is the overall controller of the machine. Each extruder has a subsidiary controller. The motherboard and extruder controllers have to be programmed. This page tells you how to do that.
Please Note this page describes how to install the RepRap standard firmware. There are alternatives to the standard firmware available and these are listed on the Comparison of RepRap Toolchains.

Both the motherboard and the extruder controllers need to have a bootloader installed before you can upload programs to them. This only needs to be done once, and, if you bought ready-made boards, the bootloader will already have been installed in them. But if you made the boards yourself you will have to do that. Bootloader-installing instructions are here.

Before you start

Setting up Arduino Software for Sanguino

Before you can download into your Sanguino motherboard, you need to have the Arduino environment set up to be able to recognize the different Atmel 644p processor.

Download and install Arduino software, then download the core information from Zach's Sanguino site.

In the downloaded core files you will need to copy the folders to their respective locations.

   * copy sanguino-software-1.x/cores/sanguino to arduino/hardware/cores/sanguino
   * copy sanguino-software-1.x/bootloaders/atmega644p to arduino/hardware/bootloaders/atmega644p
   * copy all the folders in sanguino-software-1.x/libraries/ to arduino/hardware/libraries/ overwriting the existing libraries.

Next you need to edit the boards.txt file to add the Sanguino to the available boards. It can be found in arduino/hardware/boards.txt

Restart the Arduino environment and you can now download your firnware to the Sanguino.

The full set of instructions are also available from here.

Programming the Motherboard

Compiling

The C++ program to be loaded into the Motherboard is in the directory mendel/firmware/FiveD_GCode/FiveD_GCode_Interpreter of the download. The latest version is here in the RepRap Subversion repository, but take care with that - it may be an unstable development version.

In your download directory there is a distribution configuration file called configuration.h.dist. Copy that file to a new file called configuration.h. The reason for this copying is that, when you download a new version of RepRap, you may not want to over-write your personal configuration file.

Run the Arduino Development Environment and load up the sketchbook mendel/firmware/FiveD_GCode/FiveD_GCode_Interpreter/FiveD_GCode_Interpreter.pde. Your new configuration.h file should appear as one of the tabs.

Click on that tab and read through the file. It is extensively commented and gives instructions on what to do to configure the firmware for your particular RepRap setup. When you have edited it, select File->Save.

In the Arduino Development Environment select Tools->Board->Sanguino then select Sketch->Verify/Compile.

The program should compile without errors.

Uploading

Plug the USB<->serial cable you made up on this page into the six-pin connector on the left edge of the Motherboard as shown. Make sure you get it the right way round. The RTS connection (which you should have coloured green) goes to the top end of the Motherboard connector labeled "GRN". The ground connection (coloured black) goes at the bottom, labeled "BLK".

Check that you have a jumper fitted on the 2-pin connector by C8 on the Motherboard just to the right of the 6-pin connector you're using. It is this jumper that allows the board to be programmed.

Plug a USB cable into the USB-B socket, but don't connect the other end to your computer yet.

Check the list of connections at Tools->Serial Port and note them. Then plug in the USB cable and check the list again - a new entry should have appeared (on Linux it will be something like /dev/ttyUSB0, and on Windows it will be something like COM5). Select that new entry if it hasn't automatically been selected by the Arduino software - it is the USB interface that you just plugged in.

Incidentally - the Power LED on the Motherboard should now be alight. The Motherboard is USB powered.

Select Upload to I/O Board (the little square box with the right -> arrow). After a few seconds the debug LED on the Motherboard should flicker - this is the program being loaded into the board.

After a few more seconds the Arduino Development Environment should say Done uploading and the debug LED should settle down to a regular pulse at about 2 Hz. That is the RepRap program running on the Motherboard.

If the upload doesn't work, unplug the USB cable, wait a couple of seconds, and plug it back in. Then (with your non-mouse hand) hold down the Motherboard's RESET button. Hover the mouse over the Upload to I/O Board box, release the RESET, then almost immediately click the mouse.

To see how to test the programmed Motherboard, follow this link.

Programming an Extruder Controller

Extruder-programming.jpg

The procedure for this is very similar to that for programming the Motherboard.

Compiling

The C++ program to be loaded into Extruder Controllers is in the directory mendel/firmware/FiveD_GCode/Extruder of the download. The latest version is here in the RepRap Subversion repository, but take care with that - it may be an unstable development version.

In your download directory there is a distribution configuration file called configuration.h.dist. Copy that file to a new file called configuration.h. The reason for this copying is that, when you download a new version of RepRap, you may not want to over-write your personal configuration file.

Run the Arduino Development Environment and load up the sketchbook mendel/firmware/FiveD_GCode/Extruder/Extruder.pde. Your new configuration.h file should appear as one of the tabs.

Click on that tab and read through the file. It is quite short. The comments give instructions on what to do to configure the firmware for your particular extruder setup. When you have edited it, select File->Save.

If you are using a thermistor as an extruder temperature sensor you should also look at the file temperature.h. Select the table that corresponds to your thermistor. If you are using a thermistor for which there is not a standard table that is not a problem. There's a Python program to generate tables for any thermistor. The program is in your RepRap files at mendel/firmware/createTemperatureLookup.py. See this page for details.

In the Arduino Development Environment select Tools->Board->Arduino Diecimila or Duemilanove w/ ATmega 168 then select Sketch->Verify/Compile.

The program should compile without errors.

Uploading

Plug the USB<->serial cable you made up on this page into the six-pin connector on the left edge of the Extruder Controller as shown. Make sure you get it the right way round. The RTS connection (which you should have coloured green) goes to the bottom end of the Extruder Controller connector labeled "GRN/RTS". The ground connection (coloured black) goes at the top, labeled "BLK/GND".

Plug a USB cable into the USB-B socket, but don't connect the other end to your computer yet.

Check the list of connections at Tools->Serial Port and note them. Then plug in the USB cable and check the list again - a new entry should have appeared (on Linux it will be something like /dev/ttyUSB0, and on Windows it will be something like COM5). Select that new entry if it hasn't automatically been selected by the Arduino software - it is the USB interface that you just plugged in.

Incidentally - the Power LED on the Extruder Controller should now be alight. The Extruder Controller is USB-powered for programming, and self-powered when it is running from its 12 volt supply. You may find that some of the other LEDs light as well - this is fine.

Select Upload to I/O Board (the little square box with the right -> arrow). After a few seconds the debug LED on the Extruder Controller should flicker - this is the program being loaded into the board.

After a few more seconds the Arduino Development Environment should say Done uploading and the debug LED should go out.

If the upload doesn't work, unplug the USB cable, wait a couple of seconds, and plug it back in. Then (with your non-mouse hand) hold down the Extruder Controller's RESET button. Hover the mouse over the Upload to I/O Board box, release the RESET, then almost immediately click the mouse.

To see how to test a programmed extruder controller, follow this link.

See also

See also the Generation 3 Firmware page.