FrSky V8 transmitter module using Arduino and CC2500

Any old or new electronic projects on the go
User avatar
Mike_K
Posts: 501
Joined: 16 Feb 2018, 06:35
Location: Hertfordshire

Re: FrSky V8 transmitter module using Arduino and CC2500

Post by Mike_K »

What I've been doing for a while with the Jumper 4-in-1 modules is to edit _config.h to have a range of tuning values for each switch position, in steps of 19 (I wanted to go from near the min to the max tuning values in 14 steps/switch positions). I normally have the different CC2500 protocols (FrSky V8, Hitec, Futaba FHSS and Corona) on banks 2, 2, 3, 4 and 5 and move the Spektrum DSM2/DSMX onto bank 1, but for this project, I've combined it with Martins edited _config.h so there is only the FrSky V8 protocol on bank 1.

Sw1 tuning -125
Sw2 tuning -106
Sw3 tuning -87
Sw4 tuning -68
Sw5 tuning -49
Sw6 tuning -30
Sw7 tuning -11
Sw8 tuning 8
Sw9 tuning 27
Sw10 (A) tuning 46
Sw11 (B) tuning 65
Sw12 (C) tuning 84
Sw13 (D) tuning 103
Sw14 (E) tuning 122

So rather than having to keep re-compiling with different tuning values, you start at switch position 8 and try to bind, if it doesn't bind, power off, move the switch one position down to 7 and power on and retry binding. If nothing works below switch position 8, try position 9 and go up. You'll eventually find a switch position that works. Once bound, try the different switch positions to find the limits of what will work and not drop out and then chose the centre value.

For example, the last Jumper 4-in-1 I used, worked from switch position 7 to 3, so in this example, I'd use the centre value = Switch position 5 or a tuning value of -49. I then use the original _config.h with -49 in the tuning value for V8, D8 and D16, I've found that all three FrSky protocols need the same tuning value, but Futaba, Corona and Hitec need different tuning values. Interestingly the FrSky Delta 8 receivers seem to work without having to be tuned on any of its protocols V8, D8 Futaba FHSS and Hitec. Does it tune itself?

I got fed up of doing this and bought a second-hand Jumper T12 so that I can get the tuning value from OpenTx, but the above method works nearly as well.

Mike
Attachments
_Config.zip
(9.53 KiB) Downloaded 30 times
Martin
Posts: 577
Joined: 16 Feb 2018, 14:11
Location: Warwickshire

Re: FrSky V8 transmitter module using Arduino and CC2500

Post by Martin »

I've made progress today. I've pruned away most of the multiprotocol files including the config file and now I'm down to just four .ino files and one .h file: iface_cc2500.h Even those remaining files have large chunks pruned away which aren't needed for simple V8-only operation. It's now much easier to find the bits of code that require attention.

The compiled sketch now uses 2694 bytes (8%) of program storage space. and 115 bytes (5%) of dynamic memory. It uses very little processor time and gives a solid link between the tiny, no-power-amplifier, antenna-on-PCB module inside my house to my old V8FR receiver at the end of the garden. :D

It's still using Pascal's bit-banged SPI code. Next on the list of things to do, is swapping to use hardware SPI - if I can get that working, the sketch should get even smaller and with even less processor overhead: but I don't know why Pascal chose to bit-bang it in the first place, so perhaps there's a good reason NOT to use hardware SPI? :?

Whichever SPI I end up using, I then need to shift all the code into a library, so it's easier to include in your own sketches.
Martin
Posts: 577
Joined: 16 Feb 2018, 14:11
Location: Warwickshire

Re: FrSky V8 transmitter module using Arduino and CC2500

Post by Martin »

The FrSkyV8Tx library lives! But I'm doing more code tidying, tests, documentation, and example sketches before I release it to you guys for (hopefully) further testing and feedback.

It uses the Arduino chip's hardware SPI, which means the CC2500 has to be connected to pins 11, 12, 13, plus a chip select pin you choose (I suppose pin 10, usually). The advantage is that hardware SPI takes up less processor time. The only possible disadvantages I can see are:
  • Pin 13 is the on-board LED on Arduinos - so you can't use the on-board LED for flashing status codes.
  • If you use a USBasp or other non-serial programmer, that also connects to the SPI pins. I've tested that you can upload sketches that way with the CC2500 connected, but if you want to do that, you must use a 3.3V USBasp. Of course, you should do that anyway, even when the 2500 is connected to different pins, or disconnect the CC2500 while the programmer is connected.
  • If you want to connect some other SPI device in your transmitter - for example, certain types of graphic display modules - then you need to be careful. It's certainly possible to have several SPI devices connected to the same SPI port, providing each device has its own chip select pin. But the timing of accesses to the CC2500 is pretty critical (the library 'speaks' to the CC2500 every nine milliseconds), so any other SPI devices must not tie up the interface for more than a few milliseconds at a time.
I could re-introduce bit-banged SPI (on any chosen pins) if you guys can convince me it's a good idea.

It works on 8MHz Arduinos as well as 16MHz ones, which has the benefit that you can use a 3.3V Pro Mini, with its built-in 3.3V regulator to power everything.

Trim pot tuning works fine!

Edit: I've thought of a way of getting the on-board LED to still operate, even though the pin is also used for SPI. I'll put it on the list of things to do, but it's not high priority.

Another edit: Did you know that FrSky V8 protocol only uses 15-bit IDs ? With the normal, random IDs, this means that if just two fliers are using V8 transmitters together, there's a 1 in 32768 chance they will interfere - and if you have 100 club members all with V8 transmitters, the chances of interference between at least two members rises to 14% :shock:
Last edited by Martin on 04 Nov 2020, 01:04, edited 1 time in total.
Martin
Posts: 577
Joined: 16 Feb 2018, 14:11
Location: Warwickshire

Re: FrSky V8 transmitter module using Arduino and CC2500

Post by Martin »

Considerable progress made! I've got a few example sketches bundled with the library:
  • The one you see working in the video below: it acts as a transmitter module from a CPPM signal, with optional fine tune pot, bind button and range test button.
  • Another is a very simple transmitter sketch using four analogue inputs from pots to drive the first four channels,
  • A third is a 'bare minimum' sketch, that only has about five lines of code - to demonstrate the minimum you need to get the library working and linking to your receiver.
  • I could bundle a single channel version or more complete 'propo' version as other examples.


Martin
Posts: 577
Joined: 16 Feb 2018, 14:11
Location: Warwickshire

Re: FrSky V8 transmitter module using Arduino and CC2500

Post by Martin »

I've attached the library, and a documentation .pdf to the opening post now. Feedback from beta testers will be appreciated. :)
AndyS
Posts: 41
Joined: 12 Oct 2018, 19:03
Location: Biggleswade

Re: FrSky V8 transmitter module using Arduino and CC2500

Post by AndyS »

Many thanks for this Martin, I have been keenly waiting for a trial version.

I did manage to get my Frsky only arduino module working but initially would not bind. I also was unable to get the version which selected the fine tuning to work either.

Finally have managed to get my setup to bind and used the the long method(change config each time) to find the the fine tuning value.

My set up used a diymore Strong and a low power CC2500 with ppm and battery supply from a Taranis. Voltage reduced by by a 3.3v supply module. Today I tried unsuccessfully to use a Pro mini, which should have worked but maybe a suspect one.

Will definitely use your code and report how I get on.
AndyS
Posts: 41
Joined: 12 Oct 2018, 19:03
Location: Biggleswade

Re: FrSky V8 transmitter module using Arduino and CC2500

Post by AndyS »

I have tried the cppm version on a diymore strong arduino board.

Had no problem getting a output from the CC2500 (as viewed on scannner).

Also no problems getting a bind (I set the fine tuning -25 which was best for the CC2500).

PPM pulses are coming from the PPM output in the Taranis Module bay (good pulse train viewed on scope).

But no servo response on any channel.

Tried switching PPM input to pin 3 (changed sketch appropriately).

Also tried another Arduino board without any change.

Cannot work out what I am doing wrong.
Martin
Posts: 577
Joined: 16 Feb 2018, 14:11
Location: Warwickshire

Re: FrSky V8 transmitter module using Arduino and CC2500

Post by Martin »

AndyS wrote: 06 Nov 2020, 11:39 I have tried the cppm version on a diymore strong arduino board.

Cannot work out what I am doing wrong.
Do you have a serial interface connected to the board? That's what I'm using to power my board and upload, so I can also use it for debugging. If you're using a USBasp or similar, can you connect a serial interface too? As with any other connection at the same time as a CC2500, make sure it's a 3.3V one!

