Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Interfacing atmega 16 with gsm +serial programming

Status
Not open for further replies.

abhi89

Newbie level 1
Joined
Mar 9, 2010
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
mysore,Karnataka
Activity points
1,291
Hello friends. I am making use of atmega 16 micro controller to interface with SIM 300 GSM modem which has got a serial port.Before communicating with the modem, i first checked whether proper communication takes place or not b/w atmega and PC.Iwrote a program which continuously transmits a string for eg"AT" to the PC and checked in the Hyper terminal ,but in that the same string was not getting displayed , some dummy symbols or different characters are being displayed. I have set baud rate of 9600. What may be the problem ? Is there any communication error? please suggest.
 

When you communicate in AT commands, you need to send an "AT" and enter (which is carrage return which is 0x0D) so that the gsm module would know that the packet have finished. **broken link removed**
 

Could you put your code and schematic so that we will able to find where exactly problem occurs... It seems problem with your UART initialization...

---------- Post added at 12:56 ---------- Previous post was at 12:47 ----------

This is the Code for UART initialization..

#define FOSC 8000000// [Depends on which crystal you are using, For example here i have used 8MHz]
#define BAUD 9600
#define MYUBRR FOSC/16/BAUD-1

void USART_Init( unsigned int baud )
{
/* Set baud rate */
UBRRH = (unsigned char)(baud>>8);
UBRRL = (unsigned char)baud;
/* Enable receiver and transmitter */
UCSRB = (1<<RXEN)|(1<<TXEN);
/* Set frame format: 8data, 2stop bit */
UCSRC = (1<<URSEL)|(1<<USBS)|(3<<UCSZ0);
}
 

99% of the time, USART issues are due to clocking problems. What are your fuse settings (with respect to your clock source)? For example, if you have set the fuses to use an external crystal, is that crystal present? Is the divide by eight fuse programmed or unprogrammed?

Secondly, it looks like you are setting your registers incorrectly.

It SHOULD be:

Code:
UBRRH = (unsigned char)(MYUBRR >> 8);
UBRRL = (unsigned char)MYUBBR;

(NOT, "baud"). Also, MYUBBR should be an int -- check to see if your oscillator of choice has a tolerable error value for MYUBBR. Alternatively, you can use a "magic" crystal (i.e., Fosc = 9.8304) that has a perfectly divisible (by 256) frequency.

Finally, check you hyperterminal connection settings. I think it usually defaults to 8N1 (not 8N2). You will need to set it up to look for data with 2 stop bits.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top