Quick question about frsky telemetry protocol

er9x is the best known firmware. It has a superb range of features and is well supported by the community. Well worth trying out.
Post Reply
Java
Posts: 50
Joined: Sat Aug 25, 2012 9:19 pm
Country: -

Quick question about frsky telemetry protocol

Post by Java »

Whats wrong with this FrSky telemetry packet?

Code: Select all

0x5e 0x11 0x02 0x00 0x5e 0x19 0x93 0x00 0x5e
Here's the description about DataID's used in this packet:
0x11 GPS speed (Before “.”)
0x11+8 GPS speed (After “.”)

Once I send such a packet to my D8R-II receiver (I use 9600baud, data bits 8, stop bits 1, no flow control), er9x in telemetry screen shows additional telemetry information but every value is displayed as zero.
I'm trying to feed this telemetry receiver with speed information but still on telemetry screen I see zero at speed section. What's wrong?

User avatar
MikeB
9x Developer
Posts: 17993
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Quick question about frsky telemetry protocol

Post by MikeB »

What are you using to send the data into the receiver? The serial port on the receiver is a 'proper' serial port, designed to accept RS232 levels. This means a logic '1' is a negative voltage and a logic '0' is a positive voltage. If you send the data directly from a processor withouit anu buffering, it will be upside down.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
Java
Posts: 50
Joined: Sat Aug 25, 2012 9:19 pm
Country: -

Re: Quick question about frsky telemetry protocol

Post by Java »

Ok, I have mistaken receiver input with TTL...
User avatar
gohsthb
Posts: 1412
Joined: Wed Dec 28, 2011 2:32 pm
Country: -
Location: Naperville, IL

Re: Quick question about frsky telemetry protocol

Post by gohsthb »

The receiver will accept TTL levels. I have connected an arduino to one of mine and it worked just fine. But like Mike said, the levels are inverted. So a 1 is a low. And a 0 is a high.
-Gohst
Java
Posts: 50
Joined: Sat Aug 25, 2012 9:19 pm
Country: -

Re: Quick question about frsky telemetry protocol

Post by Java »

So how do I tell arduino to send data in inverted levels?

User avatar
gohsthb
Posts: 1412
Joined: Wed Dec 28, 2011 2:32 pm
Country: -
Location: Naperville, IL

Re: Quick question about frsky telemetry protocol

Post by gohsthb »

You would use bit banging.
http://arduiniana.org/libraries/newsoftserial/

-Gohst
User avatar
thomas9x
Posts: 230
Joined: Wed Feb 29, 2012 3:12 am
Country: -
Location: USA

Re: Quick question about frsky telemetry protocol

Post by thomas9x »

You can also invert the Arduino's TTL serial signal with a common NPN transistor of your choice, as follows:
TTL inverter
TTL inverter
inverter.jpg (45.56 KiB) Viewed 9149 times

- Thomas
Java
Posts: 50
Joined: Sat Aug 25, 2012 9:19 pm
Country: -

Re: Quick question about frsky telemetry protocol

Post by Java »

gohsthb wrote:The receiver will accept TTL levels. I have connected an arduino to one of mine and it worked just fine. But like Mike said, the levels are inverted. So a 1 is a low. And a 0 is a high.
-Gohst
I still don't get it. Pure RS232 wants -10V for log1 and +10V for log0 but "somehow" 0V will work for log1 and +5 for log0?
User avatar
Kilrah
Posts: 11109
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Quick question about frsky telemetry protocol

Post by Kilrah »

Yep. Actual voltage matters little as they have an inverting transistor buffer on the input. So pretty much anything positive (>0.6V or so) will render the transistor conductive and be taken as logical 0, while anything below 0.6V or so (including negative) will be taken as logical 1.
Java
Posts: 50
Joined: Sat Aug 25, 2012 9:19 pm
Country: -

Re: Quick question about frsky telemetry protocol

Post by Java »

Great.
Java
Posts: 50
Joined: Sat Aug 25, 2012 9:19 pm
Country: -

Re: Quick question about frsky telemetry protocol

Post by Java »

Here's my sketch. Once I execute such code, additional information in telemetry screen of my 9x shows up but still every value is zero. What's wrong now?

Code: Select all

#include <SoftwareSerial.h>
SoftwareSerial rs232(2, 3, true);
void setup() {
  rs232.begin(9600);
}

void loop() {
  char b[] = {0x5e, 0x11, 0x02, 0x00, 0x5e, 0x19, 0x93, 0x00, 0x5e};
  rs232.print(b);
  delay(200);
}
User avatar
MikeB
9x Developer
Posts: 17993
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Quick question about frsky telemetry protocol

Post by MikeB »

How does rs232.print know how long b is? I would guess it is expecting a null (0x00) terminated string, in which case you will only be sending 0x5e, 0x11, 0x02, and stop on the 0x00.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
Java
Posts: 50
Joined: Sat Aug 25, 2012 9:19 pm
Country: -

Re: Quick question about frsky telemetry protocol

Post by Java »

Yeah, you're correct.
Greebo
Posts: 63
Joined: Sat Jun 16, 2012 11:12 am
Country: Australia
Location: NSW

Re: Quick question about frsky telemetry protocol

Post by Greebo »

You're better off using:

rs232.write(b, 9);

Which (according to the doco anyway) should write 9 bytes from your array "b".
I'd also define b as a byte instead of a char, since you are actually writing out bytes, not chars...

Arduino's serial.(or softwareserial.)print never get on well with "byte" data and I've always resorted to using write and being very precise about what I write to the serial port when dealing with byte data.
Java
Posts: 50
Joined: Sat Aug 25, 2012 9:19 pm
Country: -

Re: Quick question about frsky telemetry protocol

Post by Java »

Thanks for your suggestion, I'm not actually very familiar with arduino libraries but yeah... this sounds great.

Here's my final sketch, if someone else is willing to test this:

Code: Select all

#include <SoftwareSerial.h>

#define RX 2
#define TX 2
#define INTERVAL_200 200

SoftwareSerial rs232(RX, TX, true);
void setup() {
	rs232.begin(9600);
}

long time = -INTERVAL_200;

void loop() {
	if (time <= millis() - INTERVAL_200) {
		time = millis();
		byte buff[] = {0x5e, 0x11, 0x02, 0x00, 0x5e, 0x19, 0x93, 0x00, 0x5e};
		rs232.write(buff, sizeof(buff));
	}
}

Post Reply

Return to “er9x”