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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/21/10 11:31
Read: times


 
Msg Score: +1
 +1 Good Answer/Helpful
#178173 - Stop fooling yourself
Responding to: ???'s previous message
Must I repeat myself?

Your master may repeat, if it doesn't get data.

But your slave does not synchronize with any repeat, with less than receiving a request to restart.

You do not implement a communication protocol that requires the slave to restart from the reset vector (which isn't even a proper reset).

You implement a protocol where the slave rests the transmit state (normal variables, not full processor state) as soon as it receivers a new request from the master. Whenever it sees a transfer with the 9th bit set, the slave should synchronize.
- If the received address was for another slave, then the slave should stop sending any data, and clear the send state.
- If the received address was for this slave and a request for data, the slave should either restart (from first byte) the previous data transfer, or (if last transfer was sent in full including receiving an acknowledge) start with the first byte of the next packet of data.

Don't spend so much time explaining that your code works. Your system that you are testing the code on should be proof enough that the code does not work. So wehen someone points out a synchronization problem with the code, you shouldn't be so quick to explain to me that it works, but onstead spend time proving to yourself if it really works or not.

You have described your slave logic as:
SEND SLAVE PROTOCOL START BYTE
- WAIT FOR DATA ACKNOWLEDGE
SEND DATA FRAME TYPE BYTE (TB8 = 0)
- WAIT FOR DATA ACKNOWLEDGE
SEND DATA BYT
- WAIT FOR DATA ACKNOWLEDGE
SEND DATA BYTE
- WAIT FOR DATA ACKNOWLEDGE
SEND SLAVE PROTOCOL END BYTE
- WAIT FOR DATA ACKNOWLEDGE

It should be described as:
1) Send slave protocol start byte
2) Wait for acknowledge.
a) If acknowledge received, go to 3.
b) If timeout - fail transfer, and wait for master to address slave again.
c) If other than acknowledge - fail transfer, and wait for mater to address slave again.
3) Send data byte
4) Wait for acknowledge
a) If acknowledge received, go to 5.
b) If timeout - fail transfer, and wait for master to address slave again.
c) If other than acknowledge - fail transfer, and wait for mater to address slave again.
..

Solve your problems instead of convincing yourself that the code is already working. Isn't the lockups you are seeing already proof that the code is not working?

Right now, your slave code does not synchronize with the master unless you force it to reset. That is because the slave code logic is broken, having while loops forcing a full message to be sent even if the communication gets a failure in the middle of the data byte sequence.

List of 46 messages in thread
TopicAuthorDate
Multiprocessor Communication 8052            01/01/70 00:00      
   missing info            01/01/70 00:00      
      Hardware and slaves placement            01/01/70 00:00      
         How to TriState???            01/01/70 00:00      
            Using Tristate IC in Slave Card            01/01/70 00:00      
               at the receive ...            01/01/70 00:00      
               RE: I think that this IC handles the Tristate situation            01/01/70 00:00      
               then you need to read            01/01/70 00:00      
                  At the Master end            01/01/70 00:00      
                     again, you need a schmitt            01/01/70 00:00      
                        Hysterese            01/01/70 00:00      
                        Re: Thanks...Info about hardware we are using            01/01/70 00:00      
                           how do you know?            01/01/70 00:00      
                              Lowering baud rate            01/01/70 00:00      
                           Really            01/01/70 00:00      
                              Modified the code in Master and Slave            01/01/70 00:00      
                                 Haven't seen full code - slave protocol state fully cleared?            01/01/70 00:00      
                                    Slave protocol code            01/01/70 00:00      
                                       Slave send code fails to synchronize            01/01/70 00:00      
                                          breaking infinite waits in slave acknowledge wait            01/01/70 00:00      
                                       Stop fooling yourself            01/01/70 00:00      
                                          why didn't you before posting updated code            01/01/70 00:00      
                                          How to reset?            01/01/70 00:00      
                                             Hard reset by doing a hard reset.            01/01/70 00:00      
                                          Errors gone            01/01/70 00:00      
                                             But slave still doesn't synchronize with a resend request            01/01/70 00:00      
                                                that is not the way to do it            01/01/70 00:00      
                                                   too late for an edit            01/01/70 00:00      
      Reduced Baud Rate            01/01/70 00:00      
         not surprised            01/01/70 00:00      
            Never reboot for a transfer error            01/01/70 00:00      
               never be an afterthought            01/01/70 00:00      
                  Transfer validation before implementing command processing            01/01/70 00:00      
                     a trick            01/01/70 00:00      
                        address coding example required            01/01/70 00:00      
                           example            01/01/70 00:00      
                        Added "No message" byte            01/01/70 00:00      
                  never be an afterthought: Amen            01/01/70 00:00      
               Slave Recovery in Error            01/01/70 00:00      
                  Find out Why            01/01/70 00:00      
                     absolutely            01/01/70 00:00      
                        worse in the real world            01/01/70 00:00      
                  in addition: rise baudrate            01/01/70 00:00      
               Slaves follow Synchronization            01/01/70 00:00      
   + Error Checking?            01/01/70 00:00      
      It would be smart to assume that a percentage of messages...            01/01/70 00:00      

Back to Subject List