hackrf icon indicating copy to clipboard operation
hackrf copied to clipboard

Hardware sync between multiple HackRFs works only the first time after reset

Open barto- opened this issue 7 years ago • 7 comments

Steps to reproduce

  1. Record a signal with hardware sync enabled
$ hackrf_transfer -r rx1.bin -H 1 | hackrf_transfer -r rx2.bin -H 1
  1. Repeat step 1
  2. Reset both HackRFs and repeat step 1

Expected behaviour

The recordings should be synchronised after step 1, step 2, and step 3

Actual behaviour

The recordings are not synchronised after step 2. Hardware synchronisation appears to be working only once after reset. Is it possible that a buffer somewhere contains rubbish from the previous recording?

┆Issue is synchronized with this Basecamp todo by Unito

barto- avatar Sep 25 '17 14:09 barto-

Yes, it's entirely possible that we aren't resetting the buffers when we stop receiving.

dominicgs avatar Sep 25 '17 16:09 dominicgs

Do you have any suggestions on where I should start looking?

barto- avatar Sep 26 '17 09:09 barto-

I've had a look, and I think the only thing we don't reset when we change to TRANSCEIVER_MODE_OFF is the USB bulk buffer pointer

The pointer is used by the SGPIO interrupt handler to know where the samples should be written. It's also used when scheduling the USB transfers. It's possible that if we start with it in the second buffer, we'll transfer the first (with junk data) to the host.

I think the right thing to do is to reset the pointer when we change the transceiver state.

dominicgs avatar Sep 26 '17 14:09 dominicgs

You could try this commit: https://github.com/mossmann/hackrf/pull/408/commits/15d67a7ea8a76dbf8ec0e42c6f5f91bec6a3d77b

The branch that I've been working on has some broken functionality, so I would advise taking that commit, but not the rest of it.

dominicgs avatar Sep 26 '17 14:09 dominicgs

Thank you for your help @dominicgs . I've tried your commit without success. There must be something else...

barto- avatar Sep 27 '17 15:09 barto-

I'm not sure where else to look, but I'd like to find this. It seems to me the issue is not resetting all of our state when we switch transceiver state.

dominicgs avatar Sep 27 '17 20:09 dominicgs

It would be good to retest this one. After all the work in #707, #982 and #1045 I would be very surprised if there is anything still wrong.

martinling avatar Mar 18 '22 03:03 martinling

This is indeed fixed. Thanks, @martinling!

mossmann avatar Sep 15 '22 11:09 mossmann