NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Support Forum » Bootloader via parallel port for ATmega168
July 24, 2009 by NewGrad128 |
I am having problem uploading the Bootloader file (Foodloader.hex) to the MCU Atmega168 via the parallel port. My hardware setup: MCU in IC Socket, MCU pins 9 & 10 connected to 14.7456MHz crystal, pins 7, 20, 21 connected to +5V, pins 8 and 22 connected to Ground. Parallel port pins 1, 2, 11, 16, 19 are connected to MCU pins 19, 17, 18, 1, 8 respectively. My software setup: Giveio driver installed using LOADDRV, parallel port set to LPT1 in device manager, At Windows XP dos prompt, I executed the make file under Bootloader folder, the fuse bytes all verified and written OK until the last step, it has the following message: avrdude –c dapa –pm168 –U flash : w.foodloader.hex :a avrdude : AVR device not responding avrdude: initialization failed, rc = -1 avrdude: Double check connections and try again, or use –F to override this check. avrdude done. Thank you make : *** [install] Error 1. Thanks in advance! You help will be deeply appreciated. |
---|---|
July 25, 2009 by NewGrad128 |
After many hours of research online and failed attempts, I finally solved my own problem. It was painful and exhausting but I think it is worth the effort. I am taking this opportunity to share with those who have the same problems using avrdude to upload the bootloader to ATmega168 via the parallel port. The following procedure is how I fixed it: Step 1, I built my parallel programming unit as follows: 1. I soldered everything except the MCU. 2. I used a good quality 28 pin IC socket to make the MCU connections. I know a ZIF socket would be a better choice. 3. I soldered MCU pins 7, 20 to output of +5V regulator, pins 8, 22 to GND., 14.7456MHz crystal to pins 9, 10. 4. I shorten my parallel port cable from 3 feet to about 15 inches long, I also inserted the cable through a magnetic donut to reduce more EMI to make sure. 5. I soldered the parallel port interface connector (PPIC), a DB25 pin male as follows: 470 ohm resistor between PPIC pin 1 and MCU pin 19, 470 ohm resistor between PPIC pin 2 and MCU pin 17, 220 ohm resistor between PPIC pin 11 and MCU pin 18, Notes: I soldered the resistors right at the PPIC and used shrink tubing to prevent shorts. Finally, I soldered PPIC pin 16 to MCU pin 1, PPIC pin 18 to MCU pin 8. Step 2, I went to the link http://www.cs.ucr.edu/~eblock/pages/pictools/giveio.html to download the file called LOADDRV to install the giveio.sys, I read the instructions and copied the giveio.sys to the folder C:WINDOWSSYSTEM32DRIVERS Step 3, I went to device manager to make sure the parallel port name is LPT1. I removed the previous printer driver from this old computer to make it LPT1 by default. Step 4, I went to the link http://www.melabs.com/downloads/xp_stop_polling.reg to download the XP_stop_polling.reg file, a registry patch. I mouse double click this file to prevent WIN XP from polling my parallel port to disrupt the bootloader burning process. Finally, I went to dos prompt and typed cdnerdkitscodebootloader then I type make to upload the bootloader. It was a success! I am proud of myself for not giving up and maybe saving someone else hours and hours of frustrations. If you fix your problem because of me, I say 'You welcome!' in advance :) |
July 26, 2009 by NewGrad128 |
Since I installed a toggle switch between the 9V battery and 5V regulator for safely inserting and removing the MCU from the socket, I get the following verification mismatch errors for not waiting more than 5 seconds to execute the upload after turning on 5V to the MCU: Verification error, first mismatch at byte 0X3800 0X0c != 0Xff Verification error; content mismatch Safemode: 1 fuse changed! Was f7, and is now ff Would you like this fuse to be changed back? [y/n] <--- Enter n otherwise it will hang, then you have to press ctrl c to get out. Answer n for the rest of the questions. At this point, if you retry and retry, even try reloading giveio, poll patch, etc., it will fail again and again. If you manually load the footloader.hex by typing the following at dos prompt at the bootloader directory: avrdude –c dapa –pm168 -U flash:w:foodloader.hex:a It will execute that without errors. This is the fix I discovered. You can also go to notepad to write: CD/NERDKITS/CODE/BOOTLOADER and avrdude –c dapa –pm168 -U flash:w:foodloader.hex:a on the next line, then save it as whatever.bat on the desktop or wherever. Just double mouse click this file next time when you forgot to wait more than 5 seconds after power up or for whatever reasons. Finally, if you bought the ATmega168p-20pu chips (pico-power versions), you need to add –F at the avrdudeflags: AVRDUDEFLAGS=-c avrispmkII -p m168 –F to override the signature errors. Well, that's all folks! I can go to bed and sleep well tonight :) |
May 29, 2011 by happyswissman |
Thanks NewGrad128
Manually loading the footloader.hex by typing the following at dos prompt at the bootloader directory: avrdude –c dapa –pm168 -U flash:w:foodloader.hex:a |
May 29, 2011 by Rick_S |
Wow, I will admit, you must have searched the forum to find a nearly 3 year old post. I don't know if in your searches you came across it or not, by I wrote a pretty comprehensive tutorial for installing a bootloader. It can be found in the library Here or in the forums Here. (With the Library being the most current) While the command line you typed in should get the bootloader loaded, did you also set the fuses in your new micro? If not, you risk it being overwritten as by default the bootloader section is not protected. If you did, then you should be good to go. BTW, if you ever do decide on a different ISP programmer, the tutorial will show you what to change in the NK makefile to make uploading the bootloader a bit simpler. Rick |
Please log in to post a reply.
Did you know that there are Power MOSFETs for switching big loads on and off? Learn more...
|