XR8 rx telemetary sensors

General Help and support for the Taranis Radio.
User avatar
MikeB
9x Developer
Posts: 16556
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: XR8 rx telemetary sensors

Post by MikeB » Sat Nov 02, 2013 3:07 pm

I've committed a code update, which I've tested. This includes the scaling option when pin 5 (PB0) is pulled to ground.
I've also added the .hex file to save compiling it. This may be useful and the code is using sowtrare timing and a different compiler might generate slightly different code that upsets the timing (I'm using GCC 4.8.0).

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!


aadamson
Posts: 123
Joined: Fri Oct 18, 2013 6:47 pm
Country: -

Re: XR8 rx telemetary sensors

Post by aadamson » Sat Nov 02, 2013 3:50 pm

Thanks Mike saves me a step and all I had was the old winavr stuff

aadamson
Posts: 123
Joined: Fri Oct 18, 2013 6:47 pm
Country: -

Re: XR8 rx telemetary sensors

Post by aadamson » Sat Nov 02, 2013 3:57 pm

Mike can you do me one last favor. Either send me or put in the makefile the avrdude line with the fuse bits etc so I get that right too

Thanks in advance
Alan

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

Re: XR8 rx telemetary sensors

Post by MikeB » Sat Nov 02, 2013 4:09 pm

I'll see what I can do, I just use AvrStudio to my STK500 programmer so I haven't used AVRDUDE for the fuses (or programming!).

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

aadamson
Posts: 123
Joined: Fri Oct 18, 2013 6:47 pm
Country: -

Re: XR8 rx telemetary sensors

Post by aadamson » Sat Nov 02, 2013 4:13 pm

I can figure it out if you give me the fuse values?


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

Re: XR8 rx telemetary sensors

Post by MikeB » Sat Nov 02, 2013 10:55 pm

HIGH 0xFD
LOW 0x3A

No self program
No DWEN
Brownout at 1.8V
No Reset disable
SPIEN on
EESAVE on
No watchdog - No code to retrigger this at present, maybe I should add it.
No CLKDIV8
int RC @ 9.6MHz, 14CK and 64mS

I'll look into the watchdog, but may be Monday before I get to it.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

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

Re: XR8 rx telemetary sensors

Post by MikeB » Sun Nov 03, 2013 8:25 pm

Managed to find some time!
Fuses:
HIGH 0xFD
LOW 0x1A

No self program
No DWEN
Brownout at 1.8V
No Reset disable
SPIEN on
EESAVE on
Watchdog enabled
No CLKDIV8
int RC @ 9.6MHz, 14CK and 64mS

I've commited a code update to include having the watchdog running, and also to check the OSCCAL value doesn't go outside its limits.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

aadamson
Posts: 123
Joined: Fri Oct 18, 2013 6:47 pm
Country: -

Re: XR8 rx telemetary sensors

Post by aadamson » Mon Nov 04, 2013 4:27 am

Ok, avrdude settings as follows.
-U lfuse:w:0x1a:m -U hfuse:w:0xfd:m

from -
http://www.engbedded.com/fusecalc

aadamson
Posts: 123
Joined: Fri Oct 18, 2013 6:47 pm
Country: -

Re: XR8 rx telemetary sensors

Post by aadamson » Mon Nov 04, 2013 8:30 pm

Look what showed up today... Darn I better get those resistors ordered! :)...

Alan

Image

User avatar
ShowMaster
Posts: 4327
Joined: Thu Dec 29, 2011 3:44 am
Country: -
Location: Los Angeles, CA USA

Re: XR8 rx telemetary sensors

Post by ShowMaster » Mon Nov 04, 2013 9:46 pm

Are those the ones you ordered for me? Wow!

aadamson
Posts: 123
Joined: Fri Oct 18, 2013 6:47 pm
Country: -

Re: XR8 rx telemetary sensors

Post by aadamson » Mon Nov 04, 2013 10:02 pm

aadamson wrote:Look what showed up today... Darn I better get those resistors ordered! :)...

Alan

Image
Test victims :)... that was fast, couple mins with some solder paste, couple mins with the parts, and a couple mins in the oven...

Image

Clivew
Posts: 338
Joined: Tue Dec 27, 2011 8:08 pm
Country: -
Location: Stroud, Glos, England

Re: XR8 rx telemetary sensors

Post by Clivew » Mon Nov 04, 2013 11:31 pm

MikeB wrote:A version using an AtTiny13.
This is intended just as a single analog input device for the X8R.
Cd.png
PcbCuts.jpg
PcbWires.jpg
PcbBuilt.jpg
The connector on the right is colour coded. The SPort connection is the lower three pins:
Black - ground
Red - power
Green - signal
The upper two pins (wmpty space between):
Black - ground
Blue - analog input 0-3.3V
layout.png
sportTinyAnalog.zip
If programming the chip on the board:
MISO - SPort signal
V+ - pin by CPU pin 8
SCK - Analog input
MOSI - pin by CPU pin 5
RESET - pin 1 of CPU (I missed placing a connection for this)
Ground - SPort ground or Analog input ground

Fuses - internal 9.6MHz clock, NO clock div 8 (I need to check any others!).

While running, pin 3 outputs a debug signal to show the timing during data receive.
The program attempts to monitor the input data, at startup, to set the CPU clock correctly.

Clearly, a PCB and surface mount devices would be MUCH smaller.

Mike.
Ok Mike, just built a stripboard Tiny13 one following your layout thanks!
Managed to shrink it to 13mm x 18mm x 8mm with a bit of sawing :roll:
How do I program it please? Would a 5v supply to the board and a usbasp set to 3.3v
do the trick, mosi miso rst sck and gnd be ok?
Just flash sport.hex via avrdude? Or is there more to it than that?
Thanks again,

Clive

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

Re: XR8 rx telemetary sensors

Post by MikeB » Mon Nov 04, 2013 11:42 pm

That should all be OK, it's pretty much what I've been doing, except I'm using a STK500 (set to 3.3V) as the programmer. You will need to set the fuses as well, info just a few post back.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

Clivew
Posts: 338
Joined: Tue Dec 27, 2011 8:08 pm
Country: -
Location: Stroud, Glos, England

Re: XR8 rx telemetary sensors

Post by Clivew » Mon Nov 04, 2013 11:54 pm

Do you never sleep?


Thanks Mike!

aadamson
Posts: 123
Joined: Fri Oct 18, 2013 6:47 pm
Country: -

Re: XR8 rx telemetary sensors

Post by aadamson » Tue Nov 05, 2013 1:41 am

So why do you need to program them at 3v3... they are 5v devices aren't they... And with that said... I'm ready to pull out my hair...

I've checked the schematic about 20 times, the board about 100 times and I can't seem to program one of these to save my life... I've verified the programmer on a 328p and I've tried both 5v and 3v3... I guess I'm going to have to go dig out my stk500 and see if I can make that work, although I'm not looking forward to that.

Any ideas? ISP with 5v on VCC or ISP without 5v and putting 5V the VR and 3v3 to the process.... sheesh!

UPDATE:
OMG, what PITA (no wonder I don't like AVR's :))... I had to set the clock rate from 10us to 20us and then avrdude would talk to the chip... sheesh...


Alan

aadamson
Posts: 123
Joined: Fri Oct 18, 2013 6:47 pm
Country: -

Re: XR8 rx telemetary sensors

Post by aadamson » Tue Nov 05, 2013 4:36 am

Mike,

Here's where I am - NOT FUNCTIONAL

3 boards are built, verified a million times. Power supply works.. 3v3 at the processor

Here's what I've done so far
a) connected s.port on X8R to sport on x8r-analog board, +, -, and serial X8R powers the board just fine.
b) I don't have the VD resistors, so for now I jumpered 3v3 to the AIN pin on the tiny. I did this by jumpering pins 2 and 3 on the ISP connector. This should put 3v3 on the ain pin
c) I hooked a logic probe to the debug pin and I do see it triggering. I'll have to look again tomorrow and figure out it's rate and what it looks like.

On the Taranis, I get A1 telemetry and an indication of telemetry on and loss, but I get NO A2 value. It populates 0.0 as soon as the radio comes up and the receiver light turns green.

Got any ideas?

For what it's worth, I"m using attiny13v's Im going to go check the fuse bits again just to make sure I don't have a clock issue...

Alan

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

Re: XR8 rx telemetary sensors

Post by MikeB » Tue Nov 05, 2013 12:21 pm

I'll do something this afternoon, I've been sidetracked this morning.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

aadamson
Posts: 123
Joined: Fri Oct 18, 2013 6:47 pm
Country: -

Re: XR8 rx telemetary sensors

Post by aadamson » Tue Nov 05, 2013 12:53 pm

MikeB wrote:I'll do something this afternoon, I've been sidetracked this morning.

Mike.
Thanks Mike, I'm going to hook my LA to the serial pin just to see if there is data... don't know if I'll be able to decode anything or not with it, but we'll see... I realized I could do that last night after I stopped for the night

aadamson
Posts: 123
Joined: Fri Oct 18, 2013 6:47 pm
Country: -

Re: XR8 rx telemetary sensors

Post by aadamson » Tue Nov 05, 2013 1:14 pm

So with the trusty Logic analyzer... Here's what I see.


The next picture is with RX powered but the TX off, top trace is the debug pin, bottom trace is the s.port pin. I think I included the timing marks at the top of the capture.
screenshot1.png
The next picture is a close up of the 2 pulses.... Again, top trace is debug pin, bottom trace is the s.port pin. I turned on the serial decoder on the LA, with a 57600 baud and inverted logic, you'll see what it decoded in little bubbles above the trace. I have no way to know which device is sending
screenshot2.png

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

