Solved: Sending SIM900 commands from atmega16

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
char str[100];

sprintf(str,"%s","AT\r\n");
transmitData(str);

void transmitData(char *s)
{
	while (*s)   // Send data till first null (zero) encountered
	{
		while (!( UCSRA & (1<<UDRE))) //Check if USART buffer is empty
		{

		}
		UDR = (*s++); //Send data
	}
}

It sends the command "AT" but I do not get "OK" back

Last Edited: Sat. Sep 9, 2017 - 04:52 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Show more code, including the USART setup.  Show your connections.

 

What speed is your AVR running at?  Have you proven it is running at that speed?  What is the clock source for your AVR?

 

 

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I found the issue, I read that the module auto detects the baud rate of the microcontroller at start up and takes some time. It was probably because I was trying to send the message instantly and the baud rate wasnt set