Giter Site home page Giter Site logo

nimaltd / gsm_v5 Goto Github PK

View Code? Open in Web Editor NEW
232.0 232.0 86.0 216 KB

gsm module library for STM32 LL

License: GNU General Public License v3.0

C 100.00%
at at-command at-commands atcommand atcommands bluetooth gsm gsmlib library peripheral sim800 sim800c sim800library sim800stm32 stm32f1 usart

gsm_v5's Introduction

Hi there! 👋

I'm Nima Askari, an Electronic Engineer passionate about sharing my knowledge through libraries I've written. Welcome to my GitHub profile!

About Me

I'm dedicated to creating libraries that make life easier for electronic engineers like you. Whether it's optimizing code or simplifying complex tasks, I strive to provide solutions that enhance your projects.

Connect with Me, Support Me

  • YouTube
  • Instagram
  • LinkedIn
  • Email
  • Ko-fi

You can install my STM32CubeMx packages from here:

Thank you for your support! Together, we can build a vibrant community of electronic engineers. Let's innovate and create amazing projects!

gsm_v5's People

Contributors

d-serj avatar ivanchenko59 avatar mobinbyn avatar nimaltd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gsm_v5's Issues

what is atc.h ???

there is no atc.h and atcConfig.h in your project. i make atcConfig.h with your help but what about atc.h?

gsm_at_rxCallback()

سلام وقت بخیر
با تشکر از اشتراک گذاری کد
مهندس این تابع در کد تعریف نشده است.
gsm_at_rxCallback()

Gsm_MsgSendText send message twice

hi @nimaltd
thank you for your useful library
when I send a message in the Gsm_UserNewMsg function with Gsm_MsgSendText any message send twice
I guess receive message doesn't delete in StartSim80xTask

for(uint8_t i=0 ;i<sizeof(Sim80x.Gsm.HaveNewMsg) ; i++)
{
if(Sim80x.Gsm.HaveNewMsg[i] > 0)
{
//Gsm_MsgGetMemoryStatus();
if(Gsm_MsgRead(Sim80x.Gsm.HaveNewMsg[i])==true)
{
osDelay(100);
Gsm_UserNewMsg(Sim80x.Gsm.MsgNumber,Sim80x.Gsm.MsgDate,Sim80x.Gsm.MsgTime,Sim80x.Gsm.Msg);
osDelay(100);
Gsm_MsgDelete(Sim80x.Gsm.HaveNewMsg[i]); /message not deleted in this line/
osDelay(100);
}
Gsm_MsgGetMemoryStatus();
Sim80x.Gsm.HaveNewMsg[i]=0;
}
}
//###########################################
if(Sim80x.Gsm.MsgUsed > 0)
{
if(Gsm_MsgRead(UnreadMsgCounter)==true)
{
Gsm_UserNewMsg(Sim80x.Gsm.MsgNumber,Sim80x.Gsm.MsgDate,Sim80x.Gsm.MsgTime,Sim80x.Gsm.Msg);
Gsm_MsgDelete(UnreadMsgCounter); /message delete in this line/
Gsm_MsgGetMemoryStatus();
}
UnreadMsgCounter++;
if(UnreadMsgCounter==150)
UnreadMsgCounter=0;
}

ERROR 606

سلام مهندس عزیز ممنونم از وقتی میگذارید پیغام خطای 606 هنگام اتصال به بیشتر سایت ها را به من میدهد به بعضی از سایت ها نیز متصل می شود خیلی وقت هست که دچار این مشکل شدم در صورت امکان راهنمایی فرمایید برای حل این مشکل قابل ذکر است که مدیریت سایت در اختیار ما میباشد در صورت لزوم تغییرات . ضمنا فقط این مشکل با سایتهایی است که SSL دارد . تشکر فراوان

Always false returning on Sim80x_SendAtCommand function

Dear nimaLtd,

thank you so much for your best lib for sim800 modules, I have some problem with Sim80x_SendAtCommand function, this function just returns false in all-time although the simcom module returns true answer and the MCU will go to UART interrupt routine and then called Sim80x_RxCallBack(),

but the SIM80x_SendAtCommand returned false value ,

can you help me, please? or send some better examples, please?

thank you so much
Best Regards
Omid.K

Sending data over TCP/UDP in transparent mode

