Flysky AFHDS 2A, protocol as used i10, i6, iT4,

More
01 Nov 2016 14:58 - 01 Nov 2016 16:40 #55583 by Appelmoesman
Replied by Appelmoesman on topic Flysky AFHDS 2A, protocol as used i10, i6, iT4,
I have not tried yet. Im not planning on using it. I have zero experience with telemetry and my devo7E
I understand why it might be important to get it to work though because although I use a 2:30sec timer to give me a rough estimate my 1600Mah Zippy 35C came down all puffed yesterday when filming the quick demo flight.
Goebish adviced me to get better batteries in the meantime! well you're right! for the zippy I pushed it too hard. my 1000mah 65C graphene and 1300mah 45C graphene get mildly warm but never puff. I use a 90000mah 18650 li-ion pack that I homebuild from scrap laptop battieries to charge in the field so I believe i should not complain Im really happy with my setup.
Last edit: 01 Nov 2016 16:40 by Appelmoesman.

Please Log in or Create an account to join the conversation.

More
01 Nov 2016 15:09 - 01 Nov 2016 15:10 #55584 by goebish
Note that telemetry for external sensors (eg pack voltage) is not implemented yet, I'll do it soon™
Last edit: 01 Nov 2016 15:10 by goebish.

Please Log in or Create an account to join the conversation.

More
01 Nov 2016 15:59 - 01 Nov 2016 16:02 #55585 by goebish

Appelmoesman wrote: my 1600Mah Zippy 35C came down all puffed yesterday


Your setup demands quite a bit of current actually, you should get some higher grade Li-Po packs (they cost twice as much and are heavier, but there's a reason), forget about Zippy ;)
Last edit: 01 Nov 2016 16:02 by goebish.

Please Log in or Create an account to join the conversation.

More
02 Nov 2016 22:06 #55629 by goebish
Ah, I see the latest cleanflight version has support for IBUS telemetry, I've to see how it works and make the data available in Deviation ...
github.com/cleanflight/cleanflight/releases/tag/v1.14.0

Please Log in or Create an account to join the conversation.

More
03 Nov 2016 08:30 #55635 by Fernandez
Replied by Fernandez on topic Flysky AFHDS 2A, protocol as used i10, i6, iT4,
Excellent Goebish, we all enjoy appreciate all of your work !!!
AFHDS 2a is very good and in my opinion toghether with Frsky on of the best price/performance choices for diy full range projects.......

Please Log in or Create an account to join the conversation.

More
03 Nov 2016 11:04 #55637 by povlhp
Source here
github.com/cleanflight/cleanflight/blob/...ain/telemetry/ibus.c

Can anybody tell me, how is it connected ? The Rx to the data out iBus port, and the Tx to the iBus sensor port ? The source clearly states not to connect Rx of the UART. Maybe because alreay used for data port ?
Code also talks about sent bytes coming back du to the conenction of Rx/tx at the iA6B.

Please Log in or Create an account to join the conversation.

More
03 Nov 2016 11:41 #55638 by plaisthos
Replied by plaisthos on topic Flysky AFHDS 2A, protocol as used i10, i6, iT4,
You need one UART with TX connected to the IBUS sensor port. You cannot use RX of that UART. (It does RX/TX multiplexing over one wire, just like FrsSky Smartport)

Please Log in or Create an account to join the conversation.

More
05 Nov 2016 01:03 - 05 Nov 2016 01:12 #55699 by joelones
I'm a noob and just installed the A7105 module and bound the Devo 7E with a FS-IA6B using ibus on the SP Racing F3 IO_2 port (not sure why I have to set UART3 to Serial RX in betaflight, but that's another story...) Using build a37ab0a found in this thread.

Concerning telemetry, from what I understand it connects like FrSky, right? So from the F3's TX (UART3/TX pin OR pin 6 form IO_2) to the IBUS sensor port, which is where exactly? Also is the Devo 7E capable of telemetry?

Please forgive me if this has been asked.
Last edit: 05 Nov 2016 01:12 by joelones.

Please Log in or Create an account to join the conversation.

More
05 Nov 2016 01:30 #55700 by goebish
Telemetry is not fully implemented in Deviation yet, it won't report the values sent by cleanflight, only RSSI & RX voltage.

Please Log in or Create an account to join the conversation.

More
05 Nov 2016 01:45 #55701 by joelones
I see. Thanks for your hard work, has the AFHDS 2A code been merged in the nightlies? I'm assuming a37ab0a is old by now.

Please Log in or Create an account to join the conversation.

More
11 Nov 2016 01:46 #55850 by Appelmoesman
Replied by Appelmoesman on topic Flysky AFHDS 2A, protocol as used i10, i6, iT4,
I just flashed SPracing f3 clone to Dshot 300 and Racerstar 30A esc's. works brilliant!
fpv.tv/x210-build/
Devo7E and TGYIa6C receiver (SBUS)
with acc off and BB off only 30% cpu use on 4K-4K

