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.

GPIO PortB Interrupt. Rising Edge not working

Hello, everyone

  I'm having a problem while trying to detect a 'rising edge' interrupt on pin PB1. (I'm using a TM4C123G, as I stated in another post, which I'll soon update, as soon as I get this part working).

I've read numerous posts, the part's datasheet, the errata, the peripheral Driver manual, everything I could find... but still can't manage to work around this issue. 

This is the code I use to configure GPIO's  PB1 as an interrupt source for Rising Edge signals:

void  InitializeSensor(void)
    {

    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB); //PORT B
    ROM_SysCtlDelay(3);
    GPIOPinTypeGPIOInput(GPIO_PORTB_BASE, GPIO_PIN_1);   //PB1
   
//  GPIOPadConfigSet(GPIO_PORTB_BASE, GPIO_PIN_1, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPD);
	
    ROM_GPIOIntTypeSet(GPIO_PORTB_BASE, GPIO_PIN_1, GPIO_RISING_EDGE);
   
    GPIOIntEnable(GPIO_PORTB_BASE, GPIO_PIN_1);  
   
    ROM_IntEnable(INT_GPIOB);
    }

This is my Interrupt Handler Routine:

void
GPIOBInthandler(void)
{
    unsigned long ulStatus;
    ulStatus = GPIOIntStatus(GPIO_PORTB_BASE, true);

    GPIOIntClear(GPIO_PORTB_BASE, GPIO_PIN_1);   //Clear Interrupt

    if((ulStatus & GPIO_PIN_1)==GPIO_PIN_1) 
    {
	SensorCounter++; 
			
    }
}

And finally, this is the circuit I've used to generate the digital signal:

Some clarifications:

i)  I've connected every other PORTB input to GND through a 100ohm resistor, so they don't generate "false" interrupts.

ii) I've used 100 ohm in R2, so I can use the "Weak Pull Down" option.

iii) I've correctly added the Interrupt Handler in the Startup file.

iv) The digital "high" signal voltage level, is around 3V (As PB1 can stand up to 3.6V)

v) I've checked the errata, but It doesn't mention any failure regarding PB1 input.

When I execute the program, I'm having the interruption permanently triggered, even when there isn't any voltage present in PB1. 

When I DO trigger the sensor, (i.e, obtain the 3V in the pin), I don't get any response at all..

I'd appreciate any feedback on this matter.

Kind Regards,

Martín

  • OK, apparently I've solved it. I had a "floating GND" issue.
    After all this time, I should have known... but well.. "### happens", right?

    Thanks for taking the time to read this.
    In any case, here's a working code for reading an interrupt using PB1... =) hehe
    Regards,

    Martín
  • Hello Martin

    Floating GND of the input reference circuit to the TM4C?

    Regards
    Amit
  • Hello Amit,
    Yes. The GND of the input circuit wasn't connected with the GND of the TM4C. A most obvious mistake wich passed right under my eyes.
    It was, of course, picking every available noise ...
    Thanks for the reply.
    Regards

    Martín
  • Martin Cunningham said:
    The GND of the input circuit wasn't connected with the GND of the TM4C

    This is not at all uncommon - and may be prevented.

    Our small tech firm often (weekly, maybe twice weekly) design/develop such small prototype circuits (for this vendor's & other's Eval boards - and for the highest volume of our firm's custom pcbs) and we always arrange a repetitive, stylized interconnect back to the target Eval board.   

    We always include an efficient, low current "Power Led" and it & the proto's ground (always - and only) return to ground @ the Eval board.   In this way - the proto board's Led will only illuminate if & when the proto & Eval board's ground is made common.    This enables a separate (and additional) power source for the proto board when the Eval board - by itself - proves inadequate to power both itself & the prototype...

    Such method limits the total (two board) current flow to 2-3 Amps.   (that supported by "most" Eval boards.)

    Recently we implemented a high current (hall-effect style) current sensor - designed to support the accurate measure of 50 Amps.   In this case - we'd likely vaporize the ground trace/pads on (any) Eval board - thus a different method must be employed.   Under these conditions - we (normally) add such, "correct interconnect monitor Led" to the Eval board - which forces both that Led & the Eval board's ground - to travel to (and through) the seriously robust ground trace & connections on the prototype board - which returns to "power ground."

    We've not had any instance of, "Missing ground" reported upon implementing these techniques.