This library is very wonderful, thanks
I’m trying to send binary data over TCP to a server using SIM800. I need to send binary data, without coding, non-ASCII characters indeed. Some of the data bytes can be 0x1A which coincides with the send command, doing that all data were transmitted early. Using AT+CIPSEND=< length > solves the problem because data are transmitted when the content of the buffer reaches that quantity. But this latest version, TCP-related functions removed and never touched about this.
Could you add TCP functions?

You might want to allow roaming

I'm having a hard time with the library because there is no documentation. Apart from that it seems quite complete.

I found one issue: It didn't recognize the roaming status as registered. For now I changed line 21 in gsm.c to:
if (p2 == 1 || p2 == 5)

It might be desirable to be able to configure that, but for my purposes this is the solution.

Many Greetings!
Remo

problem in FreeRTOS function in SIM800_V2

Hello and respect
If possible, share some code samples for sim800_V2. I have little experience with FreeRTOS and newbie in STM32. By the command that you said the library file was added to the code. After the program and code testing, the osKernelStart function hangs. I am a Persian user, is it possible to subscribe to another social network ID for share my code for you? part of code was important that commented under text.
use STM32F103RBT6
//**************************
Sim80x_Init(osPriorityLow);
MX_FREERTOS_Init();
osKernelStart(); // hang up on this function
//*************************
Thank you, Barati
[email protected]

example

Hi
Could you please add some simple examples ,how to use this library in code for FreeRTOS newbie's.

sim800l can't connect??

i use sim800l with stm32f103c8 and sim can't connect to cellular network there is error in
if (gsm_command("AT+SAPBR=1,1\r\n", 90000, NULL, 0, 2, "\r\nOK\r\n", "\r\nERROR\r\n") != 1)
so pls can u help me.

My regards

I thank you from the bottom of my heart.

gsm_call_dial() function locks the program

Hi,

I tried the library and I can send sms properly, but when I try to make phone call, the program stucks in a way that all tasks stop working.

Here is my FreeRTOS configuration:
image

Here is my gsmTask:
image

Here is my GSMRun Task:
image

It sends the AT command, my phone rings, so when I debug, I see that the PC comes here (line 39 of call.c, inside gsm_call_dial() function):
image

Then it goes to atc_command() function and spends some time in this loop (located between line 195 & line 198 of atc.c):
image

Then I press resume to see where it stucks, and I see that it stucks in line 278 of heap_4.c:
configASSERT( ( pxLink->xBlockSize & xBlockAllocatedBit ) != 0 );
image

which is in vPortFree function.

This means the FreeRTOS somehow cannot deallocate the memory that it allocated before.

Does anyone has any idea on the solution of this problem?

Thank you.
Cheers,
Ogulcan

تاخیر بسیار زیاد در ارسال و دریافت داده با gprs

سلام مهندس عزیز ممنون از برنامه فوق العاده و حرفه ای
یه مشکل دارم اینکه میخوام یه سری دیتا روی سایت ارسال کنم و یه سری دیتا هم بخونم متاسفانه سرعت کار بسیار پاین هست چون هر بار که میخوام ارسال یا دریافت داشته باشم باید
httpaction
اجرا بشه که خیلی زمان بر هست اگه میشه راهنمایی کنید که سرعت ارسال و دریافت بالاتر بره ممنون

SIM800L interfacing with STM32F4

Hello,
sorry for my question that is not exactly an issue about your repo, but it seems like you're the only man on the web able to interface SIM800L with STM boards directly in HAL. I have a fairly simple project in which I need to make some HTTP operations via GPRS. My troubles come when I try to send AT commands to the GSM module because apparently I cannot get any response, after HAL_UART_Transmit(...) both polling for the answer and waiting for an interrupt HAL_UART_Receive_IT(...) don't produce any result, the module seems dead. I am sure that it is fine because if I "play" with it using an Arduino UNO there are no issues, everything is working. It is supplied via lithium battery and I also put a voltage divider for the RX input from the board as the datasheets suggests. My UART is set to send 8bit messages with no parity and one stop bit. Sorry again for my inappropriate question, hope you can give me some piece of advice.

I cannot receive incoming messages.

10
22

Hi

It doesn't go into line 360 ​​at all. And
It goes to line 351 without entering the 348th and 350th lines. I cannot read incoming messages. When I run it step by step, I see the previous messages in the array, but it never goes into the "gsm_callback_newMsg (char * number, gsm_time_t time, char * msg)" function.

gprs MQTT semicolon error

