I got my program to a point where I needed to test so I ran it in the uVision simulator. It was flawless. I fired up my Nohau emulator and ran it on our new PC board. Perfect.
I burned a chip (89C51RD2) and popped it in the board...nothing.
Since I am now the only embedded guy in the shop I work alone I have no one to bounce ideas off. So I've come here.
The oscilloscope shows that timer_0 is running, and my ISR is OK because the watchdog strobe is happening and the timer values are being reloaded.
Has anyone seen this before? Do you have a suggestion of of path to find the differences between the simulated and emulated situation and running on the board?
First you describe what happens as:
...nothing.
Then you go on to list several things that do happen. Which means that what's happening is clearly not "nothing", and brings us back to the real question that you completely skipped: what exactly did you expect to happen? And how do you know it's not happening?
Has anyone seen this before? Do you have a suggestion of of path to find the differences between the simulated and emulated situation and running on the board? .... "hammer out" 'U' and scope it. a difference could be hardware set of the 6/12 clock and the set with the emulator.
Erik
"I ran it in the uVision simulator. It was flawless."
Did you really run an exhaustive set of tests to prove that every possible execution path was, indeed, without flaw - or did you just run it a couple of times without noticing any problems?
Hi, very nice project, congratulations! Do you have the source code of the program? Thanks
Very nice what project? The one with nothing happening?
I expected it to send an "I'Alive" packet out the serial port, a heartbeat LED to pulse and flipping dipswitches to turn ports ON/OFF.
The code in its current state turns P2^0 through P2^7 ON/OFF based on the state of the dipswitch located at P0^0 through P0^7. I have LEDs on the TX, RX and DIR lines (its RS-485) and a "heartbeat" LED that I strobe every 500 mSecs. In the simulator the simulated LEDs work appropriately and P2 changes as expected. Using the emulator the LEDs flash, I catch the message on my development system and the 'scope shows the changing of P2 with P0. On the board the LEDs do not flash, the heartbeat does not flash and P2 does not change.
The heartbeat is in my main loop and it watches a variable that is undated in the timer_0 ISR. When it reaches the target value I toggle the state of the heartbeat LED and reset the variable.
The serial "stuff" is code that I include in almost all of my projects and probably fairly common RS-485 stuff with the exception that it supports our proprietary protocol. I don't think I've made a change to any of that code in over 5 years.
My normal operating mode is to get the code for new boards to the communications, heartbeat and test port point and then begin to test the actual board. I'm reasonably confident that the board is functioning as expected since the code works in the emulator.
Actually, I did run an exhaustive set of tests. The code at this point is either trivial or code that I am reusing from previous projects (I have been the Senior Firmware Engineer here since 1994). I asked the question here because I no longer have engineers working for me that I can brainstorm with. Like many USA companies we are now actively outsourcing almost everything so that we can lay-off long time employees.
I'm not a student looking for help with his homework (I'm 54 years old) or a new kid needing help writing the code (I've been writing software since 1974 and firmware since 1985). I've never before seen this situation. When it runs in the emulator it runs on the board.
I hope that didn't sound snarky, I didn't intend it that way.
Yes, I do. Thanks for asking.
.
I will try that right after the meeting I'm in ends. I appreciate the suggestion.
*if it ever ends* ;)
If everything works in the emulator on your hardware, that's a good sign.
If you can figure out exactly what's different between the emulator and your target hardware, that's where to look. Differences might include:
Hopefully, this list will help get you looking in the right place.
Jon
Emulator VS Chip Vcc - Right and stable, The Emulator may use its own. Reset - The emulator may ignore it. EA - The emulator may ignore it. On Board RAM and ROM - The emulator may use its own.
I will just assume it is the right chip.
So this heart:
The heartbeat is in my main loop and it watches a variable that is undated in the timer_0 ISR.
doesn't beat, but you stated earlier that the timer_0 ISR works. That suggests the code never makes it into main(). It could be stuck in the startup code.
So go a couple steps down in complexity: no startup to speak of, just flip a single port pin in a super-tight loop. In other words, go back to BLINKY.
Oh, and another thing, just for the heck of it: did you try repeating this step
I burned a chip (89C51RD2) and popped it in the board
a couple times? Sockets do malfunction sometimes.
Yes, I decided to do just that after the 'U' out the serial port failed.
It worked...I think now that it is a difference between the way the RAM is handled between the emulator and the 'actual' chip. However, I haven't ruled out anything as yet.