Giter Club home page Giter Club logo

Comments (13)

sajattack avatar sajattack commented on June 9, 2024

@jessebraham

from atsamd.

jessebraham avatar jessebraham commented on June 9, 2024

Just got back from out of town, I'll take a look at it in the next couple days here.

from atsamd.

jessebraham avatar jessebraham commented on June 9, 2024

I've added (and tested) Pwm2 to my fork (36afab5) which makes use of TC2.

As far as using multiple pins, the datasheet seems to imply it's possible:

Timer/Counter -> 24.8 Signal Description

Refer to “I/O Multiplexing and Considerations” on page 13 for details on the pin mapping for this peripheral. One signal can be mapped on several pins.

I believe it is possible to use TCC0 as well. However, unless I'm mistaken, in both cases our pwm! macro needs to be modified as it currently expects a single TCxPinout as well as a TCx parameter.

@sajattack , am I on track here? The pinout member in the $TYPE struct does seem kind of like magic and doesn't appear to be read anywhere yet is still working as expected, so I'm clearly missing something there.

from atsamd.

wyager avatar wyager commented on June 9, 2024

One signal can be mapped on several pins.

The thing I'm aiming for is to have 4 separate PWM counters. From a not-too-careful reading of the datasheet, it seems like this might be possible with TC{1,2}/WO{0,1}. I might be misunderstanding the way the WO channels work - the datasheet says Waveform output channels for TC : 2, whereas it says Waveform output channels per TCC : 8. I'm not sure if this means 2 WOs per TC or 2WOs total shared across both TCs. If it's the latter, I think I would have to use TCC0.

from atsamd.

sajattack avatar sajattack commented on June 9, 2024

The mode we use the WO in uses 2 channels for one pwm output.

from atsamd.

wyager avatar wyager commented on June 9, 2024

One thing that's confusing me about the rust API is that the definition of atsamd11c14a::tcc0 seems to be missing some stuff compared to what's mentioned in the datasheet/C snippets. E.g. it seems like cc should have some additional structure to account for the fact that there are 4x compare channels. All of this stuff is autogenerated right?

from atsamd.

sajattack avatar sajattack commented on June 9, 2024

Could've been missing from the SVD

from atsamd.

wyager avatar wyager commented on June 9, 2024

Got it, thanks. So what's the best way forward here? Manually edit the SVD file? Ask the manufacturer? Just give up and write everything in C?

from atsamd.

wyager avatar wyager commented on June 9, 2024

FWIW, I was able to get this working for my needs via the C FFI. So no longer any urgent desire on my end. Still probably worth fixing though.

from atsamd.

sajattack avatar sajattack commented on June 9, 2024

I don't think our HAL supports TCCs yet anyhow so we can worry about it later.

from atsamd.

jessebraham avatar jessebraham commented on June 9, 2024

Sorry, had a busy week. Glad you got a solution figured out.

I have started trying to adapt the pwm! macro to use TCC0 instead of TCx, just as a proof-of-concept. If/when I get it working maybe there can be some discussion on how to move forward.

from atsamd.

sajattack avatar sajattack commented on June 9, 2024

Can this be closed now?

from atsamd.

wyager avatar wyager commented on June 9, 2024

Sure, although Jesse, let me know if you want me to reopen so you can track adding TCC0 support here

from atsamd.

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.