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

ATtiny1607 at 8MHz with Arduino IDE #46

Open
Alailek opened this issue Mar 21, 2021 · 3 comments
Open

ATtiny1607 at 8MHz with Arduino IDE #46

Alailek opened this issue Mar 21, 2021 · 3 comments

Comments

@Alailek
Copy link

Alailek commented Mar 21, 2021

Hi. I'm using the Arduino core megaTinyCore from SpenceKonde to compile the code with the Arduino IDE for an ATtiny1607. At 20MHz and 16MHz, everything's OK but below that, it compiles but it's not working. F_CPU is set correctly. At 8 or 10MHz, I need to double the baud rate of the host to be able to communicate with the program but it blocks when it tries to communicate with the target.

Any idea of the problem?

Thanks

@Alailek
Copy link
Author

Alailek commented Mar 21, 2021

I just found out that the prescaler of the clock is disabled by the code in sys.cpp for the ATtiny 0 and 1 series

#else //0-series or 1-series
  _PROTECTED_WRITE(CLKCTRL.MCLKCTRLB, 0);

By setting the MCLKCTRLB register to 1, I can use the clock to 8 or 10MHz setting in the Arduino IDE.

@ElTangas
Copy link
Owner

Indeed, max clock is hard-coded for these chips in the source code. Maybe I should change it to get the right value according to F_CPU.

@Alailek
Copy link
Author

Alailek commented Mar 22, 2021

I want to reduce the clock speed because, according to the specification, the minimum voltage to run at maximum clock speed is 4.5 volts. At 8/10MHz, the minimum voltage is 2.7 volts (I want to use 3.3 volts). It would be nice to get the prescaler set automatically but since I know how to override it stays a "nice to have".

Thanks for your work!

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