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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/24/09 18:21
Modified:
  04/24/09 18:25

Read: times


 
#164824 - BREAK detection is lousy!
Responding to: ???'s previous message
Chico said:
I learned from Kathy's DMX receiver code a technick to receive the DMX data, I think it is a bit dirty way to do, but I already tested and works.
He/she sets the serial port to 9bit mode, when receive a byte, look if the 9th bit is clear and byte is zero, if yes, should be a break!

It's not dirty, but dangerous! What if the byte is a normal data byte and the 9th bit is incidentally low, because of a glitch? A total transmission disaster because of one single glitch? No, the BREAK is too important and deserves a more reliable detection.

I wouldn't switch the UART modes either. I would take Mode 1 (1+8+1) for all and check the second stop bit of DMX transmission on the RXD line manually. The first stop bit can be checked by polling the RB8 register. If it's high, then a data byte was received. If it's low and the SBUF contains a zero byte, then a BREAK could have been received. Check also the second stop bit, then (manually). If it's also low, then a BREAK could have been received. Then, check the RXD line by periodically polling for at least further 40µsec and accept a BREAK only if all the pollings were low.

If a glitch destroys a data byte, then only one member gets wrong data, but if a BREAK is erroneously detected, all members might get wrong data!

Chico said:
Will RI be set after receiving a break?

Of course, if you set SM2=0 in UART Mode 1.

Chico said:
Can I look RxD state just after RI is set?

Of course, but remember that RI is set about in the middle of stop bit time. Also remember that the stop bit is saved in RB8 register.

Kai

List of 53 messages in thread
TopicAuthorDate
Is possible? AT89S52 with dual serial baud rate            01/01/70 00:00      
   yes...            01/01/70 00:00      
   Use Timer 2...            01/01/70 00:00      
      Can I have both at same time?            01/01/70 00:00      
         you can't have different baudrates...            01/01/70 00:00      
         YES            01/01/70 00:00      
         No, unless...            01/01/70 00:00      
            what registers?            01/01/70 00:00      
               Split-speed common in older times            01/01/70 00:00      
               Timer 2 registers of AT89S52            01/01/70 00:00      
   Where can I read...            01/01/70 00:00      
      Well, in the datasheet!            01/01/70 00:00      
      Tutorials; FAQs            01/01/70 00:00      
   You have two UART's ... Does that give you any ideas?            01/01/70 00:00      
   Timer2 baudrate            01/01/70 00:00      
      unconfuse yourself            01/01/70 00:00      
      What's wrong with page 15 of datasheet?            01/01/70 00:00      
      Trying this...            01/01/70 00:00      
         Have a look at this code example...            01/01/70 00:00      
            This damn 52 think it is a 51 !!!            01/01/70 00:00      
               counterfeit chip?            01/01/70 00:00      
   It is for a Midi to DMX project... new trouble            01/01/70 00:00      
      Alternatives            01/01/70 00:00      
         examples            01/01/70 00:00      
            Options            01/01/70 00:00      
   Found the crystal!            01/01/70 00:00      
      Let's see ... What is wanted here ...            01/01/70 00:00      
         He is already using two timers            01/01/70 00:00      
            Independent UARTs            01/01/70 00:00      
               Crystal seens OK - Could receive Midi.. "partially" send DMX            01/01/70 00:00      
                  Well done!            01/01/70 00:00      
                  Russel Bull... Can you please take a look in my code?            01/01/70 00:00      
                  I wouldn't use serial transmission interrupts            01/01/70 00:00      
                     Makes sense!            01/01/70 00:00      
                        Give this a try...            01/01/70 00:00      
                           Hard to find a place to test.            01/01/70 00:00      
                              Runtime of LCALL...            01/01/70 00:00      
                           stop bits            01/01/70 00:00      
                              TI flag is set at the begin of (first) stop bit!            01/01/70 00:00      
                                 TI/RI setting time            01/01/70 00:00      
                                    TI and RI details...            01/01/70 00:00      
   TI/RI question            01/01/70 00:00      
      what causes a serial int?            01/01/70 00:00      
      More things will happen...            01/01/70 00:00      
         If....            01/01/70 00:00      
            Yes            01/01/70 00:00      
   YEAAAAAAAAH! IT WORKED            01/01/70 00:00      
      Congrats!            01/01/70 00:00      
         Thanks really a lot!            01/01/70 00:00      
   A new challenge! The inverse way!            01/01/70 00:00      
      BREAK detection is lousy!            01/01/70 00:00      
         RB8            01/01/70 00:00      
            RB8 details...            01/01/70 00:00      

Back to Subject List