registered function on Timerchannel gets not executed

Questions and discussion about The WiPy 1.0 board and CC3200 boards.
Target audience: Users with a WiPy 1.0 or CC3200 board.
Post Reply
tlo
Posts: 3
Joined: Tue Nov 24, 2015 8:15 pm

registered function on Timerchannel gets not executed

Post by tlo » Tue Nov 24, 2015 8:28 pm

Hi,
i try to register a user defined function for a periodic timer interupt on the wipy.
This works:

Code: Select all

tim = Timer(1, mode=Timer.PERIODIC)
tim_a = tim.channel(Timer.A, freq=700)
tim_a.irq(handler=lambda t: pin_step.toggle())

This not. There is no error, the wipy just seems to ignore the handler silently.:

Code: Select all

def stepnext():
    pin_step.toggle()

tim = Timer(1, mode=Timer.PERIODIC)
tim_a = tim.channel(Timer.A, freq=700)
tim_a.irq(handler=lambda t: stepnext())
#I also tried this:
#tim_a.irq(handler=stepnext())
Am i missing something?
Thanks Thilo

Oli_
Posts: 15
Joined: Sun Nov 15, 2015 1:36 am

Re: registered function on Timerchannel gets not executed

Post by Oli_ » Tue Nov 24, 2015 10:11 pm

According to some example found in the documentaton, this work like that :

Code: Select all

def stepnext(timer):
    pin_step.toggle()

tim = Timer(1, mode=Timer.PERIODIC)
tim_a = tim.channel(Timer.A, freq=700)
tim_a.irq(handler=stepnext)

tlo
Posts: 3
Joined: Tue Nov 24, 2015 8:15 pm

Re: registered function on Timerchannel gets not executed

Post by tlo » Tue Nov 24, 2015 10:43 pm

Yep, thats it. I seems to have overlooked the parameter of the function.
Thanks a lot!

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: registered function on Timerchannel gets not executed

Post by pythoncoder » Wed Nov 25, 2015 7:38 am

This is surely a bug. Even with

Code: Select all

import micropython
micropython.alloc_emergency_exception_buf(100)
the version where the ISR has no argument quietly fails to run with no error message being reported.
Peter Hinch
Index to my micropython libraries.

Post Reply