Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/15/10 13:14
Read: 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

List of 30 messages in thread
TopicAuthorDate
Simulation vs. Embedded Discrepancy            01/01/70 00:00      
   Hardware fault?            01/01/70 00:00      
      Responding to: Andy Neil's previous message            01/01/70 00:00      
   illustration of edge difference?            01/01/70 00:00      
      SPI Phase/Polarity            01/01/70 00:00      
         address instead of value            01/01/70 00:00      
            Doesn't seem coincidental            01/01/70 00:00      
               MOVX command fails            01/01/70 00:00      
                  Definitely sounds like a hardware fault!            01/01/70 00:00      
                  Have you tried doing this in ASM?            01/01/70 00:00      
                     The loop in ASM            01/01/70 00:00      
                        I think...            01/01/70 00:00      
                        Sounds like hardware again            01/01/70 00:00      
                           If this were reduced to the essentials ...            01/01/70 00:00      
                              Oh Richard            01/01/70 00:00      
                        What I was after ...            01/01/70 00:00      
                           Reducing to Essentials            01/01/70 00:00      
                              RE: Magic Switch On The Compiler            01/01/70 00:00      
                                 Emulator trace            01/01/70 00:00      
                                    Yes            01/01/70 00:00      
                                       SOLVED            01/01/70 00:00      
                                          A bit ocnfused            01/01/70 00:00      
                                             Emulator and AUXR            01/01/70 00:00      
                                                Things do tend to work best...            01/01/70 00:00      
   one guess with a question            01/01/70 00:00      
      Memory has plenty of gaps            01/01/70 00:00      
         That doesn't make sense!            01/01/70 00:00      
            Sloppy language on my part            01/01/70 00:00      
      Am I missing something            01/01/70 00:00      
      questions/request            01/01/70 00:00      

Back to Subject List