cancel
Showing results for 
Search instead for 
Did you mean: 

Setting up sim800 with stm32f103c8

salar s
Associate
Posted on March 20, 2018 at 12:43

hi i'm trying to set up a gsm sim800 module with stm32f103c8 .i want to switch a led on and off with sms . i used 

stm32cubemx for usart settings and i generated a code for that.. now i want to recieve sms with at commands but i don't know how to write the code .in at command help file it is only wrote the rules .and i have seen some educational videos about at commands but they are all using usb to serial connection and are operating at commands by pc so they are not helpfull for me i attached the code below can anyone help me ?

#stm32f103 #sim800
6 REPLIES 6
Andrew Neil
Evangelist III
Posted on March 20, 2018 at 15:13

AT Commands are simply text strings:

  • you send text strings - called 'Commands' - to the modem;
  • the modem sends text strings - called 'Responses' - to you.

The way to approach this is to start by getting familiar with the commands & responses by typing & observing manually at a terminal.

Then design your code to send those same commands (which, remember, are just text strings) and receive the modem's responses (again, text strings).

The biggest mistake people make is to ignore the responses from the modem. Do not do this!

Your code

must

wait for & handle the complete response (or set of responses) after each command before proceeding to the next command.

Note that none of this is new;  people have been controlling modems with microcontrollers for decades - there are plenty of examples to be found on the interwebs!

Posted on March 20, 2018 at 16:36

Perhaps start by learning C, reviewing the other HAL USART examples, see how to send and receive characters, and then automate the key strokes you'd send from a PC terminal, and then receiving and acting upon the responses.

If you're out of your depth start with simpler things first.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
SARTHAK KELAPURE
Associate II
Posted on March 20, 2018 at 17:01

SIM800 is a widely used module for cellular, so it won't be difficult to find AT  commands for that also, SIMCOM has given out good amount of documentation on their website. Use HAL_UART_Transmit and HAL_UART_Receive as a start and later on move the ladder. You can send AT command for reading the SMS and store it in a buffer on receive. Parse this buffer and make your code act accordingly.

Time synchronization/usage is very important in this case.

john doe
Lead
Posted on March 20, 2018 at 23:05

I'm not at home, so I can't confirm positively, but here goes anyway:

In the STM32Cube repository for the F7, in the Drivers/BSP directory, there's components for the 769 Eval board.  One of those is an ESP8266 driver, which is an example of how to send AT commands over USART.

Posted on March 20, 2018 at 23:50

Also, there's a number of cellular Discovery kits:

https://community.st.com/0D50X00009XkbSJSAZ

Mrunal A
Associate III
Posted on March 21, 2018 at 06:31

You seem new to Send/Receive strings (commands) over UART. So first step should be to setup UART correctly and send and receive Text strings over UART. For this you need to connect your UART to PC, for this you can use USB to serial converter if your PC don't have a serial port or you can use MAX232. After this install and open a terminal application in PC like TeraTerm and select the COM port of your USB to serial converter and connect. And try sending strings using HAL UART transmit function. You should see the transmitted text strings on PC, if not then debug. If yes then proceed receiving strings from UART. For that you need to again use HAL functions like UART Receive IT etc check the HAL driver manual. Once you are successfully receiving strings then you can proceed with GSM interfacing.