Giter Club home page Giter Club logo

Comments (14)

midilab avatar midilab commented on September 25, 2024 2

Well after some hang about this issue i discovery that Tc3 library is bugged, also its marked as legacy already. So far looks like TCC0 library work as expected but i didnt conduct some deep tests to make sure, any way i think the best solution will be to port the usage of TCx or TCCx for directly register access, that will probrably be usable on a wide range of SAMDxx.

I was looking at https://github.com/khoih-prog/TimerInterrupt_Generic wich looks good to use as port but it requires the user to make patches before use the library, wich i want to avoid.

The reason i decide to make the whole port based on register handling is because the uCtrl makes use of Tc3 while uClock makes use of TCC0 on uMODULAR environments.

I will send news as soon as i get something done!

Once again thanks for the research over samd timers.

from uclock.

midilab avatar midilab commented on September 25, 2024 2

well the ideia was just to get the part of the code that handles the Timer(form SAMDx) at register level to implement a call at uClock to initialize the timer and to change the frequency but not to incorporate the whole library, but i just give up when i've check that this library still needs a patch per microcontroler arch.

But honestly deals with specific registers to get it running make it no portable at all and could give a lot of headache on maintain side.

from uclock.

midilab avatar midilab commented on September 25, 2024 1

hey @m-r-m-s , thanks for the implementation details! i will try to incorporate it to the uClock as soon as possible.

from uclock.

midilab avatar midilab commented on September 25, 2024 1

Well looking to all the docs you've found so far i think the best approach is the first one, to have the support out-of-the-box. i will open a branch with some changes here and let you know!

from uclock.

midilab avatar midilab commented on September 25, 2024 1
  1. What value should #define TIMER_INTERVAL_MS be?

This is used only for AVRs, i think i will start to divide files per port.

from uclock.

midilab avatar midilab commented on September 25, 2024 1

its the same mcu used by arduino zero by the way:
https://github.com/adafruit/Adafruit_ZeroTimer/
and also for GEMMA M0 and Trinket M0 boards
so it looks like a lots of new devices supported by this port

from uclock.

midilab avatar midilab commented on September 25, 2024 1

@midilab Thanks for looking into additional porting for uClock. Sounds like it is too much hassle unfortunately. I really appreciate the time trying to make it work! I think I can just work with just adding the TCC0 and TC3 helper libraries to Adafruit Arduino Core like I did when testing.

Well i think it worth to take a note at README about this hacky way to use it with QT Py M0 for those who wish to.
I will update a note with your description of how to do it.

My guess is that soon or later a timer library will be officially integrated into their SDK for Arduino.

Thanks for the research too! it is always good for a project to grow and extend as much as possible.

The whole goal behind uClock and uCtrl is exacly that, make it portable on Arduino platform to as many board as we can.

from uclock.

midilab avatar midilab commented on September 25, 2024 1

Thanks for testing out @m-r-m-s ! in case of any updates on a official library please open another issue for integration.

from uclock.

m-r-m-s avatar m-r-m-s commented on September 25, 2024

Hey @midilab, a small update: I have successfully gotten the Adafruit QT py M0 board to work with uClock!

It is a workaround where I included the TCC0 and TC3 libraries from the Seeed Xiao Arduino core (https://github.com/Seeed-Studio/ArduinoCore-samd/tree/master/libraries) to the Adadfruit Arduino core libraries with a slight modification to the #ifdef for both of those libraries.

Here is the modified version of TimerTCC0.cpp which supports multiple SAMD boards:
https://gist.github.com/m-r-m-s/8727b900a8814028781509814de3db1f#file-timertcc0_modified-cpp-L10

This modification works with the uClock.cpp #if defined(SEEED_XIAO_M0) because __SAMD21G18A__ is also a MACRO for the Seeed Xiao. Hope that makes sense.

It would be great to add QT Py M0 to the list of supported hardware but I think this method is a bit opaque =)

from uclock.

m-r-m-s avatar m-r-m-s commented on September 25, 2024

Well looking to all the docs you've found so far i think the best approach is the first one, to have the support out-of-the-box. i will open a branch with some changes here and let you know!

Sounds good and thank you!

from uclock.

mightycoco avatar mightycoco commented on September 25, 2024

Tbh. I see this library usefull in an application but not in a library like uClock. The timerinterrupt_generic doesn't seem to play well, if you are already using timer stuff in your application. Having now a dependancy to uClock which depends on tc_generic would force you, to change your app to also use tc_generic (from what I understood)
Also there are a lot of prerequisites using tc_generic like patching the sdk and some files for different boards - from what I have seen in a quick read.

Maybe I'm wrong and would have to see this in a dedicated fork.

from uclock.

m-r-m-s avatar m-r-m-s commented on September 25, 2024

@midilab Thanks for looking into additional porting for uClock. Sounds like it is too much hassle unfortunately. I really appreciate the time
trying to make it work! I think I can just work with just adding the TCC0 and TC3 helper libraries to Adafruit Arduino Core like I did when testing.

from uclock.

m-r-m-s avatar m-r-m-s commented on September 25, 2024

Sounds good. Thank you for including the workaround in the readme description. And yes let's hope there is better timer integration in the SDK in the near future 🙌

from uclock.

m-r-m-s avatar m-r-m-s commented on September 25, 2024

Hi @midilab - I wanted to provide another update. I have done some additional testing and I am not confident that this workaround for the QT Py M0 board is working correctly with uClock. While it would be nice to have an additional board option, I think we will have to wait until a timer library is officially integrated into their SDK for Arduino as you mention above.

from uclock.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.