2014-11-04 03:58 AM
Hello,
I'm trying register base interrupt control. But not working.(problem *.s files)I do not
want to use to OSAL library.
Not starting interrupt. Example Code://Orhan YILMAZ
//Timer Example
typedef
enum
{
FALSE,
TRUE
}
BOOL
;
void
StartupInit(
void
);
void
Port_conig(
void
);
void
WDT_disable(
void
);
void
PIT0_Init(unsigned
int
TimeOut);
void
PIT0_Start(
void
);
//void PIT_0_Handler(void);
void
Interrup_Enable(
void
);
#include ''components.h''
#include ''xpc560b.h''
/*
* Application entry point.
*/
unsigned
long
i = 0;
int
main(
void
) {
componentsInit();
//CLK Init.
StartupInit();
//WDT Disable
WDT_disable();
//Port
Port_conig();
//Timer
PIT0_Init(0xFFFFF);
//IRQ Config
Interrup_Enable();
PIT0_Start();
while
(TRUE) {
if
(i == 0xFFFFFF)
{
//SIU.GPDO[90].B.PDO ^= 1;
i = 0;
}
i++;
}
}
//PORT CONFIGURATION
void
Port_conig(
void
)
{
//Working Led
SIU.PCR[90].B.OBE = 1;
SIU.GPDO[90].B.PDO = 0;
//Output Low
}
//PIT0 Initial Function
void
PIT0_Init(unsigned
int
TimeOut)
{
PIT.PITMCR.R = 0x000000001;
//Enable PIT and Configure to stop in debug mode
PIT.CH[0].LDVAL.R = TimeOut;
//Timeout enter
//Tclk = SystemCLK
INTC_PSR(PIT0_VECTOR)=5;
//PIT_0_Handler, 59, 5;
IRQ_HANDLER(PIT_0_Handler);
}
//PIT0 Start Function
void
PIT0_Start(
void
)
{
//TIE = 1 Timer Interrup Enable
//TEN = 1 Timer Enable
PIT.CH[0].TCTRL.R = 3;
}
void
WDT_disable(
void
)
{
//Watchdog Timer Disable
SWT.SR.R = 0x0000c520;
/* Write keys to clear soft lock bit */
SWT.SR.R = 0x0000d928;
SWT.CR.R = 0x8000010A;
/* Clear watchdog enable (WEN) */
}
/*************************
*CLK CONFIGURATION
*************************/
void
StartupInit(
void
)
{
*
* * * * * * *//Check Configurations
while
(ME.GS.B.MTRANS);
//Global Status Register wait for mode transition to complete
while
(ME.GS.B.CURRENTMODE != 4);
//Global Status Register verify RUN0 Current mode
}
//*********IRQ***********//
void
Interrup_Enable(
void
)
{
INTC.CPR.B.PRI = 0;
// Lower INTC's current priority
asm(
''wrteei 1''
);
//Enable external interrupt ================>>> PROBLEM THIS LINE
}
void
PIT_0_Handler(
void
)
{
PIT.CH[0].TFLG.B.TIF = 1;
SIU.GPDO[90].B.PDO ^= 1;
}
Note: ivor.s and vector.s copy my project folder.
Thanks.
Best Regards,
Orhan YILMAZ
Solved! Go to Solution.
2014-11-14 04:52 AM
/**
* @brief PIT channel 0 interrupt handler.
*
* @isr
*/
#if 0
OSAL_IRQ_HANDLER(vector59) {
OSAL_IRQ_PROLOGUE();
osalSysLockFromISR();
osalOsTimerHandlerI();
osalSysUnlockFromISR();
/* Resets the PIT channel 0 IRQ flag.*/
PIT.CH[0].TFLG.R = 1;
OSAL_IRQ_EPILOGUE();
}
#endif
Example Code main.c (cf below) V2.0:
you can see the LED is blinking when the interruption PIT0 happenned
//Orhan YILMAZ v2.0 (Updated by Erwan)
//Timer Example
typedef
enum
{
FALSE,
TRUE
}
BOOL
;
#define PIT0_VECTOR 59
void
StartupInit(
void
);
void
Port_conig(
void
);
void
WDT_disable(
void
);
void
PIT0_Init(unsigned
int
TimeOut);
void
PIT0_Start(
void
);
static
void
PIT_0_Handler(
void
);
/**
* @brief IRQ handler function declaration.
* @details This macro hides the details of an ISR function declaration.
*
* @param[in] id a vector name as defined in @p vectors.s
*/
#define IRQ_HANDLER(id) void id(void)
void
Interrup_Enable(
void
);
#include ''components.h''
#include ''xpc560b.h''
/*
* Application entry point.
*/
unsigned
long
i = 0;
int
main(
void
) {
componentsInit();
//CLK Init.
StartupInit();
//WDT Disable
WDT_disable();
//Port
Port_conig();
//Timer
PIT0_Init(0xFFFFF);
//IRQ Config
Interrup_Enable();
PIT0_Start();
while
(TRUE) {
if
(i == 0xFFFFFF)
{
//SIU.GPDO[90].B.PDO ^= 1;
i = 0;
}
i++;
}
}
//PORT CONFIGURATION
void
Port_conig(
void
)
{
//Working Led
SIU.PCR[90].B.OBE = 1;
SIU.GPDO[90].B.PDO = 0;
//Output Low
}
//PIT0 Initial Function
void
PIT0_Init(unsigned
int
TimeOut)
{
PIT.PITMCR.R = 0x000000001;
//Enable PIT and Configure to stop in debug mode
PIT.CH[0].LDVAL.R = TimeOut;
//Timeout enter
//Tclk = SystemCLK
INTC_PSR(PIT0_VECTOR)=5;
//PIT_0_Handler, 59, 5;
}
/**
* @brief PIT channel 0 interrupt handler.
*
* @isr
*/
IRQ_HANDLER(vector59) {
PIT_0_Handler();
}
//PIT0 Start Function
void
PIT0_Start(
void
)
{
//TIE = 1 Timer Interrup Enable
//TEN = 1 Timer Enable
PIT.CH[0].TCTRL.R = 3;
}
void
WDT_disable(
void
)
{
//Watchdog Timer Disable
SWT.SR.R = 0x0000c520;
/* Write keys to clear soft lock bit */
SWT.SR.R = 0x0000d928;
SWT.CR.R = 0x8000010A;
/* Clear watchdog enable (WEN) */
}
/*************************
*CLK CONFIGURATION
*************************/
void
StartupInit(
void
)
{
//Check Configurations
while
(ME.GS.B.MTRANS);
//Global Status Register wait for mode transition to complete
while
(ME.GS.B.CURRENTMODE != 4);
//Global Status Register verify RUN0 Current mode
}
//*********IRQ***********//
void
Interrup_Enable(
void
)
{
INTC.CPR.B.PRI = 0;
// Lower INTC's current priority
asm(
''wrteei 1''
);
//Enable external interrupt ================>>> PROBLEM THIS LINE
}
static
void
PIT_0_Handler(
void
)
{
PIT.CH[0].TFLG.B.TIF = 1;
SIU.GPDO[90].B.PDO ^= 1;
palTogglePad(PORT_E, PE_LED1);
}
Best Regards
Erwan
2014-11-14 04:52 AM
/**
* @brief PIT channel 0 interrupt handler.
*
* @isr
*/
#if 0
OSAL_IRQ_HANDLER(vector59) {
OSAL_IRQ_PROLOGUE();
osalSysLockFromISR();
osalOsTimerHandlerI();
osalSysUnlockFromISR();
/* Resets the PIT channel 0 IRQ flag.*/
PIT.CH[0].TFLG.R = 1;
OSAL_IRQ_EPILOGUE();
}
#endif
Example Code main.c (cf below) V2.0:
you can see the LED is blinking when the interruption PIT0 happenned
//Orhan YILMAZ v2.0 (Updated by Erwan)
//Timer Example
typedef
enum
{
FALSE,
TRUE
}
BOOL
;
#define PIT0_VECTOR 59
void
StartupInit(
void
);
void
Port_conig(
void
);
void
WDT_disable(
void
);
void
PIT0_Init(unsigned
int
TimeOut);
void
PIT0_Start(
void
);
static
void
PIT_0_Handler(
void
);
/**
* @brief IRQ handler function declaration.
* @details This macro hides the details of an ISR function declaration.
*
* @param[in] id a vector name as defined in @p vectors.s
*/
#define IRQ_HANDLER(id) void id(void)
void
Interrup_Enable(
void
);
#include ''components.h''
#include ''xpc560b.h''
/*
* Application entry point.
*/
unsigned
long
i = 0;
int
main(
void
) {
componentsInit();
//CLK Init.
StartupInit();
//WDT Disable
WDT_disable();
//Port
Port_conig();
//Timer
PIT0_Init(0xFFFFF);
//IRQ Config
Interrup_Enable();
PIT0_Start();
while
(TRUE) {
if
(i == 0xFFFFFF)
{
//SIU.GPDO[90].B.PDO ^= 1;
i = 0;
}
i++;
}
}
//PORT CONFIGURATION
void
Port_conig(
void
)
{
//Working Led
SIU.PCR[90].B.OBE = 1;
SIU.GPDO[90].B.PDO = 0;
//Output Low
}
//PIT0 Initial Function
void
PIT0_Init(unsigned
int
TimeOut)
{
PIT.PITMCR.R = 0x000000001;
//Enable PIT and Configure to stop in debug mode
PIT.CH[0].LDVAL.R = TimeOut;
//Timeout enter
//Tclk = SystemCLK
INTC_PSR(PIT0_VECTOR)=5;
//PIT_0_Handler, 59, 5;
}
/**
* @brief PIT channel 0 interrupt handler.
*
* @isr
*/
IRQ_HANDLER(vector59) {
PIT_0_Handler();
}
//PIT0 Start Function
void
PIT0_Start(
void
)
{
//TIE = 1 Timer Interrup Enable
//TEN = 1 Timer Enable
PIT.CH[0].TCTRL.R = 3;
}
void
WDT_disable(
void
)
{
//Watchdog Timer Disable
SWT.SR.R = 0x0000c520;
/* Write keys to clear soft lock bit */
SWT.SR.R = 0x0000d928;
SWT.CR.R = 0x8000010A;
/* Clear watchdog enable (WEN) */
}
/*************************
*CLK CONFIGURATION
*************************/
void
StartupInit(
void
)
{
//Check Configurations
while
(ME.GS.B.MTRANS);
//Global Status Register wait for mode transition to complete
while
(ME.GS.B.CURRENTMODE != 4);
//Global Status Register verify RUN0 Current mode
}
//*********IRQ***********//
void
Interrup_Enable(
void
)
{
INTC.CPR.B.PRI = 0;
// Lower INTC's current priority
asm(
''wrteei 1''
);
//Enable external interrupt ================>>> PROBLEM THIS LINE
}
static
void
PIT_0_Handler(
void
)
{
PIT.CH[0].TFLG.B.TIF = 1;
SIU.GPDO[90].B.PDO ^= 1;
palTogglePad(PORT_E, PE_LED1);
}
Best Regards
Erwan
2014-11-28 04:23 AM
Thanks for reply. But,
I had
to solve
in a different way
. (3 week ago)
. Best Regards Orhan YILMAZ2017-08-10 02:00 AM
Hello!
I have the same problem too.
If you don't mind, please let me know the solution in detail.Thank you.