Please Log in or Create an account to join the conversation.

More
28 Nov 2016 23:27 #56356 by mclarenman01
Replied by mclarenman01 on topic Flysky AFHDS 2A, protocol as used i10, i6, iT4,
Thank you so much for your amazing work on this Goebish!

I have a FS-A8S and X6B on their way to me at the moment.

I will test them as soon as I get a chance and will let you know how they go :cheer:

Please Log in or Create an account to join the conversation.

More
29 Nov 2016 09:31 #56359 by ketsa
Interesting, that X6B has a battery voltage sensor for telemetry.

Please Log in or Create an account to join the conversation.

More
06 Dec 2016 09:17 #56579 by povlhp
Any progress on telemetry display ?
There is work going on at cleanflight, I have submitted a few data logs from using multiple sensors. At least on the iBus side, we get 1 measurement every 7ms or so (between data being sent over iBus ->FC).
They seem to have a type and a value.

For now I am fine with battery sensor, it is the most important. But would be nice to have support for more, including the custom stuff going into CleanFlight.

Please Log in or Create an account to join the conversation.

More
06 Dec 2016 18:20 #56603 by goebish
That's on my list, I already know how it works, only have to implement it ...
Hopefully I should have some free time for that by the end of the month.

Also, I think I know why telemetry page settings are not saved now.

Please Log in or Create an account to join the conversation.

More
06 Dec 2016 19:50 #56604 by qba667
I was working on telemetry of IBUS during last weeks. I think I can share with you other telemetry packet - this one able to handle variable length payload:

0xAC(byte) SENSOR_ID (byte) SENSOR_INDEX (byte) PAYLOAD_LENGTH (byte) PAYLOAD (n bytes) ...........
frame may contains number of sensors but total length can not exceed 28 bytes.

Please Log in or Create an account to join the conversation.

More
09 Dec 2016 22:32 - 09 Dec 2016 22:56 #56726 by qba667
I was working on telemetry of IBUS during last weeks. I think I can share with you other telemetry packet - this one able to handle variable length payload:

0xAC(byte) SENSOR_ID (byte) SENSOR_INDEX (byte) PAYLOAD_LENGTH (byte) PAYLOAD (n bytes) ...........
frame may contains number of sensors but total length can not exceed 28 bytes.
@goebish as you are the master of AFHDS 2A reversing I would like to ask you about opinion.
After some changes in RX - to avoid checking if TX support extended telemetry (packet AD probably) I was able to get my AC frame on SPI of TX - here we have BAAD F00D (I have send it from emulated sensor).
Without changes in RX - it ask TX all time with AD frame.

AD frame is constructed in following code:
if ( word_200005F0 )
      {
        *buffer = 0xADu;
        buffer[1] = (buffer[1] >> 7 << 7) | HIBYTE(word_200005F0) & 0xF | 0x80;
        buffer[2] = (unsigned int)HIBYTE(word_200005F0) << 25 >> 29;
        v7 = (unsigned __int8)(word_200005F0 - 6);
        buffer[3] = v7;
        v8 = HIBYTE(word_200005F2);
        buffer[4] = word_200005F2;
        buffer[5] = v8;
        switch ( v7 )
        {
          case 1:
            buffer[6] = dword_200005F4;
            break;
          case 2:
            v9 = BYTE1(dword_200005F4);
            buffer[6] = dword_200005F4;
            buffer[7] = v9;
            break;
          case 4:
            v10 = dword_200005F4;
            buffer[6] = dword_200005F4;
            buffer[7] = BYTE1(v10);
            buffer[8] = v10 >> 16;
            buffer[9] = BYTE3(v10);
            break;
        }
        word_200005F0 = 0;
      }
Memory fragment at (snapshot might be wrong - I can not attache debugger)

RAM:200005F0 word_200005F0 DCW 0
RAM:200005F2 word_200005F2 DCW 0xFA8A
RAM:200005F4 byte_200005F4 DCB 0

Structure is AD RXID (4bytes) TXID(4bytes) ...request data
Any ideas what can be requested?
Attachments:
Last edit: 09 Dec 2016 22:56 by qba667.

Please Log in or Create an account to join the conversation.

More
09 Dec 2016 22:38 #56727 by HappyHarry
Replied by HappyHarry on topic Flysky AFHDS 2A, protocol as used i10, i6, iT4,
maybe it wants G00D F00D instead ;)

Please Log in or Create an account to join the conversation.

More
09 Dec 2016 22:41 #56728 by goebish
... or some DEAD BEEF ;)

@qba667, sorry but I've no idea, I've not been into that yet.

Please Log in or Create an account to join the conversation.

More
09 Dec 2016 22:51 - 10 Dec 2016 12:33 #56729 by qba667
@goebish if I will find it out I will let you know. Until word_200005F0 is non 0 RX wont send any telemetry - even 2 byte one.
That is bug in RX. RX was never expecting such size of telemetry data.
sensors = 20000474
sensors[388]
0C A1 BA AD F0 0D BA AD F0 0D 8A FA
copy to 
sensors[372]
0C A1 BA AD F0 0D BA AD F0 0D 8A FA
What is 200005A8 
200005A8 = sensors + 378
sensors[372]	0C standard telemetry response byte 1
sensors[373]	A1 standard telemetry response byte 2
sensors[374]	BA standard telemetry response byte 3
sensors[375]	AD standard telemetry response byte 4	  
sensors[376]	F0 standard telemetry response byte 5
sensors[377]	0D standard telemetry response byte 6
sensors[378]	BA 200005A8 - we are starting to write to memory used by mode 4 (some 2 way communication - using sensors AD packets)
sensors[379]	AD
sensors[380]	F0
sensors[381]	0D
sensors[380]	8A
sensors[381]	FA
sensors[382]	+1
sensors[383]	+2
sensors[384]	+3
sensors[385]	+4
sensors[386]	+5
sensors[387]	+6
sensors[388]	conflict! overlap with DMA buffer
Max response payload size = 8+6 = 14 bytes 
If something was defined at 378 mode 4 was triggered - in this mode response from radio is being compared with structure of sensors packet.
It must be used by multi value sensors like altitude sensor CAT01 - it sends back 3 values. I have no such sensor to verify how it is working.
I would like to use another mode where I can push as much data as possible to TX.

The code for checking mode 4 looks like:
ad_resp_plus1 = *(_BYTE *)(ptr + 309);  // AD response + 1 send from radio
        if ( ad_resp_plus1 << 28 )
        {
          if ( (unsigned int)*(_BYTE *)(ptr + 309) << 25 >> 29 != 5 )
          {
            if ( (unsigned int)(ad_resp_plus1 << 25) >> 29 != 3 )
              goto LABEL_51;
            if ( *(_WORD *)(ptr + 372) != *(_WORD *)(ptr + 308) || *(_WORD *)(ptr + 374) != *(_WORD *)(ptr + 310) )// check if telemetry sensor matches AD packet
              goto LABEL_65;
            sizeOfSensorReponse = *(_BYTE *)(ptr + 372);
            if ( sizeOfSensorReponse == 7 )
            {
              if ( *(_BYTE *)(ptr + 376) != *(_BYTE *)(ptr + 312) )// compare 4th byte of sensor response with 4th byte of AD response
                goto LABEL_65;
            }
            else
            {
              if ( sizeOfSensorReponse != 8 )
              {
                if ( sizeOfSensorReponse == 10 && *(_DWORD *)(ptr + 376) == *(_DWORD *)(ptr + 312) )
                  goto LABEL_64;
LABEL_65:
                v23 = *(_BYTE *)(ptr + 10) + 1;
                goto LABEL_50;
              }
              if ( *(_WORD *)(ptr + 376) != *(_WORD *)(ptr + 312) )
                goto LABEL_65;
            }
LABEL_64:
            copiedResponse = *(_DWORD *)(ptr + 372);
            *(_DWORD *)(ptr + 384) = *(_DWORD *)(ptr + 376);// AD packet to send payload copy from sensor response
            *(_DWORD *)(ptr + 380) = copiedResponse;// AD packet payload to send
            v23 = 0;
LABEL_50:
            *(_BYTE *)(ptr + 10) = v23;
            *(_BYTE *)ptr = 3;
            goto LABEL_51;
          }                                     // in case when shifting resuts in 5
          sizeOfResponse = *(_BYTE *)(ptr + 372);
          if ( sizeOfResponse == 7 || sizeOfResponse == 8 || sizeOfResponse == 10 )
          {
            response_plus1 = *(_BYTE *)(ptr + 373);
            if ( (response_plus1 & 0xF) == (ad_resp_plus1 & 0xF)
              && (unsigned int)*(_BYTE *)(ptr + 373) << 25 >> 29 == 5
              && response_plus1 >> 7 == asSensor2
              && *(_WORD *)(ptr + 374) == *(_WORD *)(ptr + 310) )
            {
              goto LABEL_64;
            }
          }
          goto LABEL_65;
        }
        v18 = *(_DWORD *)(ptr + 4) + 1;
        *(_DWORD *)(ptr + 4) = v18;
        if ( v18 >= 0xA )
        {
LABEL_18:
          v11 = 3;
LABEL_32:
          *(_BYTE *)ptr = v11;
        }
LABEL_33:
        result = 0;
LABEL_34:
        *(_BYTE *)(ptr + 10) = result;
        break;
      default:
        goto LABEL_51;
    }
  }
  return result;
}
Last edit: 10 Dec 2016 12:33 by qba667.

Please Log in or Create an account to join the conversation.

Time to create page: 0.103 seconds
Powered by Kunena Forum