diff --git a/simplelink/ble_sdk_2_02_02_25/examples/cc2650em/simple_peripheral/ccs/stack/.launches/simple_peripheral_cc2650em_stack.launch b/simplelink/ble_sdk_2_02_02_25/examples/cc2650em/simple_peripheral/ccs/stack/.launches/simple_peripheral_cc2650em_stack.launch index 5fd592aa0..8061f98bf 100755 --- a/simplelink/ble_sdk_2_02_02_25/examples/cc2650em/simple_peripheral/ccs/stack/.launches/simple_peripheral_cc2650em_stack.launch +++ b/simplelink/ble_sdk_2_02_02_25/examples/cc2650em/simple_peripheral/ccs/stack/.launches/simple_peripheral_cc2650em_stack.launch @@ -2,17 +2,17 @@ - + - + - + - + diff --git a/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/AD5940.h b/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/AD5940.h index 74b13c44e..f418ba371 100644 --- a/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/AD5940.h +++ b/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/AD5940.h @@ -52,11 +52,12 @@ static void setEIS_EIS (void) select_REG(ADCCON); //21A8 w32_REG(0x00000101); + select_REG(0x20D0); + w32_REG(0x00000090); // select_REG(0x20D0); //20D0 // w32_REG(0x00000091); //takes sinc2 | DFTNUM = 8 select_REG(SWCON); //200C w32_REG(0x00026355); //D5 | P5 | N3 | T6 | T9 0b010 0110 0011 0101 0101 -// w32_REG(0x00026905); //0b010 0110 1001 0000 0101 if (instru.ADCGainLv != HSRTIA_GAIN_AUTO) { instru.AutoGainEnable = 0; @@ -84,6 +85,8 @@ static void setEIS_EIS (void) w16_REG(0x0442); //set divider = 2 select_REG(0x20BC); //HSOSCCON w32_REG(0x00000000); //switch to 32MHz output + select_REG(0x2044); + w32_REG(0x00000301); // select_REG(0x2044); //0x2044 // w32_REG(0x00001310); //ADC data rate = 1.6MHz | SINC2 267 | SINC3 4 select_REG(0x2010); //HSDACCON diff --git a/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteADC.h b/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteADC.h index 777545878..10a37ce43 100644 --- a/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteADC.h +++ b/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteADC.h @@ -1208,74 +1208,69 @@ static void SetSamplingTime(uint32_t freq){ //separate the whole range of frequency into 7 pieces// // 200000 ~ 10000 Hz - if (freq >= 1000000) { + if (freq >= 1000000 && instru.settingIndex != 0) { SelDFTin(1); SetADCDataRate(ADC1M6sps); SetSinc3OSR(Sinc3OSR4); SetDFTNUM(DFTNUM1024); + instru.settingIndex = 0; } // 9999.99 ~ 1000Hz - else if (freq >= 100000) { + else if (freq >= 100000 && freq < 1000000 && instru.settingIndex != 1) { SelDFTin(1); SetADCDataRate(ADC1M6sps); SetSinc3OSR(Sinc3OSR4); SetDFTNUM(DFTNUM8192); + instru.settingIndex = 1; } // 999.99 ~ 100Hz - else if (freq >= 10000) { + else if (freq >= 10000 && freq < 100000 && instru.settingIndex != 2) { SelDFTin(1); SetADCDataRate(ADC800Ksps); SetSinc3OSR(Sinc3OSR5); SetDFTNUM(DFTNUM8192); + instru.settingIndex = 2; } // 99.99 ~ 10Hz - else if (freq >= 1000) { -// SelDFTin(0); -// SetADCDataRate(ADC800Ksps); -// SetSinc2OSR(Sinc2OSR89); -// SetSinc3OSR(Sinc3OSR5); -// SetDFTNUM(DFTNUM1024); -// select_REG(0x20D0); //20D0 -// w32_REG(0x00000091); //takes sinc2 | DFTNUM = 2048 -// select_REG(0x2044); //0x2044 -// w32_REG(0x00000211); //ADC data rate = 800KHz | SINC2 89 | SINC3 5 + else if (freq >= 1000 && freq < 10000 && instru.settingIndex != 3) { + select_REG(0x2044); //0x2044 + w32_REG(0x00000311); //ADC data rate = 800KHz | SINC2 89 | SINC3 5 + select_REG(0x20D0); //20D0 + w32_REG(0x00000091); //takes sinc2 | DFTNUM = 2048 + instru.settingIndex = 3; } // 9.99 ~ 1Hz - else if (freq >= 100) { - select_REG(0x20D0); //20D0 - w32_REG(0x00000081); //takes sinc2 | DFTNUM = 1024 + else if (freq >= 100 && freq < 1000 && instru.settingIndex != 4) { select_REG(0x2044); //0x2044 w32_REG(0x00000911); //ADC data rate = 800KHz | SINC2 889 | SINC3 5 -// SelDFTin(0); -// EnAVG(0); -// SetADCDataRate(ADC800Ksps); -// SetSinc2OSR(Sinc2OSR889); -// SetSinc3OSR(Sinc3OSR5); -// SetDFTNUM(DFTNUM1024); + select_REG(0x20D0); //20D0 + w32_REG(0x00000081); //takes sinc2 | DFTNUM = 1024 + instru.settingIndex = 4; } // 0.99 ~ 0.1Hz - else if (freq >= 10) { + else if (freq >= 10 && freq < 100 && instru.settingIndex != 5) { SelDFTin(0); SetADCDataRate(ADC800Ksps); - SetSinc2OSR(Sinc2OSR267); + SetSinc2OSR(Sinc2OSR533); SetSinc3OSR(Sinc3OSR5); SetDFTNUM(DFTNUM16384); + instru.settingIndex = 5; } // 0.015Hz | 136s - else if (freq >= 1) { + else if (freq >= 1 && freq < 10 && instru.settingIndex != 6) { SelDFTin(0); SetADCDataRate(ADC800Ksps); SetSinc2OSR(Sinc2OSR1333); SetSinc3OSR(Sinc3OSR5); SetDFTNUM(DFTNUM16384); + instru.settingIndex = 6; } - Elite_led_color(COLOR_ORANGE); } //EIS function// diff --git a/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteDAC.h b/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteDAC.h index 3fde7fe09..cdff3f8c3 100644 --- a/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteDAC.h +++ b/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteDAC.h @@ -156,7 +156,7 @@ static uint32_t CalcDelayTime(uint32_t freq, bool delayFlag){ // 10Hz else if (freq >= 1000) { - decadeSamplingTime = 5696; + decadeSamplingTime = 11392; } // 1Hz @@ -166,7 +166,7 @@ static uint32_t CalcDelayTime(uint32_t freq, bool delayFlag){ //0.1Hz else if (freq >= 10) { - decadeSamplingTime = 263400; + decadeSamplingTime = 545792; } // 0.015Hz | 136s diff --git a/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteEISMode.h b/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteEISMode.h index c8f2ad109..9c0eced26 100644 --- a/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteEISMode.h +++ b/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteEISMode.h @@ -88,19 +88,10 @@ static void eis_fscan(void) } } -// SetSamplingTime(instru.fset); - - if (instru.fset >= 1000) { - select_REG(0x20D0); //20D0 - w32_REG(0x00000081); //takes sinc2 | DFTNUM = 1024 - select_REG(0x2044); //0x2044 - w32_REG(0x00000211); //ADC data rate = 800KHz | SINC2 89 | SINC3 2 - Elite_led_color(COLOR_ORANGE); - } - - instru.sampleRate = 400; + SetSamplingTime(instru.fset); + instru.sampleRate = 1850; } #endif diff --git a/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteInstruction.h b/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteInstruction.h index 8cc333032..f723a9f48 100644 --- a/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteInstruction.h +++ b/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteInstruction.h @@ -42,6 +42,7 @@ struct HEADSTAGE_INSTRUCTION { int32_t imag; uint8_t periodIndex; uint32_t delayTime; + uint8_t settingIndex; /** ADC parameter **/ @@ -264,6 +265,7 @@ static void InitEliteInstruction(){ instru.ppd = 1; instru.periodIndex = 0; instru.delayTime = 0; + instru.settingIndex = 0; //pulse mode diff --git a/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteReset.h b/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteReset.h index 44c712357..ab1271985 100644 --- a/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteReset.h +++ b/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteReset.h @@ -53,6 +53,7 @@ static void Eliteinterrupt() { InitGPT(); initINSBuf(); initDATBuf(); +// AD5940_sftreset(); // PIN_setOutputValue(pin_handle, HIGH_Z_MODE, 0); // HIGH Z MODE // 1: close; 0: open; diff --git a/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteWorkData.h b/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteWorkData.h index aa6eb5c18..6e9cc9863 100644 --- a/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteWorkData.h +++ b/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteWorkData.h @@ -65,7 +65,7 @@ struct wm_eis_ctx_t { uint16_t _ppd; uint8_t _cnt; int8_t _decadeIndex; //index of decade max is 8 - int16_t _sweepIndex; //index of smaller decade max is 10 + int16_t _sweepIndex; //index of smaller decade max is 10 bool _direction_up; bool _switchNeg; bool _switchPos; diff --git a/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/headstage.h b/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/headstage.h index 67fef1f65..7d7bedd23 100644 --- a/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/headstage.h +++ b/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/headstage.h @@ -692,8 +692,8 @@ static void update_ZM_instruction(uint8 *ins) { case CURVE_EIS: { //0xD1 if (ins[3] == PARA_1) { //3000D1 01 instru.f1 = 6711;//((uint32_t)(ins[4]) << 24) | ((uint32_t)(ins[5]) << 16) | ((uint32_t)(ins[6]) << 8) | (uint32_t)(ins[7]); //FREQ_START - instru.f2 = 671;//((uint32_t)(ins[8]) << 24) | ((uint32_t)(ins[9]) << 16) | ((uint32_t)(ins[10]) << 8) | (uint32_t)(ins[11]); //FREQ_STOP - instru.sampleRate = CalcDelayTime(User2Freq(instru.f1), true); //ms //read + instru.f2 = 67;//((uint32_t)(ins[8]) << 24) | ((uint32_t)(ins[9]) << 16) | ((uint32_t)(ins[10]) << 8) | (uint32_t)(ins[11]); //FREQ_STOP + instru.sampleRate = 15;//CalcDelayTime(User2Freq(instru.f1), true); //ms //read instru.fmax = (uint32_t)VMAX(instru.f1, instru.f2); instru.fmin = (uint32_t)VMIN(instru.f1, instru.f2); instru.delay = 10;//((uint16_t)(ins[12]) << 8) | (uint16_t)(ins[13]); //DELAY/10 how many periods @@ -1262,12 +1262,13 @@ static void update_ZM_instruction(uint8 *ins) { r32_REG(); initCISBuf(); - cis_buf[0] = (uint8_t)((address & 0x0000FF00) >> 8); - cis_buf[1] = (uint8_t)(address & 0x000000FF); - cis_buf[2] = spi_rxbuf[2]; - cis_buf[3] = spi_rxbuf[3]; - cis_buf[4] = spi_rxbuf[4]; - cis_buf[5] = spi_rxbuf[5]; + cis_buf[0] = 20; + cis_buf[1] = (uint8_t)((address & 0x0000FF00) >> 8); + cis_buf[2] = (uint8_t)(address & 0x000000FF); + cis_buf[3] = spi_rxbuf[2]; + cis_buf[4] = spi_rxbuf[3]; + cis_buf[5] = spi_rxbuf[4]; + cis_buf[6] = spi_rxbuf[5]; SimpleProfile_SetParameter(BLE_CIS_BUFF_CHAR, BLE_CIS_BUFF_SIZE, cis_buf); break; } @@ -1339,12 +1340,18 @@ static void update_ZM_instruction(uint8 *ins) { } case CTL_IMPEDANCE: { //ble write:0x3000FF 12 | UI write: 12 - select_REG(0x20D0); //20D0 - w32_REG(0x00000091); //takes sinc2 | DFTNUM = 2048 - select_REG(0x2000); //2000 - w32_REG(0x0031CFC0); select_REG(0x2044); //0x2044 - w32_REG(0x00000211); //ADC data rate = 800KHz | SINC2 89 | SINC3 5 + w32_REG(0x00000211); //ADC data rate = 800KHz | SINC2 89 | SINC3 2 + select_REG(0x20D0); //20D0 + w32_REG(0x00000081); //takes sinc2 | DFTNUM = 1024 + break; + } + + case 0x13: { + select_REG(0x2044); //0x2044 + w32_REG(0x00000911); //ADC data rate = 800KHz | SINC2 889 | SINC3 5 + select_REG(0x20D0); //20D0 + w32_REG(0x00000081); //takes sinc2 | DFTNUM = 1024 break; } diff --git a/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/impedance_meter.h b/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/impedance_meter.h index 9d34f33be..300cde5e7 100644 --- a/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/impedance_meter.h +++ b/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/impedance_meter.h @@ -154,17 +154,17 @@ static void SimpleBLEPeripheral_performPeriodicTask(void) { } } - GPT.LeadTimeCounter = GPT.LeadTimeCounter + GPT.DeltaGptimerCounter; - if (leadTimeReset && GPT.LeadTimeCounter <= 2000) { - vscanReset = true; - if (first_highz_flag && GPT.LeadTimeCounter >= 1000) { - SetEISHIGHZ(1); // // High Z | 1 off | 0 on - } - first_highz_flag = false; - } else { - vscanReset = false; - leadTimeReset = false; - } +// GPT.LeadTimeCounter = GPT.LeadTimeCounter + GPT.DeltaGptimerCounter; +// if (leadTimeReset && GPT.LeadTimeCounter <= 2000) { +// vscanReset = true; +// if (first_highz_flag && GPT.LeadTimeCounter >= 1000) { +// SetEISHIGHZ(1); // // High Z | 1 off | 0 on +// } +// first_highz_flag = false; +// } else { +// vscanReset = false; +// leadTimeReset = false; +// } //vscan counter //fset counter if (fset_flag) {