New Hubsan Upgraded Version on the way

More
01 Jan 2014 12:34 - 01 Jan 2014 12:49 #17627 by goebish
Replied by goebish on topic New Hubsan Upgraded Version on the way
I confirm I found (and fixed) what was fishy in A7105_ReadReg()

PhracturedBlue wrote: The MCU is running at 72MHz, so 20 nops should be plenty to guarantee a single read occurs, but maybe something screwy is going on here.


Actually this is plenty, this is even too much at times :), it lasts more than 20 cycles because the nop instruction is in a for loop (unless you tell the compiler to unroll loops, but I think that's not the case).

for(i = 0; i < 20; i++)  //Wait > 1 SPI clock (but less than 8).  clock is 4.5MHz
    asm volatile ("nop");

Change 20 to 10 and the problem is gone...
This also explains why the Hubsan4 protocol wouldn't bind sometimes.

Time to cleanup my code and create a pull request with working telemetry :)

edit: oh of course I need 1 or 2 testers to check if everything is fine before I create a pull request.
Last edit: 01 Jan 2014 12:49 by goebish.

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

More
01 Jan 2014 13:02 #17628 by goebish
Replied by goebish on topic New Hubsan Upgraded Version on the way
YOU KNOW WHAT ????

I found the H107L has voltage telemetry too !!!
I guess probably every Hubsan products has telemtry !

I'll have to dump the frames because it looks like there are not only telemetry frames received but other packets in which packet[13] is not the voltage value.

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

More
01 Jan 2014 13:23 #17629 by SeByDocKy
Replied by SeByDocKy on topic New Hubsan Upgraded Version on the way

goebish wrote: YOU KNOW WHAT ????

I found the H107L has voltage telemetry too !!!
I guess probably every Hubsan products has telemtry !

I'll have to dump the frames because it looks like there are not only telemetry frames received but other packets in which packet[13] is not the voltage value.



Great great ;) very good news :)

And what about the RSSI ? :)

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

More
01 Jan 2014 13:25 #17630 by goebish
Replied by goebish on topic New Hubsan Upgraded Version on the way
Yeah !

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

More
01 Jan 2014 13:28 - 01 Jan 2014 13:28 #17631 by goebish
Replied by goebish on topic New Hubsan Upgraded Version on the way

SeByDocKy wrote: And what about the RSSI ? :)


We could read the Hubsan to TX RSSI but I think that would not be relevant.
Last edit: 01 Jan 2014 13:28 by goebish.

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

More
01 Jan 2014 14:31 #17632 by midelic
Replied by midelic on topic New Hubsan Upgraded Version on the way
Congratulations!

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

More
01 Jan 2014 15:01 #17638 by goebish
Replied by goebish on topic New Hubsan Upgraded Version on the way
Thanks !

goebish wrote: looks like there are not only telemetry frames received but other packets in which packet[13] is not the voltage value.


Actually I only had to check for packets integrity (crc), no more fancy values :)

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

More
01 Jan 2014 15:04 #17639 by PhracturedBlue
Replied by PhracturedBlue on topic New Hubsan Upgraded Version on the way

goebish wrote: I confirm I found (and fixed) what was fishy in A7105_ReadReg()

PhracturedBlue wrote: The MCU is running at 72MHz, so 20 nops should be plenty to guarantee a single read occurs, but maybe something screwy is going on here.


Actually this is plenty, this is even too much at times :), it lasts more than 20 cycles because the nop instruction is in a for loop (unless you tell the compiler to unroll loops, but I think that's not the case).

for(i = 0; i < 20; i++)  //Wait > 1 SPI clock (but less than 8).  clock is 4.5MHz
    asm volatile ("nop");

Change 20 to 10 and the problem is gone...
This also explains why the Hubsan4 protocol wouldn't bind sometimes.

Well, that isn't good. The problem is that I have no control of the compiler, so it could vary from compiler to compiler. the only safe thing to do is to put the entire sequence into assembly to guarantee consistency on all compiler versions.

Time to cleanup my code and create a pull request with working telemetry :)

edit: oh of course I need 1 or 2 testers to check if everything is fine before I create a pull request.[/quote]

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

More
01 Jan 2014 15:07 #17640 by goebish
Replied by goebish on topic New Hubsan Upgraded Version on the way

PhracturedBlue wrote: The problem is that I have no control of the compiler, so it could vary from compiler to compiler. the only safe thing to do is to put the entire sequence into assembly to guarantee consistency on all compiler versions.


OK, I'll look at the required number of nop() instructions and remove this for loop, so it's fixed for every compilers.

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

More
01 Jan 2014 15:22 - 01 Jan 2014 15:23 #17642 by goebish
Replied by goebish on topic New Hubsan Upgraded Version on the way
I didn't count the precise number of required nop, but:

// Wait > 1 SPI clock (but less than 8).  clock is 4.5MHz
asm volatile ("nop\n\tnop\n\tnop\n\tnop\n\tnop\n\t"
              "nop\n\tnop\n\tnop\n\tnop\n\tnop\n\t"
              "nop\n\tnop\n\tnop\n\tnop\n\tnop\n\t"
              "nop\n\tnop\n\tnop\n\tnop\n\tnop");

does the trick.
Last edit: 01 Jan 2014 15:23 by goebish.

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

More
01 Jan 2014 16:40 #17647 by goebish
Replied by goebish on topic New Hubsan Upgraded Version on the way
Here are test versions, telemetry should work at least with H107L & H107D, no idea for other models, but this shouldn't break anything anyway.

Devo 7e:
speedy.sh/gvn2d/deviation-devo7e-Unknown.zip

Devo 8s:
speedy.sh/2w4uY/devo8.dfu

Devo 10:
speedy.sh/5HUN8/devo10.dfu

Please report :)

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

More
01 Jan 2014 17:38 #17649 by SeByDocKy
Replied by SeByDocKy on topic New Hubsan Upgraded Version on the way
Not working for the H102D but it was at 99% normal coz I guess the voltage monitoring was not implemented. More, it's using a 2S LiPo ....

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

More
01 Jan 2014 17:41 - 01 Jan 2014 17:43 #17651 by goebish
Replied by goebish on topic New Hubsan Upgraded Version on the way
yup, probably it doesn't have telemetry.

2S isn't a problem, 25.5V max. can be reported, should even work with 6S (25.2V when full) ;)
Last edit: 01 Jan 2014 17:43 by goebish.

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

More
01 Jan 2014 17:47 #17653 by SeByDocKy
Replied by SeByDocKy on topic New Hubsan Upgraded Version on the way

goebish wrote: yup, probably it doesn't have telemetry.

2S isn't a problem, 25.5V max. can be reported, should even work with 6S (25.2V when full) ;)


Anyway, it was at least binding without any problem. What's a pity you don't have a H107C ... to also include the record button ...

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

More
01 Jan 2014 17:49 #17654 by goebish
Replied by goebish on topic New Hubsan Upgraded Version on the way
Are you sure video recording can be enabled with a radio button on the H107C ?
I thought it was only a button on the quad ?

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

More
01 Jan 2014 17:49 - 01 Jan 2014 17:52 #17655 by vlad_vy
Replied by vlad_vy on topic New Hubsan Upgraded Version on the way
It works with Devo8 and H107C, but background always red (Telemetry monitor), on Main page the telemetry box also is always red and value not changed. Something wrong with telemetry update function.

With H107 it also works, but value very frequently alternate between 0.2V and 3.8V.
Last edit: 01 Jan 2014 17:52 by vlad_vy.

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

More
01 Jan 2014 17:53 #17656 by SeByDocKy
Replied by SeByDocKy on topic New Hubsan Upgraded Version on the way

goebish wrote: Are you sure video recording can be enabled with a radio button on the H107C ?
I thought it was only a button on the quad ?


Probably you are right... I don't own a H107C ...
So only H101, H102, H201, H202, and all fpv planes with former TX can do that...

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

More
01 Jan 2014 17:56 - 01 Jan 2014 17:58 #17657 by goebish
Replied by goebish on topic New Hubsan Upgraded Version on the way

vlad_vy wrote: It works with Devo8 and H107C, but background always red (Telemetry monitor), on Main page the telemetry box also is always red and value not changed. Something wrong with telemetry update function.

With H107 it also works, but value frequently alternate between 0.2V and 3.8V.


Thanks for reporting, that's probably because I never call TELEMETRY_SetUpdated() :blush: just saw it in devo.c telemetry code.
This is the first time I have a machine with telemetry, I didn't know if it was normal or not that it has a black background on the voltage value (Devo 10).

No idea why it alternates between 0.2V and 3.8V on the H107, I don't have this issue with the H107L, will have to wait for more reports.
Last edit: 01 Jan 2014 17:58 by goebish.

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

More
01 Jan 2014 18:08 #17658 by vlad_vy
Replied by vlad_vy on topic New Hubsan Upgraded Version on the way

goebish wrote: No idea why it alternates between 0.2V and 3.8V on the H107, I don't have this issue with the H107L, will have to wait for more reports.


I think that for H107 only one from two telemetry frames has the real voltage.

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

More
01 Jan 2014 18:17 - 01 Jan 2014 18:18 #17660 by goebish
Replied by goebish on topic New Hubsan Upgraded Version on the way
Yup, I check if the packet is beginning with 0xe0 or 0xe1, maybe I should check only one.

Can you try this one please ?
(extracts 0xe0 packets only + telemetry update fixed)

Devo 8s:
speedy.sh/9xux7/devo8.dfu
Last edit: 01 Jan 2014 18:18 by goebish.

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

Time to create page: 0.117 seconds
Powered by Kunena Forum