BTLE icon indicating copy to clipboard operation
BTLE copied to clipboard

Print absolute raw bits 1,0s no parsing

Open EdwinFairchild opened this issue 2 years ago • 8 comments

  1. Who are you? Application Engineer
  2. What is your own modification (if any)? None
  3. Environments: OS type/version, BTLE repo branch and commit revision Ubuntu Latest. BTLE main branch
  4. Board/hardware type HACKRF
  5. Detailed commands/steps to reproduce the issue, and the related error message, screenshot, etc NONE
  6. Your debug efforts and results (if any) NA
  7. Any other thing we need to know for helping you better? NA

This is not an issues, but you do not have discussions enabled, so I will ask my question here. Question 1. How would I modify your code in order to be able to print a bit stream of BLE traffic , absolute zero parsing ?. Or for more general purpose, how can I print the bits of what ever rf signal hackrf is giving me. ? Essentialy I am trying to demodulate a signal very similar to BLE and I need to see the raw data to make sure we are transmitting properly. Your work here seems like it can do the job I am just unsure how to do so. Question 2. I noticed the -r flag for btle_rx but is that really absolute raw? or are you parsing header and aa because is see it displayed there.?

EdwinFairchild avatar Jul 27 '22 15:07 EdwinFairchild

You can print the bit decision here: https://github.com/JiaoXianjun/BTLE/blob/5fbbead53c5758a9042f55fed80d7c0780d10ef1/host/btle-tools/src/btle_rx.c#L1382

JiaoXianjun avatar Jul 27 '22 16:07 JiaoXianjun

I went to demod_byte and I am printing 1,0s from there but I am not sure if this is indeed demodulaating the entirety of the signal or if something else is being stripped from the signal

void demod_byte(IQ_TYPE* rxp, int num_byte, uint8_t *out_byte) {
  int i, j;
  int I0, Q0, I1, Q1;
  uint8_t bit_decision;
  int sample_idx = 0;
  
  for (i=0; i<num_byte; i++) {
    out_byte[i] = 0;
    for (j=0; j<8; j++) {
      I0 = rxp[sample_idx];
      Q0 = rxp[sample_idx+1];
      I1 = rxp[sample_idx+2];
      Q1 = rxp[sample_idx+3];
      bit_decision = (I0*Q1 - I1*Q0)>0? 1 : 0;
      out_byte[i] = out_byte[i] | (bit_decision<<j);

      sample_idx = sample_idx + SAMPLE_PER_SYMBOL*2;
      printf("%d",bit_decision);
    }
  }
  printf("\r\n");
}

EdwinFairchild avatar Jul 27 '22 16:07 EdwinFairchild

Indeed, that is after the unique word hitting. You need to go to search_unique_bits function to understand how that works. That works for the raw streaming iq and tries to find the unique word in the the incoming raw iq.

JiaoXianjun avatar Jul 27 '22 16:07 JiaoXianjun

Thanks , I will look into it.

EdwinFairchild avatar Jul 27 '22 16:07 EdwinFairchild

Ok, @JiaoXianjun is there anyway I can get this level of data , bits of the entire packet. image Obviously this is done with an scope or signal analyzer. But could I accomplish this with your code ?

EdwinFairchild avatar Jul 27 '22 19:07 EdwinFairchild

Yes you can.

JiaoXianjun avatar Jul 27 '22 21:07 JiaoXianjun

I have accomplished to do this much. image I am not sure why I feel maybe there should be more data... ? but i could be wrong

EdwinFairchild avatar Jul 27 '22 22:07 EdwinFairchild

I am unsure on how to go about this, i just do not understand a lot of it. Specially the IQ things. I noticed some preamble things in your code but its commented out. and the array is huge so im guessing its not decoded. Any help would be welcomed and appareicated

EdwinFairchild avatar Jul 29 '22 20:07 EdwinFairchild