idk why but it worked!

This commit is contained in:
Taylor Liao
2021-08-25 23:22:33 +08:00
parent 2679cdead2
commit f552bdacab
10 changed files with 68 additions and 69 deletions
@@ -2,17 +2,17 @@
<launchConfiguration type="com.ti.ccstudio.debug.launchType.device.debugging">
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_DEBUGGER_PROPERTIES.C:\ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\stack\targetConfigs\CC2650F128.ccxml.Texas Instruments XDS100v3 USB Debug Probe_0/Cortex_M3_0" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot; ?&gt;&#10;&lt;PropertyValues&gt;&#10;&#10; &lt;property id=&quot;ConnectOnStartup&quot;&gt;&#10; &lt;curValue&gt;1&lt;/curValue&gt;&#10; &lt;/property&gt;&#10;&#10; &lt;property id=&quot;EnableInstalledBreakpoint&quot;&gt;&#10; &lt;curValue&gt;1&lt;/curValue&gt;&#10; &lt;/property&gt;&#10;&#10; &lt;property id=&quot;IgnoreSoftLaunchFailures&quot;&gt;&#10; &lt;curValue&gt;0&lt;/curValue&gt;&#10; &lt;/property&gt;&#10;&#10;&lt;/PropertyValues&gt;&#10;"/>
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_DEBUGGER_PROPERTIES.C:\ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\stack\targetConfigs\CC2650F128.ccxml.Texas Instruments XDS110 USB Debug Probe/Cortex_M3_0" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot; ?&gt;&#10;&lt;PropertyValues&gt;&#10;&#10; &lt;property id=&quot;ConnectOnStartup&quot;&gt;&#10; &lt;curValue&gt;1&lt;/curValue&gt;&#10; &lt;/property&gt;&#10;&#10; &lt;property id=&quot;EnableInstalledBreakpoint&quot;&gt;&#10; &lt;curValue&gt;1&lt;/curValue&gt;&#10; &lt;/property&gt;&#10;&#10; &lt;property id=&quot;IgnoreSoftLaunchFailures&quot;&gt;&#10; &lt;curValue&gt;0&lt;/curValue&gt;&#10; &lt;/property&gt;&#10;&#10;&lt;/PropertyValues&gt;&#10;"/>
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_DEBUGGER_PROPERTIES.C:\ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\stack\targetConfigs\CC2650F128.ccxml.Texas Instruments XDS110 USB Debug Probe_0/Cortex_M3_0" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot; ?&gt;&#10;&lt;PropertyValues&gt;&#10;&#10; &lt;property id=&quot;ConnectOnStartup&quot;&gt;&#10; &lt;curValue&gt;1&lt;/curValue&gt;&#10; &lt;/property&gt;&#10;&#10; &lt;property id=&quot;EnableInstalledBreakpoint&quot;&gt;&#10; &lt;curValue&gt;1&lt;/curValue&gt;&#10; &lt;/property&gt;&#10;&#10; &lt;property id=&quot;IgnoreSoftLaunchFailures&quot;&gt;&#10; &lt;curValue&gt;0&lt;/curValue&gt;&#10; &lt;/property&gt;&#10;&#10;&lt;/PropertyValues&gt;&#10;"/>
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_DEBUGGER_PROPERTIES.CC2650F128.ccxml.Texas Instruments XDS110 USB Debug Probe_0/Cortex_M3_0" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot; ?&gt;&#10;&lt;PropertyValues&gt;&#10;&#10; &lt;property id=&quot;ConnectOnStartup&quot;&gt;&#10; &lt;curValue&gt;1&lt;/curValue&gt;&#10; &lt;/property&gt;&#10;&#10; &lt;property id=&quot;EnableInstalledBreakpoint&quot;&gt;&#10; &lt;curValue&gt;1&lt;/curValue&gt;&#10; &lt;/property&gt;&#10;&#10; &lt;property id=&quot;IgnoreSoftLaunchFailures&quot;&gt;&#10; &lt;curValue&gt;0&lt;/curValue&gt;&#10; &lt;/property&gt;&#10;&#10;&lt;/PropertyValues&gt;&#10;"/>
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_PROGRAM.C:\ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\stack\targetConfigs\CC2650F128.ccxml.Texas Instruments XDS100v3 USB Debug Probe_0/Cortex_M3_0" value="${build_artifact:simple_peripheral_cc2650em_stack}"/>
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_PROGRAM.C:\ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\stack\targetConfigs\CC2650F128.ccxml.Texas Instruments XDS110 USB Debug Probe/Cortex_M3_0" value="${build_artifact:simple_peripheral_cc2650em_stack}"/>
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_PROGRAM.C:\ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\stack\targetConfigs\CC2650F128.ccxml.Texas Instruments XDS110 USB Debug Probe_0/Cortex_M3_0" value="${build_artifact:simple_peripheral_cc2650em_stack}"/>
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_PROGRAM.CC2650F128.ccxml.Texas Instruments XDS110 USB Debug Probe_0/Cortex_M3_0" value="${build_artifact:simple_peripheral_cc2650em_stack}"/>
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_PROJECT.C:\ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\stack\targetConfigs\CC2650F128.ccxml.Texas Instruments XDS100v3 USB Debug Probe_0/Cortex_M3_0" value="simple_peripheral_cc2650em_stack"/>
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_PROJECT.C:\ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\stack\targetConfigs\CC2650F128.ccxml.Texas Instruments XDS110 USB Debug Probe/Cortex_M3_0" value="simple_peripheral_cc2650em_stack"/>
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_PROJECT.C:\ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\stack\targetConfigs\CC2650F128.ccxml.Texas Instruments XDS110 USB Debug Probe_0/Cortex_M3_0" value="simple_peripheral_cc2650em_stack"/>
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_PROJECT.CC2650F128.ccxml.Texas Instruments XDS110 USB Debug Probe_0/Cortex_M3_0" value="simple_peripheral_cc2650em_stack"/>
<stringAttribute key="com.ti.ccstudio.debug.debugModel.ATTR_TARGET_CONFIG" value="${target_config_active_default:simple_peripheral_cc2650em_stack}"/>
<stringAttribute key="com.ti.ccstudio.debug.debugModel.MRU_PROGRAM.C:\ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\stack\targetConfigs\CC2650F128.ccxml.Texas Instruments XDS100v3 USB Debug Probe_0/Cortex_M3_0" value="C:/ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\stack\FlashROM\simple_peripheral_cc2650em_stack.out"/>
<stringAttribute key="com.ti.ccstudio.debug.debugModel.MRU_PROGRAM.C:\ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\stack\targetConfigs\CC2650F128.ccxml.Texas Instruments XDS110 USB Debug Probe/Cortex_M3_0" value="C:/ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\stack\FlashROM\simple_peripheral_cc2650em_stack.out"/>
<stringAttribute key="com.ti.ccstudio.debug.debugModel.MRU_PROGRAM.C:\ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\stack\targetConfigs\CC2650F128.ccxml.Texas Instruments XDS110 USB Debug Probe_0/Cortex_M3_0" value="C:/ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\stack\FlashROM\simple_peripheral_cc2650em_stack.out"/>
<stringAttribute key="com.ti.ccstudio.debug.debugModel.MRU_PROGRAM.CC2650F128.ccxml.Texas Instruments XDS110 USB Debug Probe_0/Cortex_M3_0" value="C:\ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral\ccs\stack\FlashROM\simple_peripheral_cc2650em_stack.out"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/simple_peripheral_cc2650em_stack"/>
</listAttribute>
@@ -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
@@ -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//
@@ -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
@@ -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
@@ -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
@@ -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;
@@ -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;
@@ -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;
}
@@ -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) {