Hi Team
I have design a PCB to program ATMEGA328P(TQFP) using CH340C USB driver and added ICSP port also. See the schematics diagram attached
I used atmega 328 blank microntroller and I used my AVR programmer to upload Bootloader using Arduino IDE and bootloader successfully uploaded. Now I can upload program written by Arduino IDE using ISCP port
The issue is
It can not upload the program using usb port via ch340c driver using Arduino IDE. The device manager of PC shows that driver is recognized and comport also showing .
during the upload port is successfully connected and it showing uploading
Please note that I used 12Mhz crystal for ATMEGA328p
That will be the problem, the baud rates set by the bootloader are for a 16MHz crystal, 12MHz will be a slower clock speed, but the bootloader assumes 16MHz.
Is there a reason for 12MHz?
How have you checked that the bootloader has successfully uploaded?
Check Arduino pin D13 and see if it is pulsing, this is the default code loaded when the bootloader is added.
Also you have no pull up resistor on the RST line. Connect a 10 K from the RST to 5V.
In addition you have connected up the LEDs wrong, if you want more than one to be on at any one time. You need separate resistors in the anode, not one in the cathode. As you have it once you have the red LED on, (the one with the lowest forward voltage) then no other LEDs will be able to light up because you won't be able to get enough voltage to turn them on.
Is there a reason for 12MHz?
No Dear . Since I shouldn't have 16Mhz
How have you checked that the bootloader has successfully uploaded?
I already uploaded blynk program using AVR programmer and LED is blinking
That will be the problem, the baud rates set by the bootloader are for a 16MHz crystal, 12MHz will be a slower clock speed, but the bootloader assumes 16MHz.
Yes this may be the issue what I have missed ,,,Are you pretty sure?
Also you have no pull up resistor on the RST line. Connect a 10 K from the RST to 5V
Yes I connected it manually for testing but problem is remaining same
In the case of resistor connected to the LED , Yes agreed grate advice
I suggest that you have a look at the official schematics for e.g. Nano and Uno regarding the components for the reset circuit. If you have a scope, check the DTR signal; I'm reasonably sure that it is permanently asserted and hence your 328P is always in reset.
Not one I can agree. But can you explain why on the anode side and not on cathode side. Never had problems with that. Knows the led on what side the resistor is?
I changed the 12Mhz crystal to 16Mhz but problem is remaining same but LED is connected to board is blinking that program uploaded by AVR programmer using ICSP and it is proving the microcontroller is working
But still I can not upload the program using USB port
You understand that once you upload any sketch via the ICSP pins, you overwrite any bootloader that was previously installed? Try reinstalling the bootloader and try again. Yes, the process of uploading the bootloader has a side effect of correcting/updating the fuses.
For a single LED it does not matter what side the resistor is on. But this is a common cathode LED so all the current from all three LEDs goes to the same resistor. So
the LEDs, if they were the same colour, would change in brightness with how many were on.
as I said if they were different colours you could only get the one with the lowest forward voltage on.
Have you ever tried this?
I guess the answer is no because if you had you would have found out it is correct.
We used to get this problem in the forum a lot years ago with titles like
I can't get the Blue LED to turn on when an other colour is on.
I say anode or cathode make no sense. I say both situations below are the same. The LED never knows where the resistor is. He hasn't that intelligence.
Show me the URL that say that a resistor in the kathode line is bad and short the LED life.
After >40 years with electronics I know how to work with leds.
BTW on the schematic are three different leds. Three leds in one case has another symbol and has only one component name. If TS will use only one of them and not together, there isn't a problem.
Clearly you are missing something that eluded you for 40 years.
I have had over 50 years in electronics, I started before LEDs were even a component you could buy.
Don't be silly. The two diagrams you just posted are not in any way shape or form equivalent to the LEDs in the diagram I commented upon. If you can't see that then it is not my fault.
The LEDs I commented about have a single common resistor in the cathode (not kathode - it is not often that a dyslexic like me is moved to correct spelling) that means all the current from all the all the LEDs are going through a single resistor.
You would have the same problem if you put all the LEDs cathodes to the output pins and had a single resistor pulling up to 5V.
So it is nothing to do with the resistors being in the cathode. It is to do with having a single current limiting resistor.
So I suspect you can not read my language very well, which to give you the benefit of the doubt, is probably why you are misunderstanding what I am saying. So here it is in schematic terms.