| Louis S 01/15/10 07:14 Read: 464 times |
#172485 - Simulation vs. Embedded Discrepancy |
Hi folks,
I've been simulating a design for the AT89C51ID2 8051, and finally gotten a chance to run the code embedded. After a good deal of debugging some odd outputs, I seem to have located the root of my issues. I currently have a simple app to bring up the 8051 in a good state and then send a character out the SPI bus. The code works fine in simulation. When I run embedded, however, I have problems with the SPI output when passing variables. For example, the following works in simulation and embedded: spi_shiftByte(0x55); // as expected, I see 0x55 on the MOSI line The following works only in simulation: unsigned char test _at_ 0x702; // address is arbitrary test = 0x55; spi_shiftByte(test); // simulation outputs 0x55, while embedded outputs 0x02 (and seems to always be the least significant byte of the variable's address I also had some interrupt-driven serial port i/o I stripped out during debugging. Interestingly, I was seeing errors with it that could also be explained if passed variables (tx and rx buffer locations) were showing up as the LSByte of addresses instead of their values. Note that everything works in simulation and I'm fairly confident in this simulator. The assembly generated looks ok, and I'm stumped on how passing by value could yield a piece of the address. Maybe something funny on an internal bus? I was wondering if this is something anyone has seen before, or if anyone has any ideas on a good next step for debugging this. Unfortunately, I'm currently without an emulator. Thank you, Louis |
| Topic | Author | Date |
| Simulation vs. Embedded Discrepancy | Louis S | 01/15/10 07:14 |
| Hardware fault? | Andy Neil | 01/15/10 07:39 |
| Responding to: Andy Neil's previous message | Louis S | 01/15/10 07:51 |
| illustration of edge difference? | Erik Malund | 01/15/10 08:00 |
| SPI Phase/Polarity | Louis S | 01/15/10 08:06 |
| address instead of value | Andy Neil | 01/15/10 08:17 |
| Doesn't seem coincidental | Louis S | 01/20/10 13:19 |
| MOVX command fails | Louis S | 01/21/10 09:28 |
| Definitely sounds like a hardware fault! | Andy Neil | 01/21/10 12:01 |
| Have you tried doing this in ASM? | Richard Erlacher | 01/21/10 12:32 |
| The loop in ASM | Louis S | 01/21/10 14:27 |
| I think... | Jez Smith | 01/21/10 15:11 |
| Sounds like hardware again | Andy Neil | 01/21/10 17:34 |
| If this were reduced to the essentials ... | Richard Erlacher | 01/21/10 18:36 |
| Oh Richard | Jez Smith | 01/22/10 01:32 |
| What I was after ... | Richard Erlacher | 01/21/10 18:30 |
| Reducing to Essentials | Louis S | 01/22/10 10:56 |
| RE: Magic Switch On The Compiler | Andy Neil | 01/22/10 12:21 |
| Emulator trace | Louis S | 01/22/10 12:59 |
| Yes | Neil Kurzman | 01/23/10 02:39 |
| SOLVED | Louis S | 01/25/10 11:10 |
| A bit ocnfused | Andy Neil | 01/25/10 11:24 |
| Emulator and AUXR | Louis S | 01/25/10 14:15 |
Things do tend to work best... | Andy Neil | 01/25/10 14:54 |
| one guess with a question | Erik Malund | 01/21/10 13:46 |
| Memory has plenty of gaps | Louis S | 01/21/10 14:29 |
| That doesn't make sense! | Andy Neil | 01/23/10 03:25 |
| Sloppy language on my part | Louis S | 01/23/10 23:00 |
| Am I missing something | Neil Kurzman | 01/21/10 19:06 |
| questions/request | Erik Malund | 01/22/10 06:52 |



