Tool/software:
Hello,
I am testing this sensor for AFE CHECK.
The execution time is 200us according to safety manual. But I get wrong result in that time. I need to wait at least 500us to complete conversion and get correct results.
I am trying to minimize the test execution time. Where am I doing wrong?
Config Registers
0xCCU, //DEVICE_CONFIG_1
0x00U, //DEVICE_CONFIG_2
0x40U, //SENSOR_CONFIG_1
0x00U, //SENSOR_CONFIG_2
AFE CHECK Code
uint16_t w_TMAG5173_checkAFE(tmag5173_t *ps_tmag) { //6.3.7 Analog Front-End (AFE) Check (SM#7) 200 μsec int16_t i_adcp[3] = {0}, i_adcn[3] = {0}; uint16_t w_status = 0U; //positive AFE v_TMAG5173_setMagChannelsTrig(ps_tmag, TMAG5173_MAG_CH_XYZPAFE); //DEVICE_DELAY_US(500U); while(w_status == 0U) { i_adcp[2] = i_TMAG5173_getResultZ(ps_tmag); w_status = ps_tmag->aw_values[2] & 0x01U; } if(w_status != 0U) { v_TMAG5173_getResultXY(ps_tmag); i_adcp[0] = i_TMAG5173_calcResult16(ps_tmag->aw_values[0], ps_tmag->aw_values[1]); i_adcp[1] = i_TMAG5173_calcResult16(ps_tmag->aw_values[2], ps_tmag->aw_values[3]); } //negative AFE v_TMAG5173_setMagChannelsTrig(ps_tmag, TMAG5173_MAG_CH_XYZNAFE); DEVICE_DELAY_US(500U); i_adcn[2] = i_TMAG5173_getResultZ(ps_tmag); w_status = ps_tmag->aw_values[2] & 0x01U; if(w_status != 0U) { v_TMAG5173_getResultXY(ps_tmag); i_adcn[0] = i_TMAG5173_calcResult16(ps_tmag->aw_values[0], ps_tmag->aw_values[1]); i_adcn[1] = i_TMAG5173_calcResult16(ps_tmag->aw_values[2], ps_tmag->aw_values[3]); } return w_TMAG5173_checkAFE_Limits(ps_tmag, i_adcp, i_adcn); }