In gsm_gprs_mqttPublish (), the at command
AT+SMPUB="topic/test send/",1,0, "{"idx":22, "value" : "%.2f; %u; 0"}"

returns an error. The module accepts a semicolon (;) as the end of the command. And no escaping\ does not work. Is it possible to fix this?

Inappropriate check to process buffer leads to crash when HAL_GetTick() overflows after Approximatly 49 days

HAL_GetTick()-Sim80x.UsartRxLastTime check will fail after 49 days of MCU startup.

https://github.com/nimaltd/Sim800_V2/blob/5c76a909f7f69a1f3bea00b078e56c0fb0795abc/Sim80x.c#L1258-L1263

Solution is to change the check overall.
first of all 50ms is a constant which is not calculated or reference for a specific UART Baudrate.
STM and HAL provide a macro __HAL_UART_GET_FLAG(uarthandle,FLAG).
by checking UART_FLAG_IDLE: Idle Line detection flag it is possible to check whether a transmission is undergoing or not. how ever the downside of using this macro is that it's not portable to other MCUs.

Bug in gsm_gprs_httpRead()

I find that in atc_command function we erase rx_Buffer whit atc empty(atc); commands before copy data from rx_Bufferto to Auxiliary buffer .for debugging this issue I added a bit field like
uint8_t http_read_start :1 ;
and set it in gsm_gprs_httpRead function before sending at command and reset it at end of function
Next in atc_empty function check this bit feild like this

void atc_empty(atc_t *atc) { if(atc->http_read_start==0) { memset(atc->rxBuffer, 0, _ATC_RXSIZE); atc->rxIndex = 0; } }

use on avr microcontroler

با درود .
مهندس سپاس بابت زحماتت.
من قبلا از نسخه 2 روی stm32 استفاده کردم و خیلی هم عالی کار کرد .
منتها الان اون رو برای avr( به صورت RTOS ) پورت کردم و خطای make میده که متوجه نمیشم مشکلش کجاست .
فلش 64 مگابایت و رم 4 کیلو بایت هست(atmega64 ) .
قبلا یک برنامه بر این اساس نوشته بودم حالا ترجیح میدم از همین کتابخانه استفاده کنم . نمیدونم مشکل کمبود رم یا فلش پیش اومده یا نه .
کلا چطور میتونم از نسخه 2 روی avr استفاده کنم ؟

HardFault strtok()

Hello,
I encountered a hardfault error caused after executing strtok() from gsm_msg_read() function. strtok() is not thread-safe and since I'm using FreeRTOS this could be a problem. I was able to fix this by using strtok_r() instead of strtok(). And later, I used the custom function strtok() and it didn't cause any problems either. I also thought that this could be due to the lack of heap allocated for the task, but it seems that increasing the heap did not help me.
I don't fully understand the cause of the problem, so my solution was to use the self-written strtok() function.
It would be interesting to know if someone has come across this, or maybe my solution will help someone.
My setup: stm32F401, FreeRTOS, task heap 512 (also tried 1024).

Bug in function `bool Gsm_Ussd(char *send, char *receive)`

Hello! Could you descrive (write comments) of the API functions in your code?

In my case, I dont understand the meaning of the parameter receive in function bool Gsm_Ussd(char *send, char *receive) . I think, there is no effect of code in this function if(receive != NULL) receive = Sim80x.Gsm.Msg; because receive is local variable. Or I need to pass pointer to pointer as the parameter?

P.S. Sorry for my English.

usart.h

hi
i am using stm32f103c8 and when i wnat to build my project i get usart.h not found error

Message read error

It says
[GSM] msg_isTextMode() failed!
the ans variable is returning 2.
[GSM] msg_read(1) failed!

how to read sms from the sim800 module

UART_HandleTypeDef Error

54

Hi Nimaltd,

Can you help me please. I have problem buf ı can not solve that.

ERROR MESSAGE:

