Temperature compensation issue

Hi,

We are facing an issue when temperature compensation is enabled. Some times the ranging functionality stops working as the receiver interrupts are not getting received.

We have the implementation as follows.

static void BandwidthPower_Compensation(void)
{
uint32_t u32_CurrentTime;
static uint32_t u32_TempCheck_timer = TEMP_COMPENSATION_INTERVAL;
dwt_txconfig_t txconfig;
int raw_temp;
u32_CurrentTime = portGetTickCnt();
if(u32_CurrentTime >= u32_TempCheck_timer)
{
u32_TempCheck_timer = u32_CurrentTime + TEMP_COMPENSATION_INTERVAL;

    /* Read DW1000 IC temperature for temperature compensation procedure.*/
	raw_temp = (dwt_readtempvbat(1) & 0xFF00) >> 8;

    /*reduce SPI to < 3MHz*/
	port_set_dw1000_slowrate();
    /* Compensate bandwidth and power settings for temperature */
    txconfig.PGdly = dwt_calcbandwidthtempadj(CAS_PG_COUNT_REF_VAL);
    /*increase SPI to max*/
	port_set_dw1000_fastrate();
    txconfig.power = dwt_calcpowertempadj(DWT_CHANNEL_NO, ModePower[my.wb_setting.wb_mode].power,
    									 (int) (raw_temp - CAS_TEMPERATURE_REF_VAL));
    /* Configure the TX frontend with the adjusted settings */
    dwt_configuretxrf(&txconfig);
}

}

We are doing the compensation periodically in every 1 Minute. In our application ranging is also working parallelly. When we enable the temperature compensation feature the DW1000 is miss behaving like not getting the RX ok callback, stuck in ISR…etc…

What could be the issue, Is it due to writing to the power register/reading of cal register…when the transmission is ongoing as part of ranging process.?

Regards,
Shijo Thomas

Hi Shijo,

you have mentioned about running the two tasks in parallel. I would check if there could be any race condition with your SPI bus as well as with access to the DW1000 IC.

As you can see the BW/TXPWR compensation switches the SPI speed, uses SPI bus and touch the PLL and configuration of the DW1000 hence if you do not guarantee atomic operation of your transaction on the DW1000 all the funny things can happen with that. If I understand correctly then you do also SPI transaction in the ISR, that is mostly not a good idea neither.

Cheers,
TDK

Hi,

Thanks for the response.

What I meant by the parallel task is that,

Eg: we have two functions, One is for doing the ranging(rangingtask()) and the other is for doing the temperature compensation(BandwidthPower_Compensation()). Both are called from the main while loop periodically. rangingtask() will check the Receive queue and sends the response if required. BandwidthPower_Compensation() will do the temperature compensation as explained in the code snippet. So I have the following doubts.

  1. What will the effect if BandwidthPower_Compensation() called if the transmitter is transmitting the frame. In the library API dwt_calcbandwidthtempadj(), some registers are altered for doing the calibration?
  2. What will be the behaviour if the SPI frequency is changed in between?
  3. For calling the functions dwt_calcbandwidthtempadj() & dwt_calcpowertempadj(), whether the Radio should be in IDLE mode?

Regards,
Shijo Thomas

Hi Shijo,

  1. I think it can create problem since it touch the PLL as far as I know.
  2. Changing frequency by itself is not a problem. What I meant before is if you have parallel tasks you should guarantee that race condition might not happen. But it sounds like it is not your case.
  3. The same as 1 - I believe it should be in IDLE state.

Cheers,
TDK