Skip to content

Can't access WOA and WOB (TDC0) in ATTiny1616 #1266

@schwghrt

Description

@schwghrt

It doesn't seem possible to use AnalogWrite for WOA and WOB (TDC0) in ATTiny1616.

I've selected PB0-2 (buffered), 1-series PA4/5
I've changed the milli second timer to TDB0.

The first bug is located in this file,
https://github.com/SpenceKonde/megaTinyCore/tree/master/megaavr/variants/txy6/pins_arduino.h

Line 65:

 #elif !defined(_TCA_USE_WO3) && !defined(_TCA_USE_WO4) && defined(_TCA_USE_WO5)
    #define digitalPinHasPWM(p)         ((p) == _TCA0_WO0 || (p) == _TCA0_WO1 || (p) == _TCA0_WO2 || (p) == _TCD_WOAC || (p) == _TCD_WOBD)

The last defined(_TCA_USE_WO5) should be !defined(_TCA_USE_WO5) The '!' is missing.

Now it compiles.

However, if you call digitalPinToTimer(PIN_PA4) it still returns 0. (NO_TIMER)

This prevents analog_write() to run.

On a side note, it took me a long time to understand (and I still don't understand) what the PWM options mean, and I can't seem to find it in the documentation. Does it mean TCA, TCB and TCD pins?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions