void USART0_init(void)
{
PORTB.DIR &= ~PIN3_bm; //RX line of the ATTINY 1607
PORTB.DIR |= PIN2_bm; //TX line of the ATTINY 1607
USART0.BAUD = (uint16_t)USART0_BAUD_RATE(9600);
USART0.CTRLB |= USART_TXEN_bm;
}
void USART0_sendChar(char c)
{
while (!(USART0.STATUS & USART_DREIF_bm))
{
;
}
USART0.TXDATAL = c;
}
void USART0_sendString(char *str)
{
for(size_t i = 0; i < strlen(str); i++)
{
USART0_sendChar(str[i]);
}
}
int main(void)
{
USART0_init();
USART0_sendString(“Hello World!\r\n”);
_delay_ms(500);
}
Looks like this program lowers the baud to ~1300 so I tried setting the baud rate in the platform.io project and it still doesn’t work. Is there something else that is configured in the microchip studio project that isn’t in the platform.io?
So apparently there is a default clock speed of 16 or 20 MHz on this MCU with a default clock divider of 6. Which I don’t know where it saids that in the datasheet.
I didn’t expect to have this much trouble with this haha. Thanks for helping out.
So it looks like I got it figured out. I really would like to know where the default prescaler/clock divider comes in when you use platformio. It’s probably in the auto fuse function that tinymegacore has. I basically followed this example:
I found that gibbish still exist on the 16MHz f_cpu option. I changed that 20MHz and eureka!
Here is the resulting ini file: