- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello everyone, I am working on Peak Detection in EVADC , after going through "Finding Extrema (Peak Detection)" topic from section 32.7.3 Compare with Standard Conversions (Limit Checking) of Infineon-AURIX_TC3xx_Part2-UserManual-v01_00-EN.pdf my conclusion is that Finding Extrema has dependency on limit checking, having hard time how to do configuration so it will reflect in registers and analyzing its code generation. Please help me out!!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
EVADC_CLC.U = 0;
while(EVADC_CLC.B.DISS != 0);
IfxScuWdt_setCpuEndinit(IfxScuWdt_getCpuWatchdogPassword());
EVADC_G2ANCFG.U = 0x00300000;
EVADC_G2ARBCFG.U = 0x00000003;
EVADC_GLOBCFG.U = 0x80000000;
unsigned int i, j;
for(i=0;i<65535;i++)
{
for(j=0;j<120;j++)
{
__nop();
}
}
EVADC_G2ARBPR.U = 0x03000000;
//build FIFO with R0 and R1, find peak value
EVADC_G2CHCTR0.B.RESREG = 1;
EVADC_G2CHCTR1.B.RESREG = 1;
EVADC_G2RCR0.B.FEN = 2;
EVADC_G2RCR1.B.FEN = 0;
EVADC_G2RES1.B.RESULT = 819; //1V
EVADC_G2QMR0.U = 0x00000001;
EVADC_G2QMR1.U = 0x00000001;
//convert G2.0 3x times, connected to 5V
EVADC_G2QINR0.U = 0x00000080;
EVADC_G2QINR0.U = 0x00000080;
EVADC_G2QINR0.U = 0x00000080;
EVADC_G2QMR0.B.TREV = 1;
for(i=0;i<65535;i++)
{
for(j=0;j<120;j++)
{
__nop();
}
}
EVADC_G2RES1.B.RESULT = 819; //1V
//convert G2.1 3x times, connected to 3.3V
EVADC_G2QINR1.U = 0x00000081;
EVADC_G2QINR1.U = 0x00000081;
EVADC_G2QINR1.U = 0x00000081;
EVADC_G2QMR1.B.TREV = 1;
Best Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Please take a look at the following test code as a reference and adapt it at your end.
The test condition is:
1. Connect Group 2 Ch 0 to 5V and Group 2 Ch 1 to 3.3V
2. Build a FIFO using result registers 0 and 1. Set initial compare threshold to 1V (i.e., 839 in FIFO).
3. the First conversion converts G2.Ch0 3 times. Because 5V > 1V, 5V results should be stored in FIFO.
4. Then convert G2.Ch1 3 times. Although 3.3V > old threshold 1V, 3.3V < new peak 5V, we see it is not stored in FIFO.
This test shows that the threshold is the previous peak value in FIFO by the next conversion.
EVADC_CLC.U = 0;
while(EVADC_CLC.B.DISS != 0);
IfxScuWdt_setCpuEndinit(IfxScuWdt_getCpuWatchdogPassword());
EVADC_G2ANCFG.U = 0x00300000;
EVADC_G2ARBCFG.U = 0x00000003;
EVADC_GLOBCFG.U = 0x80000000;
unsigned int i, j;
for(i=0;i<65535;i++)
{
for(j=0;j<120;j++)
{
__nop();
}
}
EVADC_G2ARBPR.U = 0x03000000;
//build FIFO with R0 and R1, find peak value
EVADC_G2CHCTR0.B.RESREG = 1;
EVADC_G2CHCTR1.B.RESREG = 1;
EVADC_G2RCR0.B.FEN = 2;
EVADC_G2RCR1.B.FEN = 0;
EVADC_G2RES1.B.RESULT = 819; //1V
EVADC_G2QMR0.U = 0x00000001;
EVADC_G2QMR1.U = 0x00000001;
//convert G2.0 3x times, connected to 5V
EVADC_G2QINR0.U = 0x00000080;
EVADC_G2QINR0.U = 0x00000080;
EVADC_G2QINR0.U = 0x00000080;
EVADC_G2QMR0.B.TREV = 1;
for(i=0;i<65535;i++)
{
for(j=0;j<120;j++)
{
__nop();
}
}
EVADC_G2RES1.B.RESULT = 819; //1V
//convert G2.1 3x times, connected to 3.3V
EVADC_G2QINR1.U = 0x00000081;
EVADC_G2QINR1.U = 0x00000081;
EVADC_G2QINR1.U = 0x00000081;
EVADC_G2QMR1.B.TREV = 1;
Best Regards.
Please take a look at the following test code as a reference and adapt it at your end.
The test condition is:
1. Connect Group 2 Ch 0 to 5V and Group 2 Ch 1 to 3.3V
2. Build a FIFO using result registers 0 and 1. Set initial compare threshold to 1V (i.e., 839 in FIFO).
3. the First conversion converts G2.Ch0 3 times. Because 5V > 1V, 5V results should be stored in FIFO.
4. Then convert G2.Ch1 3 times. Although 3.3V > old threshold 1V, 3.3V < new peak 5V, we see it is not stored in FIFO.
This test shows that the threshold is the previous peak value in FIFO by the next conversion.