greatscottgadgets / hackrf

low cost software radio platform
https://greatscottgadgets.com/hackrf/
GNU General Public License v2.0
6.56k stars 1.53k forks source link

HackRF r9 how to tell when external clock is in use #1301

Closed mjcuc closed 1 year ago

mjcuc commented 1 year ago

What would you like to know?

In hardware version r9 Si5351c was replace with Si5351a and u16 switch. How to enable clkin and is there a way to check by software that external clock/tcxo is in use? Any software version requirements?

martinling commented 1 year ago

For r9 you want the 2023.01.1 software release. You can use hackrf_clock -i to check the CLKIN status.

mjcuc commented 1 year ago

Ok, thanks. Firmware seems to be up to date, I'll compile client side also later today.

I don't have clear understanding what controls the u16 switch (which selects between internal and external clock in r9) . In schematics u16 seems to be connected to logic. Does this require running a client command or how does it work?

mossmann commented 1 year ago

U16 is controlled by the microcontroller automatically. Whenever a transceiver operation (RX or TX) starts, the microcontroller checks to see if clock input is detected (the same status you can inspect with hackrf_clock -i) and switches to the external clock if it is detected or to the internal clock if an external clock is not detected. This behavior is the same on all hardware revisions, but the switching and detection methods vary.

mjcuc commented 1 year ago

Ok, thank you very much for explaining.

All software is now at latest version, but the txco-module I got online (advertized as hackrf compatible..) is not recognized by hackrf clock -i. Could I just have a problem with the module. If I read schematics and chip datasheets correctly, CMOS levels are expected, but the module outputs ~1,25V when probed by scope. Simply a compatibility issue?

I just ordered another module from a EU supplier.

martinling commented 1 year ago

Yes, unfortunately there are some TCXO modules out there which are not compatible since they do not output the necessary voltage. We've always specified that a 3.3.V signal is required. Some modules were apparently being sold that didn't provide enough voltage, yet worked by chance with earlier HackRF One revisions. We've been contacting manufacturers to make them aware of the issue, so do let us know which ones you have trouble with.

mjcuc commented 1 year ago

Here is a picture of the module verified not compatible: txco

This is the new one that I ordered from EU supplier: https://www.nooelec.com/store/tiny-tcxo.html

Maybe I hesitated a bit since according to some reviews this nooelec module would be outputting only 1.8V which is also too low level. Oh well, I might as well test it myself since it is in delivery and just hope the best.

mjcuc commented 1 year ago

Now it is confirmed that tiny TCXO module from nooelec doesn't work either. Output level is same as in the previous module.

I guess these modules used to work with previous hardware versions by chance?

straithe commented 1 year ago

Yes, @martinling's comment above addresses that: https://github.com/greatscottgadgets/hackrf/issues/1301#issuecomment-1492878894

mjcuc commented 1 year ago

It seems that this is a real world difference if you compare hackrf newest r9 with the older Si5351c based version, where clkin is connected directly to the chip. But as commented earlier, hackrf has always expected cmos level square wave and therefor this feature is ok.

Can you give a hint about tcxoe module known to work?

straithe commented 1 year ago

I do not personally have this information. I believe that as long as 3.3 V is met, most TCXOs should work.

mjcuc commented 1 year ago

I just confirmed that the following TCXO is recognized with hackrf_clock -i: https://www.aliexpress.com/item/4000181103275.html

Nothing wrong with your device, it is working well. Thank you for the support and you can close this as solved.

jLynx commented 1 year ago

Yes, unfortunately there are some TCXO modules out there which are not compatible since they do not output the necessary voltage. We've always specified that a 3.3.V signal is required. Some modules were apparently being sold that didn't provide enough voltage, yet worked by chance with earlier HackRF One revisions. We've been contacting manufacturers to make them aware of the issue, so do let us know which ones you have trouble with.

@martinling I'm just trying to find in the datasheet where it specifies it needs to be 3v3 https://cdn-shop.adafruit.com/datasheets/Si5351.pdf

Are you able to point me to the page?

martinling commented 1 year ago

@jLynx

I wasn't referring to the Si5351, but rather to the CLKIN requirements specified in the documentation for HackRF One:

https://hackrf.readthedocs.io/en/latest/external_clock_interface.html

We've always specified that the CLKIN signal to HackRF One should be a 3V or 3.3V square wave at 10MHz.

On earlier HackRF One revisions, it happened to be the case that the CLKIN input went directly to the external clock input of the Si5351C. In practice the Si5351C would accept clock signals at considerably lower voltages, but this was not behaviour we've ever specified or guaranteed for HackRF One.

On r9, the CLKIN input is handled differently. The Si5351A does not have an external clock input. We use a switch that allows the CLKIN input to be connected to the input port of the crystal oscillator circuit, along with some additional supporting circuitry to detect the presence of the external clock.

Both versions of the design work correctly when provided with a 3-3.3V clock input as specified. The r9 version is less tolerant of clock signals which are below that level, and this has revealed problems with some TCXO modules on the market that were not following the spec.

mjcuc commented 1 year ago

CLKIN voltage specs are also shown in the the block diagrams on this page (r1-r8 vs r9): https://hackrf.readthedocs.io/en/latest/hardware_components.html

Full details are found in the schematics pdf file, which is included in the release zip.

I can confirm that my HackRF r9 has been working just fine when mated with a proper clock module.

straithe commented 1 year ago

CLKIN voltage specs are also shown in the the block diagrams on this page (r1-r8 vs r9): https://hackrf.readthedocs.io/en/latest/hardware_components.html

Full details are found in the schematics pdf file, which is included in the release zip.

I can confirm that my HackRF r9 has been working just fine when mated with a proper clock module.

This is good feedback to hear. Do you mind sharing which clock module you bought? I want to test a few out.

jLynx commented 1 year ago

Thanks for clarifying why the older revision they work and the reason why they don't work on the R9 @martinling

Yeah it would be great if you could provide info on the working TCXO @mjcuc.

I'm currently working with a manufacturer trying to get this resolved so we have at least one PP TCXO that works with the R9

mjcuc commented 1 year ago

I got a working one from the shop https://www.aliexpress.com/item/4000181103275.html on April. Not sure if I would be as lucky if I ordered it today.

Back then, I also tried to find 3V3 square wave output -version of the clock chips used in those tiny incompatible modules. I found some promising modules from global distributors, but they couldn't be used as direct replacement and I didn't have time make a PCB for them.

Please let me know if you can work out an officially recommended module, I'll be happy to buy one!