Author Topic: STM32L431RBT6 - trigger timer from EXTI? Or generic pin?  (Read 1225 times)

0 Members and 1 Guest are viewing this topic.

Offline daqqTopic starter

  • Super Contributor
  • ***
  • Posts: 2302
  • Country: sk
    • My site
STM32L431RBT6 - trigger timer from EXTI? Or generic pin?
« on: July 04, 2022, 11:08:31 am »
Hi,

In a project I need to trigger a timer (any will do) from a specific pin (PA7) on the STM32L431RBT6. I think I read somewhere that you can start/trigger a timer from EXTI or an event, but I can't find it anywhere. Is this just a case of me misremembering, or is it just really hard to find?

Something more direct than just use the EXTI interrupt, jump into it, software start the timer, leave.

Ideally the pin would have been routed onto a normal input - and it was, but the MCU used originally is unavailable and the only pin-compatible replacement that is borderline available does not have a timer channel on that location.

Thanks,

David
Believe it or not, pointy haired people do exist!
+++Divide By Cucumber Error. Please Reinstall Universe And Reboot +++
 

Offline wek

  • Frequent Contributor
  • **
  • Posts: 495
  • Country: sk
Re: STM32L431RBT6 - trigger timer from EXTI? Or generic pin?
« Reply #1 on: July 04, 2022, 02:39:07 pm »
Ahoj,

> Is this just a case of me misremembering

Most likely this.

> Something more direct than just use the EXTI interrupt, jump into it, software start the timer, leave.

Analog watchdog on ADC1_IN12 won't count as "more direct", I'm afraid...

> borderline available

Oh, so that was YOU who bought these out! :-)

I feel your pain.

JW
 
The following users thanked this post: daqq

Offline daqqTopic starter

  • Super Contributor
  • ***
  • Posts: 2302
  • Country: sk
    • My site
Re: STM32L431RBT6 - trigger timer from EXTI? Or generic pin?
« Reply #2 on: July 06, 2022, 08:48:38 am »
Thanks, thought as much :(
Quote
Oh, so that was YOU who bought these out! :-)
Not me, but I know the company that bought out a certain other uC ;)
Believe it or not, pointy haired people do exist!
+++Divide By Cucumber Error. Please Reinstall Universe And Reboot +++
 

Offline wek

  • Frequent Contributor
  • **
  • Posts: 495
  • Country: sk
Re: STM32L431RBT6 - trigger timer from EXTI? Or generic pin?
« Reply #3 on: July 06, 2022, 12:09:57 pm »
Btw. I still believe the the analog watchdog pushed to extreme (6-bit conversion, shortest possible sampling - this is subject to experimentation due to PA7 being "slow" ADC input), triggering TIM1 through ETR_ADC1_RMP, is a viable option; of course depending on whether your application uses ADC1 in any other way or not.

Latency is IMO comparable to EXTI  - if 2.5tADC sampling time would be viable, a conversion is 9cyc but even with 6.5tADC sampling it's just 13cyc; plus whatever time it takes the ADC to perform the WD comparison and propagate the signal to TIM, but that IMO should be well below half a dozen, so that's say 15-20cyc. Unfortunately 9/13cyc of that is jitter, too.

Conversely with EXTI, considering minimal hand-optimized-in-asm ISR running out of 0WS memory (RAM),  latency is 12+longest_instruction+load_TIM_address+load_value_to_trigger_TIM+store_to_TIM, and that would be 15-20cyc :-). However, this assumes EXTI being of highest priority, and that there is no interrupt disable in the code. This is probably easier to write than the ADC_WD solution and allows any TIM to use, and the jitter will be lower, too; OTOH this is software with all the consequences.

JW
 
The following users thanked this post: daqq

Offline daqqTopic starter

  • Super Contributor
  • ***
  • Posts: 2302
  • Country: sk
    • My site
Re: STM32L431RBT6 - trigger timer from EXTI? Or generic pin?
« Reply #4 on: July 07, 2022, 06:29:04 am »
I actually thought about using the ADC that way, but the ADC is already used.

It'll be a challenge to write the assembly block that gets triggered that fast, but beggars can't be choosers. We'll see what's possible. But many thanks for the suggestions!
Believe it or not, pointy haired people do exist!
+++Divide By Cucumber Error. Please Reinstall Universe And Reboot +++
 

Offline langwadt

  • Super Contributor
  • ***
  • Posts: 4422
  • Country: dk
Re: STM32L431RBT6 - trigger timer from EXTI? Or generic pin?
« Reply #5 on: July 07, 2022, 07:32:48 am »
any other pins avaible for a bodgewire? like a solder blob to PA6 ?
 

Offline daqqTopic starter

  • Super Contributor
  • ***
  • Posts: 2302
  • Country: sk
    • My site
Re: STM32L431RBT6 - trigger timer from EXTI? Or generic pin?
« Reply #6 on: July 07, 2022, 08:35:36 am »
any other pins avaible for a bodgewire? like a solder blob to PA6 ?
Not for the volumes that'll be used. We could redo the board - that would be trivial. But not as a first option.
Believe it or not, pointy haired people do exist!
+++Divide By Cucumber Error. Please Reinstall Universe And Reboot +++
 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 4078
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: STM32L431RBT6 - trigger timer from EXTI? Or generic pin?
« Reply #7 on: July 07, 2022, 09:21:02 am »
The EXTI isn't wired up to the timers.
Your bad luck is having the TIM1_CH1N on the pin, when you short it to PA6 you can use TIM16_CH1 input capture.

For PA7 you can only use the exti interrupt, EXTI9_5. What requirements do you have that you think this is not suitable?
 

Offline enz

  • Regular Contributor
  • *
  • Posts: 134
  • Country: de
Re: STM32L431RBT6 - trigger timer from EXTI? Or generic pin?
« Reply #8 on: July 07, 2022, 09:22:28 am »
Couldn't you just use the EXTI to trigger a DMA transfer that starts the timer?
Should be the option with the lowest latency.

Or do i miss omething?
 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 4078
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: STM32L431RBT6 - trigger timer from EXTI? Or generic pin?
« Reply #9 on: July 07, 2022, 09:33:03 am »
@enz Only EXTI9 can trigger the DMA, you have to go via the DAC, which is of no help because op uses a pin 7.
EXTI7 is only connected to the ADC start conversion via (J)EXTSEL.
 

Offline enz

  • Regular Contributor
  • *
  • Posts: 134
  • Country: de
Re: STM32L431RBT6 - trigger timer from EXTI? Or generic pin?
« Reply #10 on: July 07, 2022, 09:53:57 am »
Uups, my bad.
Somehow i rememberd that any EXTI could trigger a DMA transfer.

Certainly not true.
 

Offline wek

  • Frequent Contributor
  • **
  • Posts: 495
  • Country: sk
Re: STM32L431RBT6 - trigger timer from EXTI? Or generic pin?
« Reply #11 on: July 07, 2022, 12:12:18 pm »
EXTI7 is only connected to the ADC start conversion via (J)EXTSEL.
My RM0394 lists only EXTI11 as EXT and EXTI15 as a JEXT option in the ADC chapter. Am I overlooking something?

JW
 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 4078
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: STM32L431RBT6 - trigger timer from EXTI? Or generic pin?
« Reply #12 on: July 07, 2022, 12:22:10 pm »
Oh no wait, the ADC's calls it EXT (no I) and has a separate selector. Almost.... |O
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf