- Posts: 2631
New Hubsan Upgraded Version on the way
- goebish
- Offline
- I Void Warranties
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.
Please Log in or Create an account to join the conversation.
- goebish
- Offline
- I Void Warranties
- Posts: 2631
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.
- SeByDocKy
- Offline
- Posts: 1016
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.
- goebish
- Offline
- I Void Warranties
- Posts: 2631
Please Log in or Create an account to join the conversation.
- goebish
- Offline
- I Void Warranties
- Posts: 2631
SeByDocKy wrote: And what about the RSSI ?
We could read the Hubsan to TX RSSI but I think that would not be relevant.
Please Log in or Create an account to join the conversation.
- midelic
- Offline
- Posts: 174
Please Log in or Create an account to join the conversation.
- goebish
- Offline
- I Void Warranties
- Posts: 2631
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.
- PhracturedBlue
- Offline
- Posts: 4402
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.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.
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.
- goebish
- Offline
- I Void Warranties
- Posts: 2631
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.
- goebish
- Offline
- I Void Warranties
- Posts: 2631
// 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.
Please Log in or Create an account to join the conversation.
- goebish
- Offline
- I Void Warranties
- Posts: 2631
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.
- SeByDocKy
- Offline
- Posts: 1016
Please Log in or Create an account to join the conversation.
- goebish
- Offline
- I Void Warranties
- Posts: 2631
2S isn't a problem, 25.5V max. can be reported, should even work with 6S (25.2V when full)
Please Log in or Create an account to join the conversation.
- SeByDocKy
- Offline
- Posts: 1016
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.
- goebish
- Offline
- I Void Warranties
- Posts: 2631
I thought it was only a button on the quad ?
Please Log in or Create an account to join the conversation.
- vlad_vy
- Offline
- Posts: 3333
With H107 it also works, but value very frequently alternate between 0.2V and 3.8V.
Please Log in or Create an account to join the conversation.
- SeByDocKy
- Offline
- Posts: 1016
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.
- goebish
- Offline
- I Void Warranties
- Posts: 2631
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() 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.
Please Log in or Create an account to join the conversation.
- vlad_vy
- Offline
- Posts: 3333
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.
- goebish
- Offline
- I Void Warranties
- Posts: 2631
Can you try this one please ?
(extracts 0xe0 packets only + telemetry update fixed)
Devo 8s:
speedy.sh/9xux7/devo8.dfu
Please Log in or Create an account to join the conversation.
- Home
- Forum
- Development
- Protocol Development
- New Hubsan Upgraded Version on the way