Build started: Project: sim
*** Using Compiler 'V5.06 update 6 (build 750)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin'
Build target 'sim'
compiling atc.c...
../Inc/atc.h(54): error: #20: identifier "UART_HandleTypeDef" is undefined
UART_HandleTypeDef *usart;
../Inc/atc.h(55): warning: #29-D: expected an expression
#elif
../Inc/atc.h(70): error: #20: identifier "UART_HandleTypeDef" is undefined
void atc_init(atc_t *atc, const char *name, UART_HandleTypeDef *USARTx, void *found);
../Inc/atc.h(71): warning: #29-D: expected an expression
#elif
..\Src\atc.c(32): error: #20: identifier "UART_HandleTypeDef" is undefined
void atc_init(atc_t *atc, const char *name, UART_HandleTypeDef *USARTx, void *found)
..\Src\atc.c(33): warning: #29-D: expected an expression
#elif
..\Src\atc.c(42): warning: #513-D: a value of type "void " cannot be assigned to an entity of type "void ()(char *)"
atc->found = found;
..\Src\atc.c(44): warning: #29-D: expected an expression
#elif
..\Src\atc.c(79): warning: #223-D: function "HAL_UART_Transmit_IT" declared implicitly
HAL_UART_Transmit_IT(atc->usart,data,len);
..\Src\atc.c(81): warning: #29-D: expected an expression
#elif
..\Src\atc.c(102): warning: #223-D: function "HAL_UART_Receive_IT" declared implicitly
HAL_UART_Receive_IT(atc->usart, &atc->tmp, 1);
..\Src\atc.c(103): warning: #29-D: expected an expression
#elif
..\Src\atc.c: 9 warnings, 3 errors
compiling call.c...
../Inc/atc.h(54): error: #20: identifier "UART_HandleTypeDef" is undefined
UART_HandleTypeDef *usart;
../Inc/atc.h(55): warning: #29-D: expected an expression
#elif
../Inc/atc.h(70): error: #20: identifier "UART_HandleTypeDef" is undefined
void atc_init(atc_t *atc, const char *name, UART_HandleTypeDef *USARTx, void *found);
../Inc/atc.h(71): warning: #29-D: expected an expression
#elif
..\Src\call.c: 2 warnings, 2 errors
compiling gprs.c...
../Inc/atc.h(54): error: #20: identifier "UART_HandleTypeDef" is undefined
UART_HandleTypeDef *usart;
../Inc/atc.h(55): warning: #29-D: expected an expression
#elif
../Inc/atc.h(70): error: #20: identifier "UART_HandleTypeDef" is undefined
void atc_init(atc_t *atc, const char *name, UART_HandleTypeDef *USARTx, void *found);
../Inc/atc.h(71): warning: #29-D: expected an expression
#elif
..\Src\gprs.c: 2 warnings, 2 errors
compiling gsm.c...
../Inc/atc.h(54): error: #20: identifier "UART_HandleTypeDef" is undefined
UART_HandleTypeDef *usart;
../Inc/atc.h(55): warning: #29-D: expected an expression
#elif
../Inc/atc.h(70): error: #20: identifier "UART_HandleTypeDef" is undefined
void atc_init(atc_t *atc, const char *name, UART_HandleTypeDef *USARTx, void *found);
../Inc/atc.h(71): warning: #29-D: expected an expression
#elif
..\Src\gsm.c: 2 warnings, 2 errors
compiling gsmCallback.c...
../Inc/atc.h(54): error: #20: identifier "UART_HandleTypeDef" is undefined
UART_HandleTypeDef *usart;
../Inc/atc.h(55): warning: #29-D: expected an expression
#elif
../Inc/atc.h(70): error: #20: identifier "UART_HandleTypeDef" is undefined
void atc_init(atc_t *atc, const char *name, UART_HandleTypeDef *USARTx, void *found);
../Inc/atc.h(71): warning: #29-D: expected an expression
#elif
..\Src\gsmCallback.c: 2 warnings, 2 errors
compiling msg.c...
../Inc/atc.h(54): error: #20: identifier "UART_HandleTypeDef" is undefined
UART_HandleTypeDef *usart;
../Inc/atc.h(55): warning: #29-D: expected an expression
#elif
../Inc/atc.h(70): error: #20: identifier "UART_HandleTypeDef" is undefined
void atc_init(atc_t *atc, const char *name, UART_HandleTypeDef *USARTx, void *found);
../Inc/atc.h(71): warning: #29-D: expected an expression
#elif
..\Src\msg.c: 2 warnings, 2 errors
compiling stm32f4xx_it.c...
../Src/stm32f4xx_it.c(209): warning: #223-D: function "gsm_rxCallback" declared implicitly
gsm_rxCallback();
../Src/stm32f4xx_it.c: 1 warning, 0 errors
compiling main.c...
../Inc/atc.h(54): error: #20: identifier "UART_HandleTypeDef" is undefined
UART_HandleTypeDef *usart;
../Inc/atc.h(55): warning: #29-D: expected an expression
#elif
../Inc/atc.h(70): error: #20: identifier "UART_HandleTypeDef" is undefined
void atc_init(atc_t *atc, const char *name, UART_HandleTypeDef *USARTx, void *found);
../Inc/atc.h(71): warning: #29-D: expected an expression
#elif
../Src/main.c: 2 warnings, 2 errors
"sim\sim.axf" - 15 Error(s), 22 Warning(s).
Target not created.
Build Time Elapsed: 00:00:26
54

