Because of the Thanksgiving holiday in the U.S., TI E2E™ design support forum responses may be delayed from November 25 through December 2. Thank you for your patience.

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.

RTOS/TMS320F28379D: Regarding SYS BIOS Hwi(Hardware Interrupt)

Part Number: TMS320F28379D
Other Parts Discussed in Thread: SYSBIOS

Tool/software: TI-RTOS

Dear Sir,

I am working on SYS/BIOS with F28379D. I took the Minimal project Example for SYS/BIOS. I have done Task, Swi, and semaphore successfully.

Now I want to try to insert a Hwi, the main CPU timer interrupt has done successfully but I am not able to make Hwi for other peripherals like PWM, ADC. 

I tried to make a Hwi, taking the simple example in driverlib named adc_ex2_soc_epwm. It is not invoking the interrupt function that I created in app.cfg interface. 

I also shared the app.cfg code and the main program code

Please guide me where I am going wrong.

Ashutosh Bhatt

//===========================app.cfg=============================================//

var ti_sysbios_hal_Hwi = xdc.useModule('ti.sysbios.hal.Hwi');

Hwi.nonDispatchedInterrupts["ti_sysbios_family_c28_Hwi0"].intNum = 0;


var ti_sysbios_hal_Hwi0Params = new ti_sysbios_hal_Hwi.Params();


ti_sysbios_hal_Hwi0Params.instance.name = "ti_sysbios_hal_Hwi0";


Program.global.ti_sysbios_hal_Hwi0 = ti_sysbios_hal_Hwi.create(32, "&adcdpwmhwi", ti_sysbios_hal_Hwi0Params);

//===============================================================================//

//===============================ISR...Hwi=======================================//

void adcdpwmhwi(void){
GPIO_togglePin(DEVICE_GPIO_PIN_LED1);
ADC_clearInterruptStatus(ADCD_BASE, ADC_INT_NUMBER1);
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
}

//=============================================================================//

//================================main.c=========================================//

Int main()
{
 System_printf("enter main()\n");

Device_initGPIO();
//Interrupt_initModule();
// Interrupt_initVectorTable();
GPIO_setPadConfig(DEVICE_GPIO_PIN_LED1, GPIO_PIN_TYPE_STD);
GPIO_setDirectionMode(DEVICE_GPIO_PIN_LED1, GPIO_DIR_MODE_OUT);
initADC();
initEPWM();
initADCSOC();
// Interrupt_register(INT_ADCD1, &adcdpwmhwi);
EPWM_enableADCTrigger(EPWM1_BASE, EPWM_SOC_A);
Interrupt_enable(INT_ADCA1);
EPWM_enableADCTrigger(EPWM1_BASE, EPWM_SOC_A);
EPWM_setTimeBaseCounterMode(EPWM1_BASE, EPWM_COUNTER_MODE_UP);
EINT;
ERTM;
BIOS_start(); /* does not return */
return(0);
}

//=============================================================================

void initADC(void)
{
//
// Set ADCCLK divider to /4
//
ADC_setPrescaler(ADCA_BASE, ADC_CLK_DIV_4_0);

//
// Set resolution and signal mode (see #defines above) and load
// corresponding trims.
//
#if(EX_ADC_RESOLUTION == 12)
ADC_setMode(ADCA_BASE, ADC_RESOLUTION_12BIT, ADC_MODE_SINGLE_ENDED);
#elif(EX_ADC_RESOLUTION == 16)
ADC_setMode(ADCA_BASE, ADC_RESOLUTION_16BIT, ADC_MODE_DIFFERENTIAL);
#endif
//
// Set pulse positions to late
//
ADC_setInterruptPulseMode(ADCA_BASE, ADC_PULSE_END_OF_CONV);

//
// Power up the ADC and then delay for 1 ms
//
ADC_enableConverter(ADCA_BASE);
DEVICE_DELAY_US(1000);
}

//
// Function to configure ePWM1 to generate the SOC.
//
void initEPWM(void)
{
//
// Disable SOCA
//
EPWM_disableADCTrigger(EPWM1_BASE, EPWM_SOC_A);

//
// Configure the SOC to occur on the first up-count event
//
EPWM_setADCTriggerSource(EPWM1_BASE, EPWM_SOC_A, EPWM_SOC_TBCTR_U_CMPA);
EPWM_setADCTriggerEventPrescale(EPWM1_BASE, EPWM_SOC_A, 1);

//
// Set the compare A value to 2048 and the period to 4096
//
EPWM_setCounterCompareValue(EPWM1_BASE, EPWM_COUNTER_COMPARE_A, 0x0800);
EPWM_setTimeBasePeriod(EPWM1_BASE, 0x1000);

//
// Freeze the counter
//
EPWM_setTimeBaseCounterMode(EPWM1_BASE, EPWM_COUNTER_MODE_STOP_FREEZE);
}

//
// Function to configure ADCA's SOC0 to be triggered by ePWM1.
//
void initADCSOC(void)
{
//
// Configure SOC0 of ADCA to convert pin A0. The EPWM1SOCA signal will be
// the trigger.
//
// For 12-bit resolution, a sampling window of 15 (75 ns at a 200MHz
// SYSCLK rate) will be used. For 16-bit resolution, a sampling window of
// 64 (320 ns at a 200MHz SYSCLK rate) will be used.
//

ADC_setupSOC(ADCA_BASE, ADC_SOC_NUMBER0, ADC_TRIGGER_EPWM1_SOCA,ADC_CH_ADCIN0, 15);

//
// Set SOC0 to set the interrupt 1 flag. Enable the interrupt and make
// sure its flag is cleared.
//
ADC_setInterruptSource(ADCA_BASE, ADC_INT_NUMBER1, ADC_SOC_NUMBER0);
ADC_enableInterrupt(ADCA_BASE, ADC_INT_NUMBER1);
ADC_clearInterruptStatus(ADCA_BASE, ADC_INT_NUMBER1);
}