Hi,
In an example program derived from the TI example I want to digitize a sine wave (10KHz) generated by a function generator and use an ISR to update the DAC port. It works without problems as long as I do not substract in one of the PPB an offset from the ADCRESULT register. If I configure for example PPB1 to subtract a value of '1' instead of zero I don't get any DAC port updates anymore. If I leave the value to be subtracted '0' it works as before. If I stop the program and dump the registers using the memory view I see the subtract operation is working correctly. The RESULT register of the PPB1 has the correct value.
Q: What do I need to make or add in the configuration to get this working?
Below is the code of the ISR. I don't change the code at all. The only thing I do is in the syscfg tool changing the offset value from '0' to '1' or to any other value. It doesn't matter. As long as the configured offset is not '0' I get no outputs. I did 'point' the remaining 3 PPB's to another SOC which is not active. This is done just tot make sure the PPB1 operation on SOC0, that is the one I use, is not disturbed by PPB2..PPB4.
ISR-Code
// ISR to update the DAC
static void App_adcISR(void *args) {
if (gLoopCnt) gLoopCnt--;
/*
* I tried to read the PPB1 result register in the ISR. However for some kind of reasons it
* doesn't work reliable.
*
* If I 'subtract' '0' from the ADC0Result in the PP1 and use the PPB1 Result Register the program
* works. If I correct any other value than '0' from the ADC0Result Register then no output on
* the DAC port ? For example if I subtract a value of '1' (no 2complement!) I can see the result
* of the subtraction using the memory view window that the subtraction takes place. However the
* DAC port remains silent ?!
*/
// uint16_t ui16ADC0Result = ADC_readResult(CSL_CONTROLSS_ADC0_RESULT_U_BASE, ADC_SOC_NUMBER0);
uint16_t ui16ADC0PPB1Result = (uint16_t) ADC_readPPBResult(CSL_CONTROLSS_ADC0_RESULT_U_BASE, ADC_PPB_NUMBER1);
/*
if (ui16ADC0Result > 2047) {
ui16ADC0Result = 2047 - (ui16ADC0Result - 2047);
} else if (ui16ADC0Result < 2047) {
ui16ADC0Result = 2047 + (2047 - ui16ADC0Result);
}
*/
// Read the ADC Value and push it to the DAC output
DAC_setShadowValue(CONFIG_DAC0_BASE_ADDR, ui16ADC0PPB1Result);
// Check if overflow has occurred
if(true == ADC_getInterruptOverflowStatus(CONFIG_ADC0_BASE_ADDR, ADC_INT_NUMBER1))
{
ADC_clearInterruptOverflowStatus(CONFIG_ADC0_BASE_ADDR, ADC_INT_NUMBER1);
ADC_clearInterruptStatus(CONFIG_ADC0_BASE_ADDR, ADC_INT_NUMBER1);
gISROverflow++;
} else {
/* Clear any pending interrupts */
ADC_clearInterruptStatus(CONFIG_ADC0_BASE_ADDR, ADC_INT_NUMBER1);
}
}
A scope-shot when the value to be subtracted is '0'.