SparkFun Forums 

Where electronics enthusiasts find answers.

Discussions on the software and hardware for Atmel's STK standard.
By AdamMiltonBarker
Hi guys I have set up my first breadboard prototype with an ATMEGA328P-PU but I am struggling to get it communicating by RX / TX to an ESP. Using the code below there is no information received by the ESP, I have also connected the ATMEGA up to an Intel Galileo via RX / TX and still the same there doesn't seem to be anything being sent can anyone see anywhere I have gone wrong with the code. I have tried with and without the LED just to be sure but still same results.
Code: Select all
 * IntelliLanAVRLED.c
 * Created: 4/23/2016 7:30:43 PM
 * Author : Adam Milton-Barker

#define F_CPU 16000000UL
#include <avr/io.h>
#include <util/delay.h>

#define BAUDRATE 9600
#define BAUD_PRESCALLER (((F_CPU / (BAUDRATE * 16UL))) - 1)

void USART_init(void);
unsigned char USART_receive(void);
void USART_send( unsigned char data);
void USART_putstring(char* StringPtr);

char String[]="Hello world!!";

int main(void)
	DDRB |= (1<<DDB5); 

		PORTB |= (1<<PORTB5);    
		PORTB &= ~(1<<PORTB5);    


void USART_init(void){
	UBRR0H = (uint8_t)(BAUD_PRESCALLER>>8);
	UCSR0B = (1<<RXEN0)|(1<<TXEN0);
	UCSR0C = (3<<UCSZ00);

unsigned char USART_receive(void){
	while(!(UCSR0A & (1<<RXC0)));
	return UDR0;

void USART_send( unsigned char data){
	while(!(UCSR0A & (1<<UDRE0)));
	UDR0 = data;

void USART_putstring(char* StringPtr){
	while(*StringPtr != 0x00){
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]