Page 1 of 1

yet another EXT question

Posted: Thu Jun 07, 2012 2:46 pm
by alex31
Hello.

1/ I don't understand how to use EXTConfig array, configuring the port is easy, but how to specify the input pin ?

What should i put in the array if i want, by example to call
extcbA0 on GPIOA,INPUT0
extcbA1 on GPIOA,INPUT1
extcbB0 on GPIOB,INPUT0
extcbB1 on GPIOB,INPUT1

something like

Code: Select all

   {EXT_CH_MODE_BOTH_EDGES | EXT_CH_MODE_AUTOSTART | EXT_MODE_GPIOA, extcbA0},
    {EXT_CH_MODE_BOTH_EDGES | EXT_CH_MODE_AUTOSTART | EXT_MODE_GPIOA, extcbA1},
    {EXT_CH_MODE_BOTH_EDGES | EXT_CH_MODE_AUTOSTART | EXT_MODE_GPIOB, extcB0},
    {EXT_CH_MODE_BOTH_EDGES | EXT_CH_MODE_AUTOSTART | EXT_MODE_GPIOB, extcB1},


?

2/ I see no way to pass a user parameter to the extcallback_t callback, i want to call the same callback with
different values of parameter for each entries, should i use as many stub cb which will call my unique fonction with
the right parameter ?


Thanks
Alexandre

Re: yet another EXT question

Posted: Thu Jun 07, 2012 3:30 pm
by Giovanni
Hi,

In STM32 the EXTI unit does not allow the use of any pin. Pin 0 can be used on port A or port B or port C etc but not on multiple ports.

That table reflects this limitation, the first row configures the EXTI channel 0 which can be mapped on one of the ports as pin 0, the seconds maps the channel 1 and so on.

Code: Select all

extcbA0 on GPIOA,INPUT0
extcbA1 on GPIOA,INPUT1
extcbB0 on GPIOB,INPUT0
extcbB1 on GPIOB,INPUT1


You can't do this, IN0 can go in A or B but not both, same for IN1.

Giovanni

Re: yet another EXT question

Posted: Fri Jun 08, 2012 8:15 am
by barthess
There is workaround for using any pin.
Pin 0 on port A on port B on port C etc are logically ORed inside EXTI cell. You can check states of input pins from callback function by simple reading from ports (A, B, C, etc) registers. But there is risk of missing of input pulses.