Forum: Mikrocontroller und Digitale Elektronik EFM32 - Set Pin on Input with PullUp / Pin auf Eingang mit PullUp EFM32


von Großes F. (112)


Lesenswert?

Hello everybody,

I have got no idea what is wrong with the following code:
All I want to do, is to set a Pin on "input-Mode" with a PullUp, but  if 
I measure the voltage at the Pin, all I get is between 0.4V and 0.5V.
I had expected a Value about ~3.2 V, and so the Interrupt Routine 
doesn't start either.

Do I somehow have destroyed the entrance, or could the mistake be solved 
within the code?


The code is below after the german version of the question:
_____________________

Hallo allerseits,

bin gerade etwas ratlos.
Ich dachte, ich hätte mit meinem Code einen Pin auf Eingang gesetzt und 
den Pulluip aktiviert.

Nachmessen zeigt allerdings, dass nur 0,4 bis 0,5 Volt anliegen.

Hab ich den Eingang irgendwie zerschossen, oder liegt es nur an dem 
Code?

_____________________________


CMU_ClockEnable(cmuClock_GPIO, true);   //GPIO mit Clock verdrahten

GPIO_PinModeSet(gpioPortC, 14, gpioModeInputPull, 1);  //Input with 
PullUp
GPIO_IntConfig(gpioPortC, 14, false, true, true);

NVIC_ClearPendingIRQ(GPIO_EVEN_IRQn);
NVIC_EnableIRQ(GPIO_EVEN_IRQn);



thanks to everyone
allen ein Dankeschön
von Ben j. (scarab)


Lesenswert?

is "GPIO_IntConfig" some kind of PinChange-Interrupt?
___________________________________________________

ist "GPIO_IntConfig" sowas wie ein PinChange-Interrupt?
von Großes F. (112)


Lesenswert?

yes it is.

thank all of you for reading this. Sometimes the error is too simple.
I have measured the impedance between the neigbhoured pins and found out 
that it was much too small.
So I took a cotton stick and some acetone and cleaned it up. Now I get 
the desirerd high voltage level of 3.3V...

...but now another error occurs and this is not a hardwareproblem, it 
has to do with the interrupts.


/***************************************/

void SysTick_Handler(void)
{
  msTicks++;       /* incr counter used in Delay()*/
}

/**************************************/
void GPIO_EVEN_IRQHandler(void)
{
  GPIO_IntClear(1 << 14);
}
/**************************************/
void Delay(uint32_t dlyTicks)
{
  uint32_t curTicks;

  curTicks = msTicks;
  while ((msTicks - curTicks) < dlyTicks) ;
}
/**************************************/

// Taster Pin PC14 set to Input Falling Edge
void Taster_config(void)
{
  GPIO_PinModeSet(gpioPortC, 14, gpioModeInputPullFilter, 1);
  GPIO_IntConfig(gpioPortC, 14, false, true, true);

  NVIC_ClearPendingIRQ(GPIO_EVEN_IRQn);
  NVIC_EnableIRQ(GPIO_EVEN_IRQn);
}

__________________________________

int main(void)
{
CHIP_Init();
SystemCoreClockUpdate();
if (SysTick_Config(SystemCoreClock / 1000)) while (1) ;

//Clock connect with GPIO Module
CMU_ClockEnable(cmuClock_GPIO, true);

//Benutzer_LED als Push-Pull-Drive mit 0.5 mA einstellen
GPIO_DriveModeSet(gpioPortA, gpioDriveModeLowest);  //0.5 mA 
GPIO_PinModeSet(gpioPortA, 1, gpioModePushPullDrive , 0);

Taster_config();

while(1)
    {
    Delay(500);
    GPIO_PinOutToggle(gpioPortA, 1);

    }//end while(1)
}//end main


So... the programm lights up the LED in 0.5sec and another 0.5 sec. it 
is dark.
Then the programm hang up, wehn the Button PC14 is pressed...

What can I do against this?


Thanks in advance!
von Christian V. (chrisvol)


Lesenswert?

Hi

The code seems fine, but I suspect your project settings might be set up 
for the wrong device. If your project includes the startup file for a 
Gecko micro, the interrupt vectors will not match a Tiny Gecko for 
instance. This could cause the kind of error you are experiencing. There 
are some guidelines on how to port a project here:

http://support.energymicro.com/entries/20287387-port-iar-project-from-gecko-to-tiny-gecko

Christian
von Hendrik L. (hlipka)


Lesenswert?

You can also try to debug this. When I experience hangs, I just pause 
the program in the debugger, and look what the EFM32 is doing right now 
- with the stack trace I usually see where the culprit lies. (I'm using 
the IAR toolchain)
Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.