This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

IWR1443BOOST: CFAR Threshold format clarification

Part Number: IWR1443BOOST

I have issues with CFAR engine in IWR1443BOOST. I want to do peak detection on complex input data (to do log2 and magnitude inside the CFAR)

If I correctly understood from previous CFAR threads here, in that case, data format after magnitude and log2 operations in CFAR engine will be Q7.11.

Is that mean that threshold needs to be in Q11 format? So, in mmwDemo it was in Q9 format and it was 1024 so I need just to set it to 4096? 

In mmwDemo for xWR14xx before CFAR detection, log2 results from all virtual antennas are summed so does this sumation impacts the formula for

calculating detection threshold like in xWR16xx case (number of virtual antennas taken in consideration)? 

Best regards,

Predrag

  • Hi Predrag,

    In HWA, The CFAR_THRESH register specifies the threshold scaling factor. This is an 18-bit register whose value is used to either multiply or add to the ‘surrounding noise average’ to determine the threshold used for detection of the present cell under test. If logarithmic mode is disabled (in magnitude or magnitude-squared mode), then the register value is multiplied with the surrounding noise average to determine the threshold, else it is added to the surrounding noise average. In the former case, this 18-bit register is interpreted as a 14.4 value and supports a range of values from 1/16 to 2^14-1. In the latter case (logarithmic mode), the 18-bit register is interpreted as a 7.11 value.

    In mmw Demo, Detection threshold is specified as log2 value, expressed in Q9 format for xWR14xx. The threshold value can be converted from the value expressed in dB as Tcli = 512 x TdB / 6
    Note: log input is used for xWR14xx mmw demo

    In 14xx, when you set the CFAR threshold = 15dB, the TCLI will be calculated as 1280.
    In 16xx, 2TX4RX MIMO mode, when you set the CFAR threshold = 15dB, the TCLI will be calculated as 5120.
    In 16xx, 1TX4RX MIMO mode, when you set the CFAR threshold = 15dB, the TCLI will be calculated as 2560.

    For more information, you can refer listed documents:
    www.ti.com/.../swru527
    C:\ti\mmwave_sdk_01_02_00_05\docs\mmwave_sdk_user_guide.pdf

    Regards,
    Wesley
  • Hi Wesley,

    Thank you for your answer. If I understood you correctly this means because threshold is in Q9 format, the data that is input to the CFAR engine should also be in Q9 format

    (which is accomplished in mmwDemo by sumation step of already done log2 REAL data). My point was if you want to modify mmwDemo code and want to input complex data to CFAR engine and do 

    magnitude + log2 operation INSIDE CFAR engine. In that case you have Q11 format of data input to CFAR core unit, but threshold is still in Q9? How CFAR engine interpret Q9 Threshold into Q11?

    Sorry for bothering you but I obviously interpreted something wrong but it is a little bit confusion to me.

    Best regards, 

    Predrag

  • Hi Predrag,

    Answer from Michelle in ticket:e2e.ti.com/.../664615

    Q11 format comes from log2 output. In the HWA user guide, the threshold scale is Q11 because it is assuming a linear input and followed by log2 before CFAR. So the CFAR threshold and input to CFAR are both Q11 format.

    However, in mmw demo, log2 and summation steps are taken before CFAR (no log2 inside of CFAR block).
    log2 output is Q11
    Summation step: the input scale (srcScale) is 2, meaning 2 redundant bits are added to MSB and 6 bits padding to LSB, then it's in Q17 format.
    the dstScale is set to 8, meaning summation step output to local memory will have 8bit dropped at LSB, giving Q9 format.

    This is the value being used for CFAR so CFAR threshold needs to be Q9 format as well.

    Also, In the 14xx implementation, the summation is done using FFT where the DC (0th) bin of the FFT will be the sum but FFT output is 1/N*sum() by definition where N is the number of virtual antennas, so before the output goes to CFAR block, it is already in the average form i.e number of virtual antennas is already accounted for. But in 16xx, we accumulate the sum as 16-bit number and pass it to our CFAR library function without division by number of virtual antennas, so the CFAR threshold has to account for this.

    Hope it's clear enough to your question. Let me know if further support is needed.


    Regard,
    Wesley
  • Thank you Wesley for your clear explanation!

    Best regards, Predrag
  • Hi Predrag,

     I want to clarify/correct the last paragraph in Wesley's response (I provided him that information, it is not his fault, I later realize it was not quite right) about 14xx usage of FFT to calculate sum as DC bin for your benefit and also for benefit of everyone else who may follow this thread in future. The FFT by definition does not produce 1/N * sum(), by definition of FFT, it will only produce the sum() because X(0) = sum[x(n)*e^(-j2*pi/N*0*n)] = sum[x(n)]. We set the size of the FFT to be the next power of 2 of the virtual antennas i.e if N = number of virtual antennas, then fft size is N' = 2^ceil(log2(N)) and we enable butterfly scaling for all stages because of which the output is scaled to 1/N', not because of the definition of FFT but because of our configuration of using the HWA. So the output of the FFT = 1/N' sum(.). So we nearly get the average but it is not exact if N is not a power of 2. e.g if you have all three transmit involved in the TDM chirping (i.e you have elevation along with azimuth), then N = 12 and N' = 16. So an additional correction needs to be applied when computing the threshold from dB to Tcli. This is already taken care of in the visualizer when user fed value in dB is translated to the CLI command format. But it is not shown in the UG which has the formula Tcli = 512 * dB / 6. The correct formula is Tcli = 512 * dB / 6 * N/N', this you will see in the UG of the next (post 1.2) SDK release. So the 14xx does have dependency on number of virtual antennas but it is in the sense of this correction factor, not like the 16xx case. When number of virtual antennas is already power of 2 (e.g 4, 8), then N = N' so no correction is required.

    thanks

  • Thank you very much Piyush_.

    What I want to add is that I succeeded to use CFAR in magnitude-only mode where input to CFAR is magnitude of FFT spectrum.

    The threshold that is sent in mmwDemo to CFAR is: T_linear = 2^(T_cli / 512), so value that is sent for my purpose is: T_newCli = T_linear * 2^4

    because Q14.4 format is expected in CFAR engine when magnitude mode is used.

    Best regards, Predrag