MEGA128 UART Break problem

Go To Last Post
15 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi !
In my project, a new frame of serial data will be started with a "break".
A break is a low for more than ony byte.
Data transfer speed is 250 kBit/s, 1 Start, 1Stop, 1 Parity.
The break will be >60µs.I use the build in "Framing Error" bit to detect the
break.

The problem is, if I get many breaks (~10.000 / sec), the break condition will not be cleared by the UART. Writing in the register will not help.
The only workaround at the moment is, to check if a break condition exist, a new frame has started within the last 2 bytes and the data of the break is my adress. If this is the case, the "break" is no break but data....

Anyone an idea? :roll:

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If it's DMX , search google

There is many examples out there

/Bingo

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

First thanks, second it's not DMX.
The problem is not the protocol, the problem is the UART (I think)
Andreas

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Even though it's not DMX

I think DMX uses almost same protocol & speed , it might be worth a look.

Maybe someone has an circumvention/solution to the problem

Maybe here
http://www.hoelscher-hi.de/hendr...

/Bingo

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Why do you need this "break-low" anyway?
Just to detect the start of a Rx-frame?

Real men don't use backups, they post their stuff on a public ftp server and let the rest of the world make copies.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@ groenhen: How would you detect a starting RX in a multii slave system else?
Think, you can power ON the device every time you want. Also you have adresses for every device....

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

baer.ac wrote:
@ groenhen: How would you detect a starting RX in a multii slave system else?

You can use a protocol ID.

Quote:
Think, you can power ON the device every time you want.

So what?

Quote:
Also you have addresses for every device....

Obviously! ... But, if you're afraid that the address may be taken as the protocol ID, then you may code the address in a smart way, using for example 3 ASCII bytes.

Real men don't use backups, they post their stuff on a public ftp server and let the rest of the world make copies.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sorry, but this isn't the problem. The protocol exist and I have trouble with the UART.
(Anyway, You cannot detect the start of a frame only with ASCII chars. The data is sent binary over the bus (is RS485 with RX/TX switching, halfduplex))

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

baer.ac wrote:
Anyway, You cannot detect the start of a frame only with ASCII chars. The data is sent binary over the bus (is RS485 with RX/TX switching, halfduplex)

Oh, YES it is doable!
As long as I am currently doing it! Similar conditions:
- RS485 and of course half-duplex (can't imagine otherwise);
- also binary frames over the line/bus;
- only difference is that I'm using only 19200 bps.
I didn't say that I'm using ASCII chars for the start of frame (in fact I use 0xA5 for start-of-frame); I said that it's possible to use 2 or 3 bytes to code the address (just to avoid PID overlapping).

Real men don't use backups, they post their stuff on a public ftp server and let the rest of the world make copies.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
The protocol exist and I have trouble with the UART.

Ok, I see...
Now, just an idea: is it possible to connect the Rx-signal also to an interrupt pin?

Real men don't use backups, they post their stuff on a public ftp server and let the rest of the world make copies.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No Sorry, all pins are gone... :)
I must choose the 128er because of pinout....

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Oh... then you're in deep trouble here, as IMHO the Rx unit of HW-UART will trigger the sampling process as soon as the input signal goes low, right?
So, what are you going to do in order to avoid/handle that? [on AVR Rx-side, of course...]

Real men don't use backups, they post their stuff on a public ftp server and let the rest of the world make copies.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,
normally the RX Int is on. If it triggers (the time for the byte after the falling edge is over) then I read the registers and decide if it is a break or not.
After reading the UDR (data register) the break flag should be away.
As far as I have dbugged it is just in this moment. BUT the next byte will also be recognized as break... stupid, isn't it?
Perhaps, I shoul diable Interrupt, stop the RX engine and look at the port until it's high again...
Andreas

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
BUT the next byte will also be recognized as break... stupid, isn't it?

Double-buffered ?
Quote:
Perhaps, I shoul diable Interrupt, stop the RX engine and look at the port until it's high again...
Yes, IMHO it isn't wise to mix the UART-job with that 60us break.
Also, depending on your xtal, you may have Tx&Rx errors at higher baud rates...

Real men don't use backups, they post their stuff on a public ftp server and let the rest of the world make copies.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,
@SteveN: Don't apologize...
I can't move to the 1281 because of 100 already maked boards....
But thanks for the advise
@groenhen:
On other AVR's, a similar protocol (break, adress) runs (really?)
I've tried to disable the Rx machine, but with no luck...
The 128 is running @8MHz@3.3V