Hello,
I was wondering how the sampling rate for the EVAL-AD5940BIOZ board can be changed or is there a buffer limit to the number of samples that can be taken?. I am currently using the IAR software program and SerialTerm Capture to record the outputting data. I ran a sample test with a 1kOhm resistor for 1 second and I was able to record 184 lines of data. I am aiming to increase the sampling rate to 2,000 samples/second. I have already changed certain lines of code given by Github to run the example project, I will include those changes down below. Any suggestions or thoughts would be greatly appreciated. Thank you!.
Hi,
Inside the measure function, you may add the code snippet below, to know the max allowed ODR for a given configuration:
AppBIACfg.MeasSeqCycleCount = AD5940_SEQCycleTime();
AppBIACfg.MaxODR = 1/((( AppBIACfg.MeasSeqCycleCount + 10) / 16.0)* 1E-6) ; //If Sysclk is16MHz
if(AppBIACfg.AmpODR > AppBIACfg.MaxODR)
{
/* We have requested a sampling rate that cannot be achieved with the time it takes to acquire a sample.*/
AppBIACfg.AmpODR = AppBIACfg.MaxODR;
}
Also in AD5940_SEQCycleTime() function definition in AD5940.c ,
Change “ for(i=0;i<SeqGenDB.RegCount;i++) “ to “for(i=0;i<SeqGenDB.SeqLen;i++)”.
Hi,
Inside the measure function, you may add the code snippet below, to know the max allowed ODR for a given configuration:
AppBIACfg.MeasSeqCycleCount = AD5940_SEQCycleTime();
AppBIACfg.MaxODR = 1/((( AppBIACfg.MeasSeqCycleCount + 10) / 16.0)* 1E-6) ; //If Sysclk is16MHz
if(AppBIACfg.AmpODR > AppBIACfg.MaxODR)
{
/* We have requested a sampling rate that cannot be achieved with the time it takes to acquire a sample.*/
AppBIACfg.AmpODR = AppBIACfg.MaxODR;
}
Also in AD5940_SEQCycleTime() function definition in AD5940.c ,
Change “ for(i=0;i<SeqGenDB.RegCount;i++) “ to “for(i=0;i<SeqGenDB.SeqLen;i++)”.
Hello Akila,
Thank you for the response. Is the snippet code for the body impedance function or 2-wire BIOZ function?
It can be used for all the projects in AD594x
Hi Akila,
When you mentioned adding the code snippet in the measurement function, are you referring to the line below " ODR (Sample Rate) 5 Hz */ "?
Also, you mentioned that it would allow me to determine the max sampling rate for the BIOZ configuration. Would the max sampling rate be outputted after I download and debug or run an actual experimental test and export the file from RealTerm Capture?.
Thank you!
Hi Akila,
Sorry to bother you again, I forgot to mention this from yesterday's comment but is the snippet code supposed to have the same exact spacing as you indicated in your reply?
Add the code snippet:
AppBIACfg.MeasSeqCycleCount = AD5940_SEQCycleTime();
AppBIACfg.MaxODR = 1/((( AppBIACfg.MeasSeqCycleCount + 10) / 16.0)* 1E-6) ; //If Sysclk is16MHz
if(AppBIACfg.AmpODR > AppBIACfg.MaxODR)
{
/* We have requested a sampling rate that cannot be achieved with the time it takes to acquire a sample.*/
AppBIACfg.AmpODR = AppBIACfg.MaxODR;
}
inside AppBIASeqMeasureGen() function
Hi Akila,
So I used the same exact codes you have provided to me and inserted them in the "AppBIOZSeqMeasureGen() function" instead of the "AppBIASeqMeasureGen() function" that you pointed out in your previous post. I also changed the configurations of "AppBIACfg." to the "AppBIOZCfg." to match the 2-Wire BIOZ impedance example on IAR. When I rebuild the project I get the following errors:
I also want to mention that I am getting similar errors even when I add the snippet code to the "AppBIASeqMeasureGen() function". The error messages indicate that the "AppBIACfg." is undefined. Any suggestions? Thank you!
Hi,
You have to add the relevant fields in bodyImpedance.h:
SEQInfo_Type InitSeqInfo;
SEQInfo_Type MeasureSeqInfo;
BoolFlag StopRequired; /* After FIFO is ready, stop the measurement sequence */
uint32_t FifoDataCount; /* Count how many times impedance have been measured */
uint32_t MeasSeqCycleCount; /* How long the measurement sequence will take */
float MaxODR; /* Max ODR for sampling in this config */
/* End */
}AppBIACfg_Type;
Also change AmpODR to BiaODR
Hi Akila,
Hi,
AD5940_SEQCycleTime() is defined in AD5940.c
uint32_t AD5940_SEQCycleTime(void)
{
uint32_t i, Cycles, Cmd;
Cycles = 0;
for(i=0;i<SeqGenDB.RegCount;i++)
{
Cmd = (SeqGenDB.pSeqBuff[i] >> 30) & 0x3;
if (Cmd & 0x2)
{
/* A write command */
Cycles += 1;
}
else
{
if (Cmd & 0x1)
{
/* Timeout Command */
Cycles += 1;
}
else
{
/* Wait command */
Cycles += SeqGenDB.pSeqBuff[i] & 0x3FFFFFFF;
}
}
}
return Cycles;
}
Hello Akila,
I wanted to diverge the thread post regarding the increase in sampling frequency of the AD5940BIOZ board with the BIOZ-2Wire example here. The other customer's question about the AD5940 board was on a different example.
The original thread is here: How to change AD5940's sampling frequency
So in your latest response in the thread above, you highlighted regions that need to be changed in the BIOZ-2Wire.c file, but I wondered what it should be changed to obtain the 1000hz sampling rate?
The regions that you have indicated are already present (unedited lines of code) in the BIOZ-2Wire.c file. I wanted the complete code modifications to get to a 1000Hz sampling rate, which would be similar to a benchtop Zurich instrument, which we would like to compare to. I don't have an extensive background in programming so clarity on this subject matter would be the utmost help. In addition, please provide the maximum sampling rate and ideally the loss in accuracy from the 4Hz example in the documentation and the desirable 1000Hz sampling rate.
Thank you!