Espeasy uart break

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Smotek7
Normal user
Posts: 142
Joined: 01 Aug 2020, 16:18
Location: SK

Espeasy uart break

#1 Post by Smotek7 » 25 Sep 2023, 22:24

I need to send HEX data to the device, but the device waits about 590us before sending "uart break".
Can you create rules with uart break?
My imagination.
I will send to ESPeasy http commad, according to the rules, after uart break and then Hex string (eg 0x55, 0x0C, 0x00, 0x03, 0x50, 0x90, 0x01, 0x05, 0xC7, 0x842, 0x02, 0x02, 0x02 0xE6, 0x0C).
In the opposite direction, when the device answers, for example, 55 0E FF FF 00 03 01 07 05 04 02 83 19 00 00 9C 0E
sent to the Controller, e.g. UDP.
Can the uart break be created in ESPeasy?

User avatar
Ath
Normal user
Posts: 3522
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Espeasy uart break

#2 Post by Ath » 29 Sep 2023, 19:53

After re-reading your question a couple of times, I still don't have a clue what you're trying to say with "uart break", can you elaborate on what that's supposed to do/be?
/Ton (PayPal.me)

Smotek7
Normal user
Posts: 142
Joined: 01 Aug 2020, 16:18
Location: SK

Re: Espeasy uart break

#3 Post by Smotek7 » 29 Sep 2023, 21:06

I also encountered it for the first time.
Some devices require a specified time at the start of log.0.
That's the Break.
So far I managed to do it in Arduino nano like this

Code: Select all

#define baud_work 19200
#define baud_break 9200
uint8_t master_tx_buf[] = {0x55, 0x0C, 0x00, 0x03, 0x50, 0x90, 0x01, 0x05, 0xC7, 0x02, 0x82, 0x03, 0x64, 0xE7, 0x0C};
uint8_t break_tx_buf[] = {0x00};

void send_break() {
  Serial.flush();
  Serial.end();
  Serial.begin(baud_break);
  Serial.write((char *)break_tx_buf, sizeof(break_tx_buf));
  delayMicroseconds(90);
  Serial.end();
  Serial.begin(baud_work);
 
}
I understand it so that the exact length of "Break" is reached,
so the speed changes and 0x00 is sent.
This corresponds to some time segment Log.0 na TX.

Would I be able to write similar code in Rules?
I don't know how fast the operations in Rules are performed.

User avatar
Ath
Normal user
Posts: 3522
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Espeasy uart break

#4 Post by Ath » 29 Sep 2023, 21:20

Smotek7 wrote: 29 Sep 2023, 21:06 Would I be able to write similar code in Rules?
I don't know how fast the operations in Rules are performed.
Don't think that's currently possible. Haven't encountered anything like this before. Looks like the RS232 lines are to be held low for some time before the transmission starts. Maybe a "longpulse_ms" command can send the right kind of pulse on the GPIOs involved. But I'm not sure about the change in baudrate. Don't think the serial output plugins allow to change the baudrate during flight, but you can try, of course.

What (type of) device is expecting this kind of signal?
/Ton (PayPal.me)

TD-er
Core team member
Posts: 8756
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Espeasy uart break

#5 Post by TD-er » 29 Sep 2023, 21:48

Sounds a bit like the device does perform an "autobaud" check to detect the baud rate.

On the RN2483A (LoRaWAN module) you also need to set the baud rate to the lowest value and send out a zero byte.
This effectively pulls the RX pin of the device to a state which cannot be decoded into a valid byte and thus it starts an autobaud sequence.

Smotek7
Normal user
Posts: 142
Joined: 01 Aug 2020, 16:18
Location: SK

Re: Espeasy uart break

#6 Post by Smotek7 » 29 Sep 2023, 22:34

It is the Nice gate electronics.
No, it does not detect speed.
The speed change is done so that byte 0x00 lasts the correct time.
If the flood speed remained, 0x00 would be a long "Break".
By reducing the speed, the correct length of time "Break" is achieved.
Longpulse would be the solution, but the Break is 590 microseconds.

Post Reply

Who is online

Users browsing this forum: No registered users and 29 guests