All,
I am having a problem with the USART on an Atmega164P. When the ISP programmer is connected everything works fine. If I disconnect the programmer then all I get is garbled serial and the chip won't respond to characters that I send. Here's the code
void USART_Transmit( unsigned char data )
{
/* Wait for empty transmit buffer */
while ( !( UCSR0A & (1<<UDRE0)) )
;
/* Put data into buffer, sends the data */
UDR0 = data;
}
void sendString ( unsigned char str[16] )
{
int i=0;
for ( i = 0 ; i < len ( str ) ; i ++ )
{
USART_Transmit ( str [ i ] );
}
}
Assorted functions call sendString and they all work fine until the programmer is disconnected. Then nothing works.
The connection to the PC is a USB->TTL Serial adapter.
On the electrical side I've checked for common ground / ground loops, different voltages on the programming pins, and other inputs that might be affecting the programming pins. Nothing is connected to the programming pins except the programmer itself.
We also tried plugging the programmer into a USB wall charger. This made the chip function as expected, as did connecting it to a laptop running only on battery.
We also connected the RESET line to VCC both with and without a pullup resistor, neither of those tests yielded successful results (still received garbled serial).
Thanks for any input you can provide!
Scott