Description about the hardware part:
I’m sorry i can’t give you the exact circuit diagram because i have made this project before one year and that was a trial and error based project so no exact schematic had been made. After having success on this project, i was so excited that i had no time to draw a complete circuit diagram. But i will give you some clue and results. The main theory is just combine the usbasploader(here) hardware with my pinouts.
As written in the code,
#define USB_CFG_IOPORTNAME D
#define USB_CFG_DMINUS_BIT 1
#define USB_CFG_DPLUS_BIT 2
That means the D+ pin is PD2
And the D- pin is PD1 of the Atmega32 microcontroller.
And the board is made on a double layer veroboard 😀 . Actually it is not a double layer veroboard. It is a bit made of two different slices of veroboard. And i have cut a big hole inside of the top layer to insert the crystal and other parts. I have cut it for my fun only, it’s not essential. If you can put the crystal and other things on the reverse side of the top layer, then it will be perfect. I have mounted the whole microcontroller circuit on the top layer and added the essential parts to able to run it without the bottom layer.
The bottom layer has the USB voltage driver/dropper circuit from vusb with a couple of zener diodes, some resistors, a USB-B mini port and some resistors. I mean the USB-B female port is very much essential here. We know that the 4th pin of the USB-B mini port is unused. And we also know that we need a jumper for usbasploader. So,I have disassembled the USB data cable and shorted the 4th pin with the 5th pin or easily saying that 4th pin to ground and the 4th pin of the female jack of the USB-B mini on the circuit board is connected with PD0 as says the following line of the configuration code.
#define JUMPER_BIT 0
So, whenever you inserted the cable, after pressing the reset button, the microcontroller automatically goes to programming mode. Isn’t the feature beautiful and essential? And after removing the cable, the microcontroller always goes to run mode.