Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] A Critical problem with microcontroller

Status
Not open for further replies.

Mithun_K_Das

Advanced Member level 3
Joined
Apr 24, 2010
Messages
860
Helped
24
Reputation
48
Reaction score
23
Trophy points
1,308
Location
Dhaka, Bangladesh, Bangladesh
Activity points
8,050
I think most of the workers who work with micro-controllers feel this problem:

When you want to design any system using MCUs first you write the program for it. Then you simulate the circuit and program that its working fine. Next you load the .hex file to the MCU and test it on project board. But its not working here, although all the connections are fully ok.


Now you re-download the program to the MCU using universal programmer or using any other types. Still not working. But if you touch the circuit with your fingers, it works!!!!!!!!! remove your fingers, it stops!!!!!!!!!!!!!


This is a frequent problem with micro-controllers.


I feel this problem frequently, my co-workers too. I think you too. What is the right explanation of this problem? How can we get rid of from this problem?
 

alexan_e

Administrator
Joined
Mar 16, 2008
Messages
11,895
Helped
2,021
Reputation
4,158
Reaction score
2,031
Trophy points
1,393
Location
Greece
Activity points
64,377
What kind of mcu do you use , I never had a problem like that with AVRs (tiny2313,26, mega8,32,128,48) with internal RC or external crystal, I have also used NXP LPC2103 ARM with a 12MHz crystal without problem.

Alex
 

nandhu015

Advanced Member level 5
Joined
Feb 11, 2006
Messages
1,965
Helped
300
Reputation
600
Reaction score
224
Trophy points
1,353
Location
India
Activity points
9,837
There is no problem with code or simulation. The problem is with hardware. Possibly improper grounding...

Check for improper soldering/wiring..
 

KerimF

