Hello. I have a question.
Now I am trying to do 8.1.3 of AFE4300 datasheet.
I have a question here.
I don't quite understand the meaning of "Use an SPI clock with the device clock" in paragraph 2.
below is my code.
SPI communication clocks currently use 1 MHz.
How do I synchronize it? Please tell me more details.
void IQ_mode_measure(void) { AFE4300_WRITE(ADDRESS_IQ_MODE_ENABLE,0x08,0x00); //on IQ Mode, off FWR Mode signed long measure_I=0; signed long measure_Q=0; signed int magnitude = 0; if(Uart_flag==1) { send_data(0xFF); send_data(0xFF); } for(int i=1; i<5; i++) // frequency change { for(int j=0; j<3; j++) // calibration change { Act(j); // 0 = measure, 1 = reference 1, 2 = reference 2 frequency_set_up(i); // 1 = 8k, 2 = 16k, 3 = 32k, 4 = 64k //measurement I AFE4300_WRITE(ADDRESS_ADC_CONTROL_REGISTER2,0x00,0x63); // I //wait_for_stability(); AFE4300_WRITE(ADDRESS_ADC_CONTROL_REGISTER1,0xC1,0xB0); // single shot while(rdychk==0) // if rdy change { } rdychk=0; READ_register(ADDRESS_ADC_DATA_RESULT); measure_I = (long)Highvalue*256 + (long)Lowvalue; if(Uart_flag==1) { send_data(Highvalue); send_data(Lowvalue); } //measurement Q AFE4300_WRITE(ADDRESS_ADC_CONTROL_REGISTER2,0x00,0x65); // Q //wait_for_stability(); AFE4300_WRITE(ADDRESS_ADC_CONTROL_REGISTER1,0xC1,0xB0); // single shot while(rdychk==0) { } rdychk=0; READ_register(ADDRESS_ADC_DATA_RESULT); measure_Q = (long)Highvalue*256 + (long)Lowvalue; if(Uart_flag==1) { send_data(Highvalue); send_data(Lowvalue); } if(j==0) { if(measure_I>=32768) { measure_I = (measure_I-65536)*-1; } else if(measure_Q>=32768) { measure_Q = (measure_Q-65536)*-1; } magnitude = sqrt((measure_I*measure_I)+(measure_Q*measure_Q)); } } } }