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.

Communication problem is between PIC18f4550 and SIM900D GSM module

Status
Not open for further replies.

Kopi_

Newbie level 5
Joined
Feb 26, 2013
Messages
8
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,329
Hi,
I have a new prpblem. I like communicating (115200bps) between PIC18f4550 and SIM900D GSM module.
The problem is now that GSM module is communicating only 115200bps. So I was writing a C code for PIC but the program is wrong.

Code:
//Soros aszinkron kommunikáci és átviteli sebesség beállítása
void init_SerialKommunication(unsigned int BaudRate)
{
	TXSTAbits.BRGH = 1;							// high speed
	BAUDCONbits.BRG16 = 1;						// 
	switch (BaudRate)
	{
		case 300:		SPBRGH  = 0x9C;     	//300bps 20MHz Osc, FOSC=48MHz
    					SPBRG   = 0x3F;			//Error[%]=0%
						break;
		case 1200: 		SPBRGH  = 0x27;     	//1200bps 20MHz Osc, FOSC=48MHz
    					SPBRG   = 0x0F;			//Error[%]=0%
						break;
		case 2400:	 	SPBRGH  = 0x13;     	//2400bps 20MHz Osc, FOSC=48MHz
    					SPBRG   = 0x87;			//Error[%]=0%
						break;
		case 4800:	 	SPBRGH  = 0x09;     	//4800bps 20MHz Osc, FOSC=48MHz
    					SPBRG   = 0xC3;			//Error[%]=0%
						break;
		case 9600:	 	SPBRGH  = 0x04;     	//9600bps 20MHz Osc, FOSC=48MHz
    					SPBRG   = 0xE1;			//Error[%]=0%
						break;
		case 19200:	 	SPBRGH  = 0x02;     	//19200bps 20MHz Osc, FOSC=48MHz
    					SPBRG   = 0x27;			//Error[%]=0%
						break;				
		case 38400:	 	SPBRGH  = 0x01;     	//38400bps 20MHz Osc, FOSC=48MHz
    					SPBRG   = 0x39;			//Error[%]=-0,5%
						break;				
		case 57600:	 	SPBRGH  = 0x00;     	//57600bps 20MHz Osc, FOSC=48MHz
    					SPBRG   = 0xD0;			//Error[%]=0,16%
						break;
		case 115200: 	SPBRGH  = 0x00;     	//115200bps 20MHz Osc, FOSC=48MHz
    					SPBRG   = 0x67;			//Error[%]=0,16%
						break;				
		default:		; 
	}    
	TXSTAbits.SYNC	= 0;						// asynchronous mode
	RCSTAbits.SPEN = 1;							// enable serial port - configures RX/DT and TX/CK pins as serial port pins
	RCSTAbits.RX9 = 0;							// 8-bit receiver
	TXSTAbits.TX9 = 0; 							// 8-bit transmission
	RCSTAbits.CREN = 1;							// Enables receiver
	PIE1bits.RCIE = 1;							// Enables the EUSART receive interrupt
	TXSTAbits.TXEN = 0; 						// reset transmitter
	TXSTAbits.TXEN = 1; 						// transmit enabledTXSTAbits.SYNC=0;							// asynchronous mode
	RCSTAbits.SPEN = 1;							// enable serial port - configures RX/DT and TX/CK pins as serial port pins
	TXSTAbits.TX9 = 0; 							// 8-bit transmission
	TXSTAbits.TXEN = 0; 						// reset transmitter
	TXSTAbits.TXEN = 1; 						// transmit enabled
}

next code
Code:
                i = 0;
		do{
			while( TXSTAbits.TRMT == 0 );
			TXREG=word[i];
			i++;
		} while (word[i] != 0x0A);

		i = 0;		
		do
		{
			while ( PIR1bits.RCIF == 0 ) ; 				/* wait for char  */  
			d_in[i] = RCREG;
			i++;
		} while (d_in[i-1]!=0x0A);
What is a problem?
Have SIM900D a hardware reset? I was looking for the hardware reset but I am not found.
Please help.
 

Can you be more specific?. What´s the problem?. Please explain to help you. Best regards.
 

Hi joebazoka,
The SIM900D GSM module doesn't communicate with the PIC18f4550 microcontroller on 115200bps. I attached please find the schematic.
gsm.jpg
I wrote a software with the PIC. The software of the PIC18f4550 communicates with the PICKit2 UART. But the PICKit2 UART can communicate only between 300bps and 38400bps.
These baud rate are low levels because the set of baud rate of the GSM module is 115200bps. I cannot modify the baud rate (115200bps) (This is the main problem.).
I like communicating (115200bps) between PIC18f4550 and SIM900D GSM module.
Am I sending the software of the PIC?
Thanks!
Best regards.
 

Hi. Is possible change baudrate of SIM900. SIM900 is designed in autobauding mode by default. I have attached an application note that describe this. Please read in page 8 "4 Synchronize baud rate". Best regrads.
 

Attachments

  • sim900_serial_port_application_note_v1.03.pdf
    284.2 KB · Views: 94

Hi.
Thanks your answer.
I made a mistake. I sended to SIM900D module a wrong command. It is "AT+IPR=115200". So I can communicating only 115200bps.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top