Open bmentink opened 2 years ago
What would the function/method look like for this? Is there a function you'd like replicated from the C SDK or micropython?
I have no idea at this stage, I will try and find out what Arduino C code implements..
Alright, I'll see if I begin dipping my toes into writing code again these days.
Cool, many thanks ...
Please take a look at https://github.com/tinygo-org/tinygo/pull/2684. Let me know if it works for you and what else would be required for your use case.
Wow that was quick, thanks will try it out ....
Remind me again how to patch that file with git ... or is it applied to the commit you did with the PWM max frequency fix, if so I already have that code pulled on my machine ..
EDIT: I did a git checkout rp2040-pwm-int
to switch to that branch, and did a make
, but I get this error: /usr/bin/ld: cannot find -llldMachO2
any idea's ?
Also does the above branch include the pwmfreqfix? `
EDIT2: Nevermind, I changed to the rp2040-pwm-int
branch, grabbed a copy of the file, switch back to rp-2040-pwmfreqfix
and copied the file to that branch, compiled, seemed to work just fine.
Now, how do I setup a callback function? It is not clear from the code ..
Don't we need a: pwm.SetInterrupt(machine.PinRising, handler)
somewhere? .. like the way it's done for GPIO
.. or use theinterrupt.xxxx
mechanism ..
Cheers
Right, so apparently theres more to it than just setting up the IRQ. I've tried to dive into the pico SDK interrupt code but have been unable to port some parts of it since it's beyond my understanding on how the NVIC works for ARM processors. I'm really just a hobbyist who really wanted to use the pico and had no experience with embedded programming. My progress with the full interrupts implementation is over here https://github.com/soypat/tinygo/tree/rp2040-sync
I don't think you are "just" a hobbyist at all, based on all your code efforts. I am an embedded engineer, but have no experience with TinyGo, but happy to test code to improve TinyGo as I think it is great ..
I am using TinyGo to implement a sensorless BLDC motor controller at the moment and am struggling with real-time support, so any help with getting full interrupt support would be great.
I also think the Pico is a great embedded platform and when TinyGo gets full support for the PIO unit, it will be a great combo ..
Hmmmm, I'm gonna throw a little brainstorm your way: what about shorting a pwm signal to a GPIO pin with an interrupt set? Is that too hacky?
I'm also looking forward to PIO support... someday...
Yep, had thought of that, is a bit of a hack, and the pwm update won't be double buffered anymore..
On Tue, 8 Mar 2022, 9:16 am Patricio Whittingslow, @.***> wrote:
Hmmmm, I'm gonna throw a little brainstorm your way: what about shorting a pwm signal to a GPIO pin with an interrupt set? Is that too hacky?
— Reply to this email directly, view it on GitHub https://github.com/tinygo-org/tinygo/issues/2683#issuecomment-1061092372, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACNHVB6HNY3A6O5DIAW42DTU6ZPZPANCNFSM5QAOI4CA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you authored the thread.Message ID: @.***>
Hi,
Requesting that support for PWM interrupts be added to the
machine_rp2040_pwm.go
driver, especially handling for the overflow interrupt.This is required when you want to update PWM duty synchronous with the PWM cycle ..
From the manual: