Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 8 Replies) ATMega328P Downloads Flakey (Read 3073 times)
FylB
Junior Member
**
Offline


Posts: 11
Joined: Jan 27th, 2022
ATMega328P Downloads Flakey
Jan 27th, 2022 at 7:59pm
Print Post  
Hi,
I have a Adafruit CP2104 Friend USB to Serial connected directly to an ATMega328P. Serial streams work and I have DTR connected to the Mega's Reset pin through a .1uF cap in series along with a 10k pullup on the Mega's reset pin.

At first powerup the code downloads and runs fine. The TX and RX LEDs blink nicely. However, if I download again the Mega does not respond. I see the TX LED blinking but no RX LED activity and eventually the Arduino IDE shows the typical avrdude errors.

I have tried several different cables and two different IDEs. Even the Blinky LED sketch fails.

If I unplug the USB cable and power down the circuit, the code will then download and run but further downloads will fail unless I again cycle power.

Whats going on here and how do I fix it please? 

Could it be the Reset pin is not being driven by the right serial pin (in this case DTR)?
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ATMega328P Downloads Flakey
Reply #1 - Jan 27th, 2022 at 10:56pm
Print Post  
Hi

Please follow the guide in the yellow section at the top of this page.

Thanks
  
Back to top
WWW  
IP Logged
 
FylB
Junior Member
**
Offline


Posts: 11
Joined: Jan 27th, 2022
Re: ATMega328P Downloads Flakey
Reply #2 - Jan 27th, 2022 at 11:13pm
Print Post  
Here's the debug output.

I'm suspicious that the MCU reset (connected to DTR) is not working.
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ATMega328P Downloads Flakey
Reply #3 - Jan 27th, 2022 at 11:48pm
Print Post  
Thanks. 

1)
To keep things simpler during testing I suggest you changed the configuration name on the tool bar from Debug to Release.

2)
Please open Device Manager and right click COM4 to see the properties. What is the version number of the "Silicon Labs CP210x" driver?

Thanks

  
Back to top
WWW  
IP Logged
 
FylB
Junior Member
**
Offline


Posts: 11
Joined: Jan 27th, 2022
Re: ATMega328P Downloads Flakey
Reply #4 - Jan 28th, 2022 at 12:06am
Print Post  
Will do.

Here's the COM4 details
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
FylB
Junior Member
**
Offline


Posts: 11
Joined: Jan 27th, 2022
Re: ATMega328P Downloads Flakey
Reply #5 - Jan 28th, 2022 at 12:12am
Print Post  
Here's the debug output with the config changed to release.
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ATMega328P Downloads Flakey
Reply #6 - Jan 28th, 2022 at 12:20am
Print Post  
If I recall there is a problem with the 10x version of that driver. It is listed as for windows 10 universal but the driver does not provide correct operation. You should uninstall the driver and then install the latest 6x version. You will see a lot of articles on google about the v10.

Please see the note in our FAQ about it alongwith a link to what was the latest 6x and probably still is.

Let's see if that fixes things.



  
Back to top
WWW  
IP Logged
 
FylB
Junior Member
**
Offline


Posts: 11
Joined: Jan 27th, 2022
Re: ATMega328P Downloads Flakey
Reply #7 - Jan 28th, 2022 at 12:37am
Print Post  
Tim,
No joy with the 6.7.6 Windows Driver.

What do you think of my supposition that reset is not working correctly?

Phil
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ATMega328P Downloads Flakey
Reply #8 - Jan 28th, 2022 at 12:39am
Print Post  
If you open the serial monitor does clicking the DTR button Off and then On again cause the board to reset?
  
Back to top
WWW  
IP Logged
 
FylB
Junior Member
**
Offline


Posts: 11
Joined: Jan 27th, 2022
Re: ATMega328P Downloads Flakey
Reply #9 - Jan 28th, 2022 at 12:48am
Print Post  
Good idea! I did not think of that.

DTR does NOT toggle with the VM COM port DTR button.
  
Back to top
 
IP Logged
 
FylB
Junior Member
**
Offline


Posts: 11
Joined: Jan 27th, 2022
Re: ATMega328P Downloads Flakey
Reply #10 - Jan 28th, 2022 at 2:04am
Print Post  
When I probe the DTR pin on the USB to Serial module I am not seeing it toggle. I have double checked my wiring and believe it to be correct. How do I get this to work?

I'm sure this type of module is used by many others. If not, then which module do you recommend that works well with VM?
  
Back to top
 
IP Logged
 
FylB
Junior Member
**
Offline


Posts: 11
Joined: Jan 27th, 2022
Re: ATMega328P Downloads Flakey
Reply #11 - Jan 28th, 2022 at 2:08am
Print Post  
Wait a minute. I didn't realize I had to have the COM port connected. Once I did that DTR toggles fine. It looks like DTR is not being controlled programmatically. Is there a setting for this?


« Last Edit: Jan 28th, 2022 at 2:12am by FylB »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ATMega328P Downloads Flakey
Reply #12 - Jan 28th, 2022 at 1:28pm
Print Post  
If you upload using the Arduino IDE does it always work?
  
Back to top
WWW  
IP Logged
 
FylB
Junior Member
**
Offline


Posts: 11
Joined: Jan 27th, 2022
Re: ATMega328P Downloads Flakey
Reply #13 - Jan 28th, 2022 at 3:25pm
Print Post  
No it does not. It’s the same as VM.

What’s the standard circuit to control the Reset pin on an AVR like this?

  
Back to top
 
IP Logged
 
FylB
Junior Member
**
Offline


Posts: 11
Joined: Jan 27th, 2022
Re: ATMega328P Downloads Flakey
Reply #14 - Jan 28th, 2022 at 6:49pm
Print Post  
Ok, I found the problem. It was my reset circuit which consisted of a .1uF cap in series with the CP2104 DTR output to the AVR reset pin. A 10k pullup was also connected to the CP2104 DTR output.

Apparently this is insufficient. So I went over to the arduino.cc site and found the reset circuit for an Uno. I used this to modify my circuit and it now works fine. The revised reset circuit is attached

Thanks for your help.
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ATMega328P Downloads Flakey
Reply #15 - Jan 28th, 2022 at 7:02pm
Print Post  
Thanks for letting us know.
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint