Search found 45 matches

by bittware
Thu Oct 20, 2022 2:12 am
Forum: General Discussion and Questions
Topic: Enabling a timer PWM channels in-sync
Replies: 6
Views: 31901

Re: Enabling a timer PWM channels in-sync

Another method would be use a timer as the clock source and then slave 2 other timers off of it. Timer1 & 8 can both be slaved off of timers 2, 4, and 5. So lets say you picked timer 2. You setup timers 1 & 8 and disable them (using the CEN bit). Then set them up as slaves (this will require using ...
by bittware
Wed Jul 27, 2022 7:14 am
Forum: MicroPython pyboard
Topic: Why is the interrupt queued?
Replies: 5
Views: 25505

Re: Why is the interrupt queued?

After a few trials, I found the ISR seems to be scheduled implicitly even though micropython.schedule() is never explicitly called.
This is a little werid. By what standard, this kind of auto schedule is invovled?
by bittware
Wed Jul 27, 2022 3:44 am
Forum: MicroPython pyboard
Topic: Why is the interrupt queued?
Replies: 5
Views: 25505

Why is the interrupt queued?

I'm using the pyboard and my interrupt comes in every 3.3ms. The interrupt source is connected to a GPIO input. pin_int.irq(trigger=Pin.IRQ_RISING, handler=tick) The interrupt service route is plain. def tick(int_pin): loop_test1.high() # blahblahblah loop_test1.low() loop_test1 is a GPIO output con...
by bittware
Mon Jul 18, 2022 8:50 am
Forum: MicroPython pyboard
Topic: How to make PWM rising edge trigger an interrupt?
Replies: 27
Views: 68805

Re: How to make PWM rising edge trigger an interrupt?

The riddle: Printing started immediately. When you inserted sleep_ms(200) before the print('total',....) then you got a higher number and the slight irregularities in the t-diffs vanished (only 300 and 700 remain). Oh, yes, I get it. I was thinking print total at the very end, then the total number...
by bittware
Mon Jul 18, 2022 2:36 am
Forum: MicroPython pyboard
Topic: How to make PWM rising edge trigger an interrupt?
Replies: 27
Views: 68805

Re: How to make PWM rising edge trigger an interrupt?

from pyb import Pin, Timer from time import ticks_us, ticks_diff, sleep_ms from array import array import micropython micropython.alloc_emergency_exception_buf(160) pb3 = Pin('B3') # ------- B3 has TIM2, CH2 on Stm32F411 Blackpill board ---- tim = Timer(2, freq=1000) ch = tim.channel(2, Timer.PWM, ...
by bittware
Sun Jul 17, 2022 1:27 am
Forum: MicroPython pyboard
Topic: How to make PWM rising edge trigger an interrupt?
Replies: 27
Views: 68805

Re: How to make PWM rising edge trigger an interrupt?

Almost all internal counters can be programmed to trigger an interrupt if the count range is reached, which is at every period of PWM. With pyb.Timer you could check, if the callback options of timer.channel is doing that. Alternatively, you can connect the PWM output to an input Pin object and use...
by bittware
Sun Jul 17, 2022 1:21 am
Forum: MicroPython pyboard
Topic: How to make PWM rising edge trigger an interrupt?
Replies: 27
Views: 68805

Re: How to make PWM rising edge trigger an interrupt?

tepalia02 wrote:
Sat Jul 16, 2022 10:28 am
Which particular board do you want to use? ESP32?
The pyboard in my case
by bittware
Fri Jul 15, 2022 11:41 am
Forum: MicroPython pyboard
Topic: How to make PWM rising edge trigger an interrupt?
Replies: 27
Views: 68805

How to make PWM rising edge trigger an interrupt?

Is it possible to have a pin output PWM meanwhile let the output's rising or falling edge trigger an interrupt?
by bittware
Mon Jun 27, 2022 12:57 pm
Forum: MicroPython pyboard
Topic: Are different channels of the same timer synchronized in nature?
Replies: 2
Views: 21999

Re: Are different channels of the same timer synchronized in nature?

dhylands wrote:
Sun Jun 26, 2022 5:59 pm
Yes - different channels of the same timer are synchronized. Some of the timers also support "center-aligned mode" where the centers of the two pulse will be aligned rather than the leading edge.
That's awesome. Thank you dhylands!
by bittware
Sun Jun 26, 2022 1:32 am
Forum: MicroPython pyboard
Topic: Are different channels of the same timer synchronized in nature?
Replies: 2
Views: 21999

Are different channels of the same timer synchronized in nature?

Are different channels of the same timer synchronized in nature? Say on pyboard, PB0 and PB1 correspond to TIM3_CH3 and TIM3_CH4 respectively. If I ever set CH3 and CH4 with different PWM duty cycle and have PB0 and PB1 PWM outputs hooked to oscilloscope, are these two signals synchronized (i.e. ris...