5

Tried to upload my Arduino Uno sketch that writes to serial UART at 9600 baud rate onto my ATtiny2313 running at 1MHz. Not getting the signal on the ATtiny, does this have to do with my clock frequency of the MCUs being 16 vs 1MHz?

  • 1
    You'd need to set F_CPU to 1. However the only way to do this is to create a new board inside the hardware folder. Once created it will fix delay, millis and serial. – Gerben Nov 20 '14 at 17:06
3

Yes, it does. As can be seen in the "USART" section of the datasheet the baud rate is generated directly from both fosc (aka FCPU) and the value contained in UBRR. The tables at the end of the section gives the appropriate value for UBRR for a given CPU frequency, desired bit rate, and state of the USART clock doubler.

  • Thank you, where can i find more info on how to get my 16mhz Arduino uno sketch to properly work on Attiny. I guess i must change the FCPU and UBRR? – Nikola Nov 20 '14 at 10:33
  • Also would it port better if i used a ATMEGA8 instead of the ATTINY2313. Please let me know if there is any great beginner bookss that will catch me up on becoming an avr expert :) – Nikola Nov 20 '14 at 10:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.