Page 1 of 1

STM32F407 EXT driver

Posted: Sun Sep 02, 2012 5:51 pm
by matess
Hi all,

I need checking three different impulses on three separate pins. I modified EXT driver demo located in ChibiOS_2.4.2\testhal\STM32F4xx\EXT folder. Everything works, but the interrupt responds to both edges regardless of the configuration. I need the two pins that the response at the rising edge and one on the falling edge.

Pulse frequency is 20Hz duty cycle of about 50%.

EXT driver configuration is:

Code: Select all

static const EXTConfig extcfg = {
  {
   {EXT_CH_MODE_RISING_EDGE | EXT_CH_MODE_AUTOSTART, extcb1},
   {EXT_CH_MODE_RISING_EDGE | EXT_CH_MODE_AUTOSTART, extcb1},
   {EXT_CH_MODE_DISABLED, NULL},
   {EXT_CH_MODE_DISABLED, NULL},
   {EXT_CH_MODE_FALLING_EDGE | EXT_CH_MODE_AUTOSTART, counter},
   {EXT_CH_MODE_DISABLED, NULL},
   {EXT_CH_MODE_DISABLED, NULL},
   {EXT_CH_MODE_DISABLED, NULL},
   {EXT_CH_MODE_DISABLED, NULL},
   {EXT_CH_MODE_DISABLED, NULL},
   {EXT_CH_MODE_DISABLED, NULL},
   {EXT_CH_MODE_DISABLED, NULL},
   {EXT_CH_MODE_DISABLED, NULL},
   {EXT_CH_MODE_DISABLED, NULL},
   {EXT_CH_MODE_DISABLED, NULL},
   {EXT_CH_MODE_DISABLED, NULL},
   {EXT_CH_MODE_DISABLED, NULL},
   {EXT_CH_MODE_DISABLED, NULL},
   {EXT_CH_MODE_DISABLED, NULL},
   {EXT_CH_MODE_DISABLED, NULL},
   {EXT_CH_MODE_DISABLED, NULL},
   {EXT_CH_MODE_DISABLED, NULL},
   {EXT_CH_MODE_DISABLED, NULL}
  },
EXT_MODE_EXTI(EXT_MODE_GPIOA,
              EXT_MODE_GPIOA,
              0,0,
              EXT_MODE_GPIOA,
              0,0,0,0,0,0,0,0,0,0,0)
};


and in main() section:

Code: Select all

palSetPadMode(GPIOA, 0, PAL_MODE_INPUT);
palSetPadMode(GPIOA, 1, PAL_MODE_INPUT);
palSetPadMode(GPIOA, 4, PAL_MODE_INPUT);

extStart(&EXTD1, &extcfg);


You do not know where it may be wrong?

Re: STM32F407 EXT driver

Posted: Sun Sep 02, 2012 6:03 pm
by Giovanni
Hi,

Nothing wrong in the code apparently and I don't see obvious problems in the driver itself. Is the input signal "clean"? The input is very fast compared to the speed of your input, it could be triggered by short bounces or ringing on the fronts.

Giovanni

Re: STM32F407 EXT driver

Posted: Sun Sep 02, 2012 6:48 pm
by matess
Hi,

thanks for promp reply. I do not think it would be ringing pulse. I precisely corresponds to the response to the leading edge and then immediately on the falling edge. I tried to remove flicker both hardware and software.

I hope I wrote it understandable, my English is not very good.

Re: STM32F407 EXT driver

Posted: Sun Sep 02, 2012 7:04 pm
by Giovanni
No problems for English, your is better than mine anyway.

Could you try to use ChibiOS 2.5.0 from the repository? the EXT driver is different in the new version. This could help us find out if there is a problem in the 2.4.2 driver.
Note that the configuration structure is shorter, ports are ORed with channel settings in the new driver.

Giovanni

Re: STM32F407 EXT driver

Posted: Sun Sep 02, 2012 7:17 pm
by matess
Thank you for information. Try version 2.5.0 and see if that helps. Anyway, here I will show the result. Today it already late, but tomorrow I already have the result.

Re: STM32F407 EXT driver

Posted: Mon Sep 03, 2012 5:24 pm
by matess
Hi all,

I have a result. I tried the new version chibios and problem is the same. So the problem is not in the EXT driver chibios. It works perfectly.

The problem will be a massive overshoot by closing the contact and my hw and sw filter was unable to eliminate it. So I adjusted the input circuit and prolonged the debounce time and now everything works great.

Sorry for this needless thread, but I have at the moment out of the oscilloscope, so I could not detect. It is true that I did not expect this behavior. The standard contacts it works great. Here it is probably a poor relay.

Anyway, thank you for all the answers and I wish the project chibios long and trouble-free operation.