i want to interface quectel M66 GSM module PCB with PIC32MX450F256L through UART.
I checked the quectel M66 GSM module board individually using PUTTY and it is working.
when I connect the controller as host i did not receive any output from GSM using AT command.
Below is the code for referrence.
As controller GPIO pin 3.3V level shifter is also added.
Thank you.
void gsm_init()
{
char terminator = 0x1A; // character form of control + z terminator character
char buff1 = “AT\n\r”; //testing of connection
char buff2 = “AT+COPS?\n\r”;//check if SIM is present or not(it returns the N/W provider name)
char buff3 = “AT+CSQ\n\r”;//gives network strength
char buff4 = “AT+CMGF = 1\n\r”;//select the SMS format //text mode
char buff5 = “AT+CMGS="+917387527414"\r\n”;//send SMS msg //write phone number
char mesg = “Hello! This is a test message from UART\r\n”;//massage to send
UART_write(buff1);
UART_SendChar(0x0A); //line feed
UART_SendChar(0x0D); //return carriage
__delay_ms(300);
UART_readchar();
UART_write(buff2);
UART_SendChar(0x0A); //line feed
UART_SendChar(0x0D); //return carriage
__delay_ms(300);
UART_readchar();
UART_write(buff3);
UART_SendChar(0x0A); //line feed
UART_SendChar(0x0D); //return carriage
__delay_ms(300);
UART_readchar();
UART_write(buff4);
UART_SendChar(0x0A); //line feed
UART_SendChar(0x0D); //return carriage
__delay_ms(300);
UART_readchar();
UART_write(buff5);
UART_SendChar(0x0A); //line feed
UART_SendChar(0x0D); //return carriage
__delay_ms(300);
UART_readchar();
UART_write(mesg);
__delay_ms(100);
UART_SendChar(terminator); //return carriage
__delay_ms(1000);
UART_readchar();
}
void main()
{
TRISEbits.TRISE8 = 1; // Make RE8 an INPUT UART5 RX
TRISDbits.TRISD1 = 0; // Make RD1 an OUTPUT UART5 TX
INTCONbits.MVEC = 1;
__builtin_disable_interrupts();
UART_Init();
__builtin_enable_interrupts();
GREEN_LED = 1;
i = 0;
while(1)
{
gsm_init();
GREEN_LED = 0;
__delay_ms(500);
GREEN_LED = 1;
__delay_ms(500);
}
}