i am trying to get an data over uart of Attiny167,in interrupt mode at baud rate of 57600 but when i debug the programme i only receive CR
& LF
no data i am receiving why is it happening in this controller below is my code:
#define CPU_CLOCK_FREQ 8000000UL
#define SAMPLES_PER_BIT 8
#define BAUD_RATE 57600
ISR(LIN_TC_vect)
{
cli();
temp=LINDAT;
buff[i]=temp;
i++;
sei();
}
void USARTInit()
{
DDRA = 0x02; // Port A Rx / Tx as input / output for PIN0 and PIN1
/* Set PORTB as input from FACS MAin BOX on PIN0 and PIN1 , initially high */
DDRB = 0x00;
PORTB= 0xFF;
/* Set samples per bit and UART baud */
LINBTR = (1 << LDISR) | SAMPLES_PER_BIT;
LINBRR = (((CPU_CLOCK_FREQ) / SAMPLES_PER_BIT) / BAUD_RATE) - 1;
/* Configure LIN UART in UART mode */
LINCR = (1 << LENA) | (1 << LCMD0) | (1 << LCMD1) | (1 << LCMD2);
// enable transmit and recieve interrupts for LIN/UART transfer
LINENIR = (1 << LENRXOK);
sei();
}
please help.