Re: XR8 rx telemetary sensors

Post by MikeB » Tue Nov 05, 2013 1:33 pm

OK, the processor clock is too slow. Each (-ve) pulse on the debug signal should be the centre of a bit, the last falling edge should be the centre of the stop bit. The first byte is 0x7E.
In your picture, the last data sample is of the stop bit, and the stop bit edge is just into the next start bit.

Here's a hex file that outputs a divided clock for three seconds, the period should be 426.7uS.
Sport.hex
Slght receive timing improvement 17:08 GMT
(1.92 KiB) Downloaded 147 times
It's on pin 2. To activate it, pull pin 2 down through a 4K7 resistor. The program has a pullup on pin 2. If pin 2 is low, then it turns the pin to an output and then sends the pulses.

We can work out what frequency you actually have, should be 9.6MHz, the output is this divided by 4096.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

aadamson
Posts: 123
Joined: Fri Oct 18, 2013 6:47 pm
Country: -

Re: XR8 rx telemetary sensors

Post by aadamson » Tue Nov 05, 2013 2:41 pm

Untitled1.jpg
Here's what the code looks like...

The entire pulse ran for 3.583seconds and at arough guess, the period is off by 11us?
Alan

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

Re: XR8 rx telemetary sensors

Post by MikeB » Tue Nov 05, 2013 2:57 pm

OK, I'm checking. I can see an error in my clock adjust code. I'm using clock/8 as the clock for timer 1, and have calculated from this as 1.2uS per count. It's not, it 1.2MHz, 0.833uS per count.

Mike.

Edit: This may affect other timings, testing now.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

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

Re: XR8 rx telemetary sensors

Post by MikeB » Tue Nov 05, 2013 4:10 pm

Looking OK generally. I'll do some more testing, but I have updated the hex file in the post above (I don't like leaving incorrect files on posts). This one should work.
I had the code a bit wrong, and also changed the clock in the wrong direction!.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

aadamson
Posts: 123
Joined: Fri Oct 18, 2013 6:47 pm
Country: -

Re: XR8 rx telemetary sensors

Post by aadamson » Tue Nov 05, 2013 4:26 pm

Thanks Mike I'll test it out when I get back to the office and let you know.

Will the above hex still do the timing or will it work as the actual code fir the x8r?

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

Re: XR8 rx telemetary sensors

Post by MikeB » Tue Nov 05, 2013 4:31 pm

Both! The timing is still there, but only runs if you have the 4K7 pulldown on the signal.

Mike.

Edit: Minor timing improvement, hex file above reposted.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

aadamson
Posts: 123
Joined: Fri Oct 18, 2013 6:47 pm
Country: -

Re: XR8 rx telemetary sensors

Post by aadamson » Tue Nov 05, 2013 5:08 pm

MikeB wrote:Both! The timing is still there, but only runs if you have the 4K7 pulldown on the signal.

Mike.

Edit: Minor timing improvement, hex file above reposted.
Um, I just flashed the sport.hex above and it's *exactly the same*... same period, same non-matched debug pin to bit clock...

going to verify ... but that's what I saw...

aadamson
Posts: 123
Joined: Fri Oct 18, 2013 6:47 pm
Country: -

Re: XR8 rx telemetary sensors

Post by aadamson » Tue Nov 05, 2013 5:17 pm

yup, reverified no change, and no telemetry

traces look identical for both the debug/sport and the clock pulse pin when on 4k7 to ground same period same offset pattern. did ya somehow build the wrong source?

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

Re: XR8 rx telemetary sensors

Post by MikeB » Tue Nov 05, 2013 6:08 pm

Try this one:
Sport.hex
Test version only
(1.97 KiB) Downloaded 149 times
I've shortened the timings to try to make it receive correctly.
The debug clock won't change, this is before the clock is adjusted so we can find out what the clock frequency actually is.
If this responds, I've added some debug values to the sent data. They will be ignored by the Tx if seen, but if you can catch them on the logic analyser they might help work out what is happening.

I'm available for around another hour now.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

aadamson
Posts: 123
Joined: Fri Oct 18, 2013 6:47 pm
Country: -

Re: XR8 rx telemetary sensors

Post by aadamson » Tue Nov 05, 2013 6:16 pm

ok, testing now... back in a few.

aadamson
Posts: 123
Joined: Fri Oct 18, 2013 6:47 pm
Country: -

Re: XR8 rx telemetary sensors

Post by aadamson » Tue Nov 05, 2013 6:25 pm

ok, prelim... timing is much better, maybe a smidge too fast, but TELEMETRY IS FUNCTIONAL!!!

Data coming to you shortly


Post Reply

Return to “General help (FrSky Taranis radio)”