Hi,
I am working on a small project, for which i have created chip code, which i have tested and it works fine in Keil IDE. But the same when uploaded to chip behaves partly expected or totally unexpected. Some times the chip doesn't reset even done hardware reset.
I have checked it with 3 chips, but no success. My programmer seems fine as it is detecting attached chip and programming chip correctly.
In my project I need serial communication, which is also not working fine. Sometime the MCU skips sending or receiving characters, or doesn't respond to command event after hardware resets.
Could you please suggest me how to resolve this?
Let me know if any further information is required.
Details AT89S52, USB Programmer, C Programming language,
Regards,
Bhagirath
which i have tested and it works fine in Keil IDE. I have checked it with 3 chips, but no success. My programmer seems fine as it is detecting attached chip and programming chip correctly. that a piece of code simulates OK is no guarantee it works. e.g. the simulator will (usually?)not catch timing errors.
anyhow the general impression of your post beg some questions: what do you have on the reset pin? is the crysral and burden caps connected with traces of less than 1cm? are the chip decoupling caps connected with traces of less than 1cm?
Erik
Have you made sure that your hardware is receiving a correct reset pulse? Do you use a three-pin reset controller, or just a RC reset? RC resets do not work reliable.
Without proper reset, everything else can fail too, so it isn't much meaning in speculating on other behaviour.
Hi Erik,
Thanks for reply
The reset pin is connected to 8.2k. I couldn't understand your 2nd and 3rd point.
But let me just try to clarify my board details. It is just simple general purpose board design to work with s52. It has hardware reset push button, crystal with 11.0592 MHz.
Regards Bhagirath
Hi Per Wastermark,
Keeping subsequent reset aside, it is also not working properly on initial power up. e.g. I have dumped simple P1 led blinking code to check programmers working status, it just blinks for 5 - 7 time accurately after that 2 -3 time blinks abruptly and then hangs(doesn't change the blinking status). I have dumped the code in 3 different MCU but no success.
Thanks Bhagirath.
So are your expectations correct?
As the others have noted, If you expect a crude RC reset circuit to work reliably, then you are liable to be disappointed...!
See: www.8052.com/.../119931
As already noted, there are simple, 3-pin devices that will generate a reliable reset pulse.
There are also more advanced devices - sometimes known as "supervisors" - that provide additional functionality. The above link mentions a few...
This is just one area where your "expectations" may be out-of-line with reality - but it is a good one to address first.
You can have failures with the first reset too. It's just a question of ramp-up time for the supply voltages, or if there is any bounce when power is applied - bounces from plugging in mains cable or from the switch that turns on the power.
And starting the processor at a slightly low voltage could get it to start, but then overload the PSU (that is already busy trying to fill up all empty capacitances) resulting in the voltage dropping back enough to make the processor misbehave.
An RC reset really is a dicey concept - you never know when it will work well (no problems perceived) and what it will be a total disaster.
I totally agree, additionally the OP posted The reset pin is connected to 8.2k.
If you expect only a R reset 'circuit' to work at all, then you WILL to be disappointed...!
is the crysral and burden caps connected with traces of less than 1cm? are the chip decoupling caps connected with traces of less than 1cm?
I couldn't understand your 2nd and 3rd point. simple questions, what is it you do not understand?
but they assume familiarity with hardware design terms.
Unfortuately, the OP has not divulged whether he designed this hardware, or understands hardware at all.
To the OP: remember that nobody knows anything about you, your backround, your experience, your project, etc, other than what you clearly & explicitly state in your posts.
Hello Andrew,
Thanks for reply,
My development board prototype is like www.botskool.com/.../ioi85.jpg, the only difference is I have used 33pf with crystal.
You are right about mentioning the reset ic concept, I was unaware of it. Actually my knowledge is limited in electronics, thats why I am having some issues in understanding electronics terms and concepts. I am a software developer, and working on MCU as a part of my hobby. I have created a project to control stepper motors from my laptop via serial communication. My .Net code is ready since long, but I am stuck in MCU because it is creating some issues. I think previously it was working fine. Don't know what went wrong.
Now Could you please suggest me the proper way to attach the reset IC with my existing board, with part list(I found MAX810 comparatively simple for me to embed). It would be better if you could go in some details about it and post some general purpose board diagrams to make it easily.
Once again thanks for you effort.
Regards, Bhagirath
www.botskool.com/.../ioi85.jpg is just your schematic or "circuit diagram" - it does not show how you have physically constructed your real board.
As already noted, the physical construction does matter!
"my knowledge is limited in electronics, thats why I am having some issues in understanding electronics"
And also, most likely, why you're having issues getting the electronics to work!
How much study & research have you done into electronics in general, and the 8051 in particular?
There are plenty of books, websites, and hobby magazines about electronics. There are plenty of books & websites that cover using 8051s; eg, see: http://www.keil.com/books/8051books.asp
See also: www.8052.com/.../175610
Alternatively, have you considered buying a ready-made board?
Even if your aim is evntually to make your own board, it would be good to have a "known-good" board for reference.
"I have created a project to control stepper motors"
Before moving on to a project like that, have you done the basic stuff like blinking an LED, sending "Hello, World" to the serial port, receiving data from the serial port, etc,...?
"from my laptop via serial communication"
Your schematic doesn't show how you intend to connect to the laptop.
"I think previously it was working fine"
As a software developer, you should know to take frequent copies of your work - so that you can always go back to the last working version...
"please suggest me the proper way to attach the reset IC with my existing board"
Have you looked at the link provided earlier? Have you studied the Datasheets for the devices mentioned there? Have you looked for examples, application notes, etc provided by the manufacturers of those devices? Have you googled for examples of using those chips?
Note that none of this has anything specifically to do with Keil.
"As a software developer, you should know to take frequent copies of your work - so that you can always go back to the last working version..."
And there are lots of free source code versioning tools available. There are CVS, Subversion, Git, ...
Hi Andrew,
"As already noted, the physical construction does matter!" I would have posted actual image of my board, but I am out of city for 2 days so, as soon as I am there I will post the image of it.
"How much study & research have you done into electronics in general, and the 8051 in particular?" Although my electronics knowledge is limited but I have basic knowledge to make my things work.
"There are plenty of books,..." I have referred those articles related to 8051 in assembly as well as in c(I prefer c). Mainly I refer "8051 microcontroller and embedded system by Mazidi".
"Alternatively, have you considered buying a ready-made board?" I prefer making it myself, the present one I am using is made by me(copy of one ready made special purpose board), If this doesn't resolve, I will buy one.
"Before moving on to a project like that, have you done the basic stuff like blinking an LED, sending "Hello, World" to the serial port, receiving data from the serial port, etc,...?"
Yes off-course, I have done that, and prior to stepper motor I have successfully control 2 dc geared motors via my laptop.
"Your schematic doesn't show how you intend to connect to the laptop."
I do have USB-Serial cable (pl2303), via which I send signals. I have tested the cable it is working fine.
I have all the versions with me, although the current version for stepper motor is the same, but added a method to control steps.
"Have you looked at the link provided earlier? Have you studied the Datasheets for the devices mentioned there? Have you looked for examples, application notes, etc provided by the manufacturers of those devices? Have you googled for examples of using those chips?
Note that none of this has anything specifically to do with Keil."
Yes, I have gone though the link, from where I found MAX810 befitting my board. For me Datasheets provide too technical information to understand but still I try to get as much as i can. Yes its seems that my code is working fine, but some thing is wrong with board.
Thanks
"I have basic knowledge to make my things work"
But your 'thing' does not work!
It's impossible to give advice appropriate to your level of experience when we don't know what that level is!
"its seems that my code is working fine, but some thing is wrong with board"
I think it's too early to jump to that conclusion!
There certainly seem to be issues with your board - you need to fix them first before moving on to any potential issues in your code...
You mean this: www.prolific.com.tw/.../products.asp ?
But that is just a chip - not a cable!
I mean kind of commtest.com/.../11642.jpg.
Its a dongle with built in pl2303 chip for usb to serial communication.