IRQ problem MOD54417

Discussion to talk about hardware related topics only.
Post Reply
AtmxChih
Posts: 1
Joined: Fri May 11, 2018 4:31 pm

IRQ problem MOD54417

Post by AtmxChih »

Help, i need to determine the frequency of a square signal, so i have a code where I am using the interruptions.
When the square signal is in low, it actives the interruption to count and obtain the frequency of the signal.

But I have a problem with the IRQ7, when i use in falling or rising edge triggered,
the interrupt "re-trigger" a lot of times.
What can i do?, the code is below.

Im using a MOD 54417 Rev 1.4
( The frequency of my cuadratic signal is 60 hz. , and I dont use an external button to active the interruption).



/******************************************************************************/
#include <predef.h>
#include <stdio.h>
#include <ctype.h>
#include <startnet.h>
#include <autoupdate.h>
#include <dhcpclient.h>
#include <NetworkDebug.h>
#include <pins.h>
#include <pin_irq.h>
#include <sim5441x.h>
#include <pinconstant.h>
#include <intcdefs.h>
#include <cfinter.h> //Para interrupt

const char * AppName = "MOD5441x IRQ 7";

DWORD isr_count=0;

extern "C" {
void SetIntc(int intcnum, long func, int vector, int level);
}

OS_SEM IrqPostSem;

INTERRUPT(out_irq1_pin_isr,0X2100){
sim2.eport.epfr=0x80; // Clear the interrupt Edges 1 0 0 0 0 0 0 0
OSSemPost(&IrqPostSem);
isr_count++;
}

extern "C" {
void UserMain(void * pd);
void putdisp(unsigned short w);
}



//---------------------------------------------------------------------
// UserMain
//---------------------------------------------------------------------
void UserMain(void * pd)
{
InitializeStack();
OSChangePrio(MAIN_PRIO);
EnableAutoUpdate();

J2[48].function( PINJ2_48_IRQ7 );

//DWORD isr_count=0;

OSSemInit(&IrqPostSem,0);

sim2.eport.eppar=0x8000;
sim2.eport.epddr=0x0;
sim2.eport.epier=0x80;



SetIntc(0,(long)&out_irq1_pin_isr,7,1);
iprintf("Aplication Started");
//DWORD temp=0;

while(1){

OSSemPend(&IrqPostSem,0);
iprintf("Interrupt Switch was hit %ld times \r\n",isr_count);

}



}
User avatar
TomNB
Posts: 538
Joined: Tue May 10, 2016 8:22 am

Re: IRQ problem MOD54417

Post by TomNB »

Have you considered using one of the timer inputs for this? They are designed to do things like count pulses and measure frequency. In fact, I think the pulse generator - counter example program does what you are trying to do, without the overhead of a level 7 interrupt. You should really avoid using level 7 if at all possible since it is non-maskable.
Post Reply