Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

redLed() no longer working for CPC #40

Closed
caternuson opened this issue May 28, 2019 · 6 comments
Closed

redLed() no longer working for CPC #40

caternuson opened this issue May 28, 2019 · 6 comments

Comments

@caternuson
Copy link
Contributor

Re this thread:
https://forums.adafruit.com/viewtopic.php?f=58&t=152174

Seems to be related to low level register writes and timer setup in Adafruit_CPlay_Speaker::begin():

PLLFRQ = (PLLFRQ & 0xCF) | 0x30; // Route PLL to async clk
TCCR4A = _BV(COM4A0) | _BV(PWM4A); // Clear on match, PWMA on
TCCR4B = _BV(PWM4X) | _BV(CS40); // PWM invert, 1:1 prescale
TCCR4D = 0; // Fast PWM mode
TCCR4E = 0; // Not enhanced mode
DT4 = 0; // No dead time
noInterrupts(); // TC4H accesses must be atomic
TC4H = 0; // Not 10-bit mode
OCR4C = 255; // TOP
TC4H = 0;
OCR4A = 127; // 50% duty (idle position) to start
interrupts();

@ladyada
Copy link
Member

ladyada commented May 28, 2019

if you remove that section, does the LED start working? :/

@caternuson
Copy link
Contributor Author

Yep.

Looks like OC4A is on D13:
image

@ladyada
Copy link
Member

ladyada commented May 28, 2019

dya mind checking the DS to see if we have a way to disable PWM output on OC4A

@caternuson
Copy link
Contributor Author

caternuson commented May 28, 2019

Not seeing an option to have only the complementary output (SPEAKER) connected. Only option to disconnect OC4A is to disconnect both:
image

That init section was moved from another location with this commit:
f3694f4

Maybe there's no need for the call to speaker.begin() in the c-tor anymore? playSound() will call it?

@ladyada
Copy link
Member

ladyada commented May 28, 2019

yep remove it - CPC's are not very popular anymore

@caternuson caternuson mentioned this issue May 28, 2019
@caternuson
Copy link
Contributor Author

Fixed by #41

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants