This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM2434: DebugP_log and interrupts

Part Number: AM2434
Other Parts Discussed in Thread: SYSCONFIG

Extending the epwm_duty_cycle.c example from mcu_plus_sdk_am243x_08_01_00_36 I have added code to start the ADC (by EPWM SOCA and SOCB) and an ISR to read out ADC values. This appears to work fine as long as I don't use DebugP_log() in

    while(numIsrCnt > 0)
    {
        char buf[256];
        SemaphoreP_pend(&gEpwmSyncSemObject, SystemP_WAIT_FOREVER);
        if (isr_data.f != 0) {
            snprintf(buf, sizeof(buf), "%2d kHz, ADCH_0: %4d, ADCH_1: %4d %d %d\n",
                     isr_data.f, isr_data.ADC_step0_data, isr_data.ADC_step1_data, isr_data.sync_isr_cnt, isr_data.adc_isr_cnt);
            // DebugP_log(buf); // uncommenting this stops the ADC interrupt after a short time
            isr_data.f = 0;
        }
        numIsrCnt--;
    }

at the end of epwm_duty_cycle_main().

I have changed interrupt priorities in the structs passed to HwiP_construct() and in SysConfig's Debug Log section but have had no success. As soon as I call DebugP_log() the ADC ISR is stopped being called after a short time.

The ADC ISR looks like this:

void App_adcISR(void *handle)
{
    uint32_t fifoData;
    uint16_t t_entry = SyncEpwm->TBCTR;

    GPIO_pinWriteHigh(gpioBaseAddr, GPIO32_PIN);

    SOC_controlModuleUnlockMMR(SOC_DOMAIN_ID_MAIN, 1);
    pMainMmrCtrl->ADC0_CTRL ^= 1;                    // toggle between EPWM_SOCA_OUT and EPWM_SOCB_OUT
    SOC_controlModuleLockMMR(SOC_DOMAIN_ID_MAIN, 1); // doesn't work, lock code is disabled by #if 0

    if (t_entry > entry_max_adc) entry_max_adc = t_entry;
    if (t_entry < entry_min_adc) entry_min_adc = t_entry;

    adc_isr_cnt++;

    /* Get interrupt status and clear */
    adcstatus = ADCGetIntrStatus(ADC0baseAddr);

    fifo_cnt = ADCGetFIFOWordCount(ADC0baseAddr, ADC_FIFO_NUM_0);

    fifoData = ADCGetFIFOData(ADC0baseAddr, ADC_FIFO_NUM_0);
    ADC_step0_id   = ((fifoData & ADC_FIFODATA_ADCCHNLID_MASK) >> ADC_FIFODATA_ADCCHNLID_SHIFT);
    ADC_step0_data = ((fifoData & ADC_FIFODATA_ADCDATA_MASK) >> ADC_FIFODATA_ADCDATA_SHIFT);
    fifoData = ADCGetFIFOData(ADC0baseAddr, ADC_FIFO_NUM_0);
    ADC_step1_id   = ((fifoData & ADC_FIFODATA_ADCCHNLID_MASK) >> ADC_FIFODATA_ADCCHNLID_SHIFT);
    ADC_step1_data = ((fifoData & ADC_FIFODATA_ADCDATA_MASK) >> ADC_FIFODATA_ADCDATA_SHIFT);

    ADCClearIntrStatus(ADC0baseAddr, adcstatus);

    GPIO_pinWriteLow(gpioBaseAddr, GPIO32_PIN);

    /* Set EOI to generate next interrupt if any */
    ADCWriteEOI(ADC0baseAddr);
}

My question is: What is the best way to get debugging output on the console?

Best regards, Johannes