yet another EXT question

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
User avatar
alex31
Posts: 445
Joined: Fri May 25, 2012 10:23 am
Has thanked: 57 times
Been thanked: 88 times

yet another EXT question

Post 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
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: yet another EXT question

Post 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
User avatar
barthess
Posts: 861
Joined: Wed Dec 08, 2010 7:55 pm
Been thanked: 7 times

Re: yet another EXT question

Post 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.
Post Reply