If you have a working serial connection, try enabling SERIAL_DATA (remove // from the #define on line 48) I recommend leaving the baud rate at 115200
Then in Arduino IDE, open up the Serial monitor (from Tools menu, or Ctrl-Shift-M ) and set the baud to 115200. It displays your Arduino clock speed once and then prints a line of data twice per second. If you don't have a valid cppm signal going into pin 2, you should see this:

Code: Select all

Clock speed: 8000000
Channels: 0: (3000:0) Tuning: 0  Power: full
Channels: 0: (3000:0) Tuning: 0  Power: full
Channels: 0: (3000:0) Tuning: 0  Power: full
Channels: 0: (3000:0) Tuning: 0  Power: full
Channels: 0: (3000:0) Tuning: 0  Power: full
Channels: 0: (3000:0) Tuning: 0  Power: full
Channels: 0: (3000:0) Tuning: 0  Power: full
The numbers in the parentheses are the minimum and maximum microsecond intervals the code has 'seen' for the first channel of the cppm signal. The code defaults the minimum to 3000 and the maximum to 0 at startup, so until it's seen a valid signal it will display as shown above.

Once you get a valid signal, it should look similar to this:

Code: Select all

Clock speed: 8000000
Channels: 8: 1547 1544 1922 1560  999 1690 1680 1532 (1544:1547) Tuning: 0  Power: full
Channels: 8: 1547 1546 1920 1560 1000 1689 1680 1534 (1542:1547) Tuning: 0  Power: full
Channels: 8: 1545 1546 1922 1559 1000 1690 1679 1533 (1542:1547) Tuning: 0  Power: full
Channels: 8: 1545 1546 1922 1560  999 1691 1679 1534 (1542:1547) Tuning: 0  Power: full
Channels: 8: 1545 1546 1921 1560 1000 1689 1680 1533 (1542:1547) Tuning: 0  Power: full
Channels: 8: 1544 1546 1921 1560  999 1690 1680 1533 (1542:1547) Tuning: 0  Power: full
Channels: 8: 1545 1546 1921 1560 1000 1689 1680 1533 (1542:1559) Tuning: 0  Power: full
If your cppm signal has fewer than 8 channels it will display just those. If you have more than 8, then it ignores any channels after the 8th one.

If you don't have a serial monitor available, I recommend this tiny sketch that will show if your Arduino is receiving a changing signal on pin 2. It looks for a change and flashes the built in LED when changes are occurring. You need the delay, because if you just copy pin2 to pin13, a genuine cppm signal changes so fast that it looks like the LED is permanently on. You'd see it with an oscilloscope, of course, if you have one.

Code: Select all

void setup() {
  pinMode(2, INPUT_PULLUP); // cppm in
  pinMode(13, OUTPUT); // built-in LED
}

void loop() {
  static int previousState;
  int state = digitalRead(2);
  if (state != previousState) {
    digitalWrite(13, state);
    delay(100);
    previousState = state;
  }
}
If you are getting a flashing LED with that test sketch, but my cppm sketch still doesn't see it, maybe it's down to the timing of your cppm signal? My sketch looks for a marker pulse interval > 3000 microseconds to indicate end of frame (in the sketch at line 164). You could try altering that down to about 2100 - but not much lower because the valid range for in-frame pulses is nominally about 988 to 2012 microseconds.
Last edited by Martin on 06 Nov 2020, 12:39, edited 4 times in total.
Martin
Posts: 577
Joined: 16 Feb 2018, 14:11
Location: Warwickshire

Re: FrSky V8 transmitter module using Arduino and CC2500

Post by Martin »

Phil_G wrote: 06 Nov 2020, 11:48 Does this module look ok, 100mw screened, £10 for a pair:
https://www.aliexpress.com/item/32810604349.html

Ta
Phil
Looks okay to me, Phil. But that link shows (for me) as only one left at US $12.98, and $6.91 shipping. :cry:

You can probably find cheaper options - though you may need to buy the antenna (and pigtail if required) separately.
AndyS
Posts: 41
Joined: 12 Oct 2018, 19:03
Location: Biggleswade

Re: FrSky V8 transmitter module using Arduino and CC2500

Post by AndyS »

Still not having luck here with this.

Set up for serial monitor ok but no indication of channel ppm input with either Taranis or A Phil G encoder input.

3 attached pics show a good bind to the CC2500, a good 2.4GHz output on scanner and a good ppm pulse train input to arduino.

Scope settings are 200 microsecs/cm (giving a pulse frame duration of 1800 microsecs) and 1v per cm pulse amplitude (2.5v pulse).

Scope shows pulse width variation with pot movement but no movement of servos on receiver.
D573077F-2CCA-4F74-B595-7FF9DD1D640B.jpg
E1D0DF6D-698B-43AE-9684-95AFB7363FD5.jpg
82A99679-659A-4D4F-B118-930CB069F47A.jpg
Post Reply