How to code GSM-GPS Click Sim808 using STM32F446RE?

Thank you Sir , I’m grateful. Will try and get back.

By the way , I WISH YOU A HAPPY BIRTHDAY, ALL THE BEST . You have been a great help to me and I’m really grateful . Thanks a million .

Really sorry for that. The truth is that , I have never used AT command , so did not really know where to begin, reason why I went straight to the point by trying the SMS command , not knowing I wouldn’t have changed what was there .

So now, wondering, what will be the next stage after if I wish to test if my GSM can send message ?
Really sorry to ask all these questions, I don’t really understand, reason why .

Thank you :slight_smile:

I understand, but you need a systematic progress. When you want to drive a car you also need to know first some basics and learn something to get driving license.

First what you want to see, with AT commands, is positive response on a simple AT command, like bellow. Or also the AT SDK version and this it what we tried with the example of ATCmdParser.

_parser->send("AT"); 
if(_parser->recv("OK")) {
    printf("\nATCmdParser: success");
} else { 
    printf("\nATCmdParser: failed");
}

Until you have not positive response, your connection is not OK or your hardware is broken, and then there is no point in doing anything else, until it you not resolve it.

BR, Jan

Good day Sir

Really sorry to bother again. I have been trying since , over and over , I have checked everything but still not working . Both the board and the GSM-GPS click are working perfectly , I still don’t understand why , it still does not give good answer . OUTPUT MESSAGE AFTER RUNNING TESTING THE CODE IS nATCmdParser: failed .

According to you what will be the best UARTSerial Pins ? ( I have used D10 and D9. And tried other PINS as well and I got some error ) .

Really need it to work, can you help me try something again please ?

I have connected it the way you said, but still OUTPUT MESSAGE is SIM808 not detected!
Waiting for satellite fix …

Hi there,

The board has few UART interfaces so you need to take care if pins are from same interface. So the mark Serial_6_RX will tell you that is RX pin of UART 6.
According to NUCLEO-F446RE | Mbed I recommand A0 & A1 or D2 & D8.

All pins available for UART are here.

BR, Jan

Good day Sir
Thank yo for your response, I have tried it out but still not working. OUTPUT is still “failed”. Don’t really know what to do now. Is there another way we can go about it ? Or is there any working existing library that can be used direct ?

Or kindly check my code below , maybe I have made some mistakes

#include "mbed.h"


#define   GSM_DEFAULT_BAUD_RATE   115200

UARTSerial *_serial;
ATCmdParser *_parser;

int main()
{
    printf("\nATCmdParser with GSM example");
    
    _serial = new UARTSerial(D8, D2, GSM_DEFAULT_BAUD_RATE);
    _parser = new ATCmdParser(_serial);
    _parser->debug_on( 1 );
    _parser->set_delimiter( "\r\n" );    
    
    while (1){
   _parser->send("AT"); 
if(_parser->recv("OK")) {
    printf("\nATCmdParser: success");
} else { 
    printf("\nATCmdParser: failed");
}

    wait (2);

}
}

Make and share a picture of your wiring and try to check the status leds on the module.

BR, Jan




Kindly find them attached please.
By the way in case you can’t see it clearly , I have connected the RX of the module to D2 and TX to D8. I tried to mixed them as you suggested previously as well meaning ( RX to D8) and (TX to D2) but did not work as well.

When I use the ATcmd code only the PWR led is ON . But the other code ( How to code GSM-GPS Click Sim808 using STM32F446RE? - #12 by Samuel_Kpalemon) , the TXD and the STA led on the module are ON , the TXD one blinks in an interval of 2 seconds (Red color ) while the STA led is yellow but does not blink .

Ok, it seems the module is powered but in a power down mode and in this mode no response to AT commands.
I’m not sure but try to this code for changing the status to power up mode. You need two more wires for RST and AN pins of MicroeBus header to pins what you can see in the code or set it where do you want.

Code
#include "mbed.h"


#define   GSM_DEFAULT_BAUD_RATE   115200

UARTSerial *_serial;
ATCmdParser *_parser;

DigitalOut RST(D3, 1);	//POWERKEY
DigitalIn AN(D4); 		//STAT

int main()
{
    printf("\nATCmdParser");
	
	printf("Trying to power up the module!\n");
	while (AN.read() == 0)
    {	
		printf("Trying to power up!\n");
        RST.write(0);
        wait(1.5);
        RST.write(1);
		wait(2);
    }
	printf("Modul is powered!\n");
    
    _serial = new UARTSerial(D8, D2, GSM_DEFAULT_BAUD_RATE);
    _parser = new ATCmdParser(_serial);
    _parser->debug_on( 1 );
    _parser->set_delimiter( "\r\n" );    
    
    while (1){
        _parser->send("AT"); 
        if(_parser->recv("OK")) {
            printf("\nATCmdParser: success");
        } else { 
            printf("\nATCmdParser: failed");
        }
        wait(2);
    }
}

BR, Jan

Hello Sir, Thanks for your help , I appreciate it .

Powered it up responded , both the TXD and STA leds were ON , but still OUTPUT of ATcmd is failed . Find attached a snip of the OUTPUT please .

That is great but…

How I see you have connected orange wire to pin 3 on right side from above and that is UART TX. On the Nucleo side you have connected same wire to the pin D8 witch is also TX. That is wrong. How I wrote above, they must be crossed.

Now finally change the wires to correct position! :smiley:

BR, Jan

I have done that as well but did not work , I even made mention of it :sweat_smile:.

But find attached again picture of current one as well.




Ok, I found another potential issue. I not checked it before because I was hoping you did it, because it’s the similar as with the ECG Click.

The board has an onboard I/O SEL solder switch and it is set to 3v3 in default. So try to connect also 3v3 power supply pin.

BR, Jan

Good day SIR,
Thanks a million, it has finally worked please , I’m really grateful :blush:.
So , now . what is the next steps ? can we now proceed with the ATcmd to get the current location and to send the message through GSM ?

Thanks a lot again .

Awesome, you are welcome.
Now is the connection verified so you can try something more. But before we will try your dreamed functions we need to check AT version. So now replace current code with code below.

Code
#include "mbed.h"

#define   GSM_DEFAULT_BAUD_RATE   115200

UARTSerial *_serial;
ATCmdParser *_parser;

DigitalOut RST(D3, 1);	//POWERKEY
DigitalIn AN(D4); 		//STAT

int main()
{
    printf("\nATCmdParser");
	
	printf("Trying to power up the module!\n");
	while (AN.read() == 0)
    {	
		printf("Trying to power up!\n");
        RST.write(0);
        wait(1.5);
        RST.write(1);
		wait(2);
    }
	printf("Modul is powered!\n");
    
    _serial = new UARTSerial(D8, D2, GSM_DEFAULT_BAUD_RATE);
    _parser = new ATCmdParser(_serial);
    _parser->debug_on( 1 );
    _parser->set_delimiter( "\r\n" );    
    
    while (1){
        _parser->send("AT"); 
        if(_parser->recv("OK")) {
            printf("\nATCmdParser: success");
			break;
        } else { 
            printf("\nATCmdParser: failed");
        }
        wait(2);
    }
	
    printf("\nATCmdParser: Retrieving FW version");
    _parser->send("AT+GMR");
    int version;
    if(_parser->recv("SDK version:%d", &version) && _parser->recv("OK")) {
        printf("\nATCmdParser: FW version: %d", version);
        printf("\nATCmdParser: Retrieving FW version success");
    } else { 
        printf("\nATCmdParser: Retrieving FW version failed");
        return -1;
    }
}

That will print out current AT version. Let me know the result.

BR, Jan

:sweat_smile:, Well noted , I’m grateful

Below is a snip of the result

Is it exactly what you want ?
Thank you .

Ok, it told me nothing, I found nothing useful.
Until I found something you can try the code from above posted by you.

BR, Jan

Ok Sir , no problem please. thank you so much.