Configurating EXTI for Events

Use this forum for requesting small changes in ChibiOS. Large changes should be discussed in the development forum. This forum is NOT for support.
alexblack
Posts: 239
Joined: Mon Sep 24, 2012 3:52 pm
Location: Donetsk
Been thanked: 27 times
Contact:

Configurating EXTI for Events

Postby alexblack » Thu Jan 23, 2020 5:13 pm

Hi.
I porting my old project from ChibiOS 17.x to current 19.x ( STM32F303). I used EXTI driver for processing pin change interrupt and analog comparator interrupt. Also it is used for event generation to start ADC from external pin, wake up the CPU from sleep mode by UART. New PAL functions for enabling and processing PIN CHANGE interrupts work well. Analog Comparator Interrupt also is working, I used extiEnableLine for this.
One question is about how to setup HARDWARE PIN EVENT for generation ADC START event for example.
palEnablePadEvent is setup only interrupt mode:

Code: Select all

file "..\os\hal\ports\STM32\LLD\GPIOv2\hal_pal_lld.c"
...
193 EXTI->IMR1 |= padmask;
194  EXTI->EMR1 &= ~padmask;
...

When I used EXTI driver - it do it. extiEnableLine do not work because it stopped by debug assertion:

Code: Select all

file "..\os\hal\ports\STM32\LLD\EXTIv1\stm32_exti.h"
...
66 /* Masked out lines must not be touched by this driver.*/
67   osalDbgAssert((mask & STM32_EXTI_IMR1_MASK) == 0U, "fixed lines");
...

What is the reason to do such check?
Also I used UARTs events (line 25 and 26) for wake up the CPU from deepsleep mode and it is also stopped by extiEnableLine.
Maybe there is another way to set EXTi in new 19.x version, but I can't found?

User avatar
Giovanni
Site Admin
Posts: 12747
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 694 times
Been thanked: 572 times
Contact:

Re: Configurating EXTI for Events

Postby Giovanni » Thu Jan 23, 2020 7:13 pm

Hi,

The reason is that fixed lines cannot be programmed, their bits into some registers are not defined (FTSR, RTSR for example). Probably another function is needed that just enables/disables the line without setting a "mode".

Giovanni

alexblack
Posts: 239
Joined: Mon Sep 24, 2012 3:52 pm
Location: Donetsk
Been thanked: 27 times
Contact:

Re: Configurating EXTI for Events

Postby alexblack » Fri Jan 24, 2020 6:50 am

I think for fixed lines it is simple to add some configuration bits to "ioeventmode_t mode" like "PAL_MODE_ACTION_EVENT" to function palEnablePadEvent and it will be ok.
For the other lines extiEnableLine looks ok, but for forbidden mask it is need to skip setting the FTSR, RTSR in function code, for example.

alexblack
Posts: 239
Joined: Mon Sep 24, 2012 3:52 pm
Location: Donetsk
Been thanked: 27 times
Contact:

Re: Configurating EXTI for Events

Postby alexblack » Tue Feb 11, 2020 12:28 pm

Hi.
There is no function extiDisableLine() in current EXTI model.
It may be like this:

Code: Select all

/**
 * @brief   STM32 EXTI line deinitialization.
 *
 * @param[in] line      line to be released
 *
 * @api
 */
void extiDisableLine(extiline_t line) {
  uint32_t mask = (1U << (line & 0x1FU));

  osalDbgCheck(line < STM32_EXTI_NUM_LINES);

#if STM32_EXTI_NUM_LINES > 32
  if (line < 32) {
#endif
    extiEnableGroup1(mask, 0);
#if STM32_EXTI_NUM_LINES > 32
  }
  else {
    extiEnableGroup2(mask, 0);
  }
#endif
}

User avatar
Giovanni
Site Admin
Posts: 12747
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 694 times
Been thanked: 572 times
Contact:

Re: Configurating EXTI for Events

Postby Giovanni » Tue Feb 11, 2020 3:22 pm

Hi,

Moved in change request.

Giovanni


Return to “Small Change Requests”

Who is online

Users browsing this forum: No registered users and 2 guests