Advanced Member level 4
Joined
May 17, 2011
Messages
1,461
Helped
374
Reputation
756
Reaction score
370
Trophy points
1,363
Location
Syria
Activity points
12,314
Testing on board (not on the final PCB on which all connections are soldered) is sometimes risky, we cannot be sure that all connections are well made the way we like, till the circuit functions properly as expected. So when I have a serious project and I am in a hurry I send for a few PCBs, meanwhile I write the project program (always in assembly since I don't have a compiler). Then when the boards are received, the tests will be made on one of them. Oh, I forgot to say that I don't have a program simulator either :smile:
 

ctownsend

Advanced Member level 2
Joined
Nov 27, 2004
Messages
574
Helped
93
Reputation
188
Reaction score
63
Trophy points
1,308
Location
Canada
Activity points
3,656
you did not say what microcontroller you are using.

I'll be that it is an avr and you have programmed the fuses incorrectly!

OR

maybe the reset circuit is non existent or improper.
 

Mithun_K_Das

Advanced Member level 3
Joined
Apr 24, 2010
Messages
860
Helped
24
Reputation
48
Reaction score
23
Trophy points
1,308
Location
Dhaka, Bangladesh, Bangladesh
Activity points
8,050
To:alexan_e: We mostly use atmega8 and 32. We found this problem for both of them. As I think this problem occurs when writing program to micro-controllers (.hex file) by using hand made programmer, am I right?

Sometimes if I touch the reset pin with finger or any metal it works fine. but if I remove the metal or finger it stops again. Why this happen?

To nandhu015: Can you tell me how to ground properly? I don't think microcontrollers need Earth grounding like power system grounding.

To KerimF: I found sometimes it also don't work in PCB board. all connection were checked, they were ok.

To ckshivaram: Do we need to connect extra capacitor(non polar) with input lines to the MCU? Can this solve the problem?


Can anyone tell me that this problem is due to the programmer circuit? I use hand made programmer for atmega8 and atmega32 separately.
 

ckshivaram

Advanced Member level 5
Joined
Apr 21, 2008
Messages
5,070
Helped
2,149
Reputation
4,304
Reaction score
2,089
Trophy points
1,393
Location
villingen (Germany) / Bangalore
Activity points
30,097
It would be good if you post the circuit....

check the reset circuit and put an disc non polarised value of 104 to the Vcc pin....

Also check the fuse bits of controller........
 

alexan_e

Administrator
Joined
Mar 16, 2008
Messages
11,895
Helped
2,021
Reputation
4,158
Reaction score
2,031
Trophy points
1,393
Location
Greece
Activity points
64,377
I'm using USBasp which I made in my own PCB with AVRdude as uploader.
The reset pin of AVRs has an internal pull up resistor but you can use an external one to be sure.
When the programmer is connected it can control the reset pin with or without pull-up.

This reset behavior doesn't seem right, do you have the problem only when the programmer is connected?
Do you disconnect the programmer while you are testing the operation of the circuit (after programming)?

Alex
 

Mithun_K_Das

Advanced Member level 3
Joined
Apr 24, 2010
Messages
860
Helped
24
Reputation
48
Reaction score
23
Trophy points
1,308
Location
Dhaka, Bangladesh, Bangladesh
Activity points
8,050
This problem is not for any particular circuit only but it is found for any circuit. I think this happen when programming to the microcontroller by handmade programmer. Do I need to connect capacitors with MISO, MOSI, SCK, RESET pin separately?
 

ckshivaram

Advanced Member level 5
Joined
Apr 21, 2008
Messages
5,070
Helped
2,149
Reputation
4,304
Reaction score
2,089
Trophy points
1,393
Location
villingen (Germany) / Bangalore
Activity points
30,097
I dont know about other, but i have designed and tested and used so many boards that i dont remember. but i too fced these problems very rarely... but one in 100 boards would behave like that......

they are very simple problems...........
 

alexan_e

Administrator
Joined
Mar 16, 2008
Messages
11,895
Helped
2,021
Reputation
4,158
Reaction score
2,031
Trophy points
1,393
Location
Greece
Activity points
64,377
This problem is not for any particular circuit only but it is found for any circuit. I think this happen when programming to the microcontroller by handmade programmer. Do I need to connect capacitors with MISO, MOSI, SCK, RESET pin separately?

No there is no need for capacitors in these pins, it would actually create problems to connect a capacitor to them, you only need the decoupling capacitors to the power supply pins.
If you can verify the CRC of the program uploaded to the mcu then it can't be a programmer circuit fault and if I understand correctly you have problems while the circuit is operating not while programming.

Alex
 

Mithun_K_Das

Advanced Member level 3
Joined
Apr 24, 2010
Messages
860
Helped
24
Reputation
48
Reaction score
23
Trophy points
1,308
Location
Dhaka, Bangladesh, Bangladesh
Activity points
8,050
Most of the time when a MCU is not working on project board, if I touch the reset pin of the MCU it works as it was programmed. What is the main reason of this problem. NOTE: reset pin is connected to +5V with 10K resistor and a capacitor of 1uF/25V is used with the microcontroller reset pin to ground.

This problem is not for every time but sometimes. Using everything same it sometimes works without any fault (if I re-download the .hex file to the MCU and connect on the same circuit it may work well !!!). I need to solve this particular problem. What is the main cause of this?
 

KerimF

Advanced Member level 4
Joined
May 17, 2011
Messages
1,461
Helped
374
Reputation
756
Reaction score
370
Trophy points
1,363
Location
Syria
Activity points
12,314
In fact, one of the critical parts in a design is in choosing the best way to reset an MCU for each application.
Of course the simplest way is the RC combination.
In your case the first thing I will try is to increase the value of C say to 10uF.
Also we need to consider that the capacitor can discharge properly after cutting the supply and before turning it on again. Fo this I add a small diode (as 1N4148) in parallel with R (cathode to Vcc). Also I add a dummy resistor between Vcc and ground to help discharging C even faster (because in some circuits Vcc may drop to 0.7V only then it takes a rather long time to drop to ground).
 
Last edited:

Mithun_K_Das

Advanced Member level 3
Joined
Apr 24, 2010
Messages
860
Helped
24
Reputation
48
Reaction score
23
Trophy points
1,308
Location
Dhaka, Bangladesh, Bangladesh
Activity points
8,050
Thank you KerimF. I think it can solve the problem. If you can Pls post a circuit diagram for this. It may help all of us. I'll try with this. if any problem occurs again I'll post.

Thank you all.

Yes!, it works now. Thanks.
 
Last edited:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top