scateu / kalibrate-hackrf

kalibrate for hackrf
BSD 2-Clause "Simplified" License
267 stars 78 forks source link

Which HackRF Firmware? #2

Open robotastic opened 9 years ago

robotastic commented 9 years ago

Which version of the HackRF firmware does this support? The original version for the jawbreaker had unsigned output and the newer version that supports the HackRF One has signed output.

I have the Jawbreaker and haven't upgraded yet. I can't seem to get Kalibrate to work, so I am wondering if it is an issue with my firmware version.

ckuethe commented 9 years ago

I haven't made any changes to support recent HackRF firmware, so it probably assumes old format data. Thanks for pointing this out; I'll have a look.

rxseger commented 8 years ago

This may be the same problem encountered when porting dump1090 from rtlsdr to hackrf (in what is now dump1090_sdrplus):

http://hackrf-dev.greatscottgadgets.narkive.com/4mLdz4BJ/adding-hackrf-support-to-dump1090

Donald Pupecki 12 months ago I don't believe hackrf_transfer and rtl_sdr output in the same format. They are both 8 bit but the hackrf output is signed whereas the rtl output is unsigned.

If you get this working a hackrf please post the port on github or somewhere as that would be sweet.

Ilker Temir 12 months ago Thanks! signed to unsigned conversion was the culprit. I first tested it with cox by converting the file and then tweaked my code to do that within the receive path.

https://github.com/itemir/dump1090_sdrplus/commit/f02a8cf544928931c2b94da57c1be67eac52908f#diff-4844415e789781b82d79d4819e97d461R478

rxseger commented 8 years ago

A stab in the dark, but if I make this change:

diff --git a/src/usrp_source.cc b/src/usrp_source.cc
index 4a80657..75965a3 100644
--- a/src/usrp_source.cc
+++ b/src/usrp_source.cc
@@ -295,6 +295,11 @@ hackrf_rx_callback (hackrf_transfer * transfer)
   //  cout << transfer->valid_length  << " " << hackrf_rx_count << " " << bytes_to_write << "\n";
   if (bytes_to_write != 0)
     {
+      /* HackRF One returns signed IQ values, convert them to unsigned */
+      for (uint32_t i = 0; i < bytes_to_write;  i++) {
+        transfer->buffer[i] ^= (uint8_t)0x80;
+      }
+
       memcpy (u->ubuf + u->hackrf_rx_count, transfer->buffer, bytes_to_write);
       //    for (size_t i=0; i<bytes_to_write; i++) {
       //      hackrf_rx_buf[hackrf_rx_count+i] = transfer->buffer[i];

it has no discernible effect (still get about +19 ppm with channel 995, -35 ppm with 993). Same results with 2014.08.1 and 2015.07.2 firmware.

@robotastic Could you elaborate (sorry its been a while, if you remember), how did kalibrate-hackrf not work for you? Were you seeing inconsistent offsets on different channels as I am, or was it something else?