Sim80x

Hi, your guide is very good. I found it well done and interesting.
One Question:
When you say _7) call Sim80x_Init(osPriorityLow) on your app. _ , where in the "main" i should put it to test your project?

Thanks and nice day.

مشکل دریافت پیام ارسال شده باsim800

سلام وقتتون بخیر. از کتابخونه استفاده کردم . در برخی موارد در جواب پیام ارسال شده با ماژول +cmgs می آد ولی پیام به گوشی نمیرسه.مخصوصا با سیمکارت ایرانسل مشکل چیه؟

Receiving big buffer data with gsm_gprs_httpRead

I had issue for receiving 1kB data from http read request.
we need to increase timeout for send at command for receive big buffer

sprintf(buf, "AT+HTTPREAD=%u,%d\r\n", gsm.gprs.dataCurrent, len); gsm.atc.http_read_start=1; if (gsm_command(buf, 3000 , (char*)gsm.buffer, sizeof(gsm.buffer), 2, "\r\n+HTTPREAD: ", "\r\nERROR\r\n") != 1) { gsm_printf("[GSM] gprs_httpRead() failed!\r\n"); gsm_unlock(); return 0; }

MQTT

Hello. I really like your job. I am using your libraries. Could you add MQTT work? Thank you.

dtmf

Detection of DTMF tones in my SIM800L module.

I get "OK" when I send 'AT+DDET=1,1000,1,1* ' over uart .
But it doesnt seem to detect anything afterwards.
Perhaps I am doing something wrong.
Would be great to get some feedback.

regards
Atul
ref : *SIM800 Series_AT Command Manual_V1.09

ارسال sms فارسی

سلام و وقت بخیر
من می خواستم از کتابخانه شما تو محیط کیل برای ارسال متن فارسی استفاده کنم. می شه یه راهنمایی بکنین. ممنونم

issue on set text mode parameter

in gsm.c line 272 must be change from
snprintf(strParam,sizeof(strParam),"AT+CSMP=%d,%d,%d,%d\r\nOK\r\n",fo,vp,pid,dcs);
to
snprintf(strParam,sizeof(strParam),"AT+CSMP=%d,%d,%d,%d\r\r\nOK\r\n",fo,vp,pid,dcs);

at library not compatible with stm32f103c8?

I fellow your instruction but i come with this error can u help me to fix it ?

c:\st\stm32cubeide_1.6.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924\tools\arm-none-eabi\bin\ld.exe: Core/Src/atc.o: in function `atc_init':

C:/Users/20106/STM32CubeIDE/workspace_1.6.0/GSM_800L_INTERFACE/Debug/../Core/Src/atc.c:39: undefined reference to `LL_USART_EnableIT_RXNE'
i believe this error cause LL_USART_EnableIT_RXNE not compatible with stm32f103 am right??

DataTransferMode

Hi,
could you please explain the usage of Sim80x.Status.DataTransferMode? when mode can be 0 or 1 ?

مشکل در دریافت \کت mqtt

یلام و عرض ادب . من از کتابخانه شما برای ارسال و دریافت پکتها باپروتکل mqqt استفاده کردم. اولا که احسنت بر شما و دست مریزاد .
در وهله بعد ما هنگام publish , subscibe کردن هیچ مشگلی نداریم ولی پکت ها رو از قرار به شکل دو تکه دریافت میکنیم و خروجی sim800 یه این شکل است :
+SMPUBLISH: 0,"/TN1234/C/Ct",15,""

+SMPUBLISH: 0,"",0,""

گفتم شاید شما به همچین موردی برخورده باشید یا بتونید به ما کمک کنید . ممنونم

مشکل در دریافت اس ام اس

با سلام هنگام دریافت اس ام اس شماره فرستنده به صورت یو تی اف 8 ارسال میشود و فضای کافی جهت ذخیره شماره در دسترس نیست!!
البته این تو حالت هگز اتفاق می افته.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.