Giter Site home page Giter Site logo

leech001 / sim800mqtt Goto Github PK

View Code? Open in Web Editor NEW
133.0 4.0 42.0 1008 KB

STM32 HAL library for SIM800 release MQTT client over AT command

License: Do What The F*ck You Want To Public License

C 100.00%
stm32 bluepill mqtt mqtt-client sim800 at at-command hal gprs gprssim800

sim800mqtt's People

Contributors

leech001 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

sim800mqtt's Issues

problem with MQTT_sub()

hello, your library is very great, but currently i am facing an issue on your library...whenever i try to use MQTT_sub(), my terminal says CLOSED (which showed CONNECT before it happened) not long after i call that function...after that, i am unable to send data to the broker except if i call MQTT_Init() which means i have to reinitialize the parameters again...do you know how to solve this issue? i am just able to send data to the broker but i am unable to subscribe to anything to receive data...your help is very appreciated, thx

stm32

i want to publish a message in the topic "test" how can i add the instruction

is there a way to set QOS?

hi there!
first off , thanks for publishing this amazing library!

I remember that I was using this library , months ago, using a STM32 nucleo + sim800l. I used hivemqtt's free broker to test everything. The library used to work OK. Now however I have noticed that sometimes I get the message that I publish and sometimes I don't(i am using a never-ending loop to keep sending the same message over and over again). Sometimes I get the messages for a short time then don't get them anymore. I think it has to do with the fact that hivemqtt's free version is not stable and I get disconnected soon after connecting but the library does not detect that, my sim800l keeps blinking fast and does not get reset by the library which means that it is still sending the message but the broker doesn't receive it.

Now in the code there is a part where if the connect function returns no errors then it sets the "connected" variable to 1 and then never checks if the connection is still ok ever again. I think the recent version subscribes to the same topic it publishes to and checks if the messages it's sending is being received. But why not just use a higher QOS instead of using extra traffic to check every message you publish? or am I misunderstanding how your code works?
thank you very much in advance!

SIM800 does not works after receives data from the server.

Hello
I was testing your library and can't find the problem after the sim800L receives data from the server (SIM800.mqttReceive.newEvent == 1)
The problem is in my case: after receiving the payload, the system stops working. No published messages, no subscription messages are received .
I debug the code and it is working but the sim800 appears be frozen after receive the payload from the server(in the image the last two line are topic and payload, I put a black square to hide the topic and ip). I tested the sim sim800c and sim800L with arduino mqqt library and it works okay.

And also sometime if the sim800 lost connection or signal while is in the data mode, the code cannot detect this condition and the status is kept always like server is connected (SIM800.mqttServer.connect == 1). I dont know how to fix it, I give up.

thanks for read
command

AT+CIPSEND command

Hi,

I'm studying your git repo for sending MQTT commands using STM32 with SIM800 series connected to STM32 through UART, using AT commands.

I'm a little confused by the function: MQTT_SUB: this function sentd over the UART the string coming from the function MQTTSerialize_publish but this string is not comatible with the at commands.
What's I'm missing?
As far as I know the string should be published to SIM800 using the command AT+CIPSEND"hello world"

How do you deal with it?
Thanks for the answer,
Marco.

SUBSCRIBE command sends garbage in reserved bits of maximum QoS field

MQTTSerialize_subscribe() takes an array of subscription topics strings and an array of maximum QoS for these topics. MQTT_Sub() always subscribes to one topic. Then it should specify an address of a pointer to topic string (which it does) and an address of a variable containing 0 as maximum QoS. It passes straight 0 instead, which makes MQTTSerialize_subscribe() to read QoS level from memory address 0 (MQTTSubscribeClient.c/79). As the whole byte is put into MQTT packet, 6 high, reserved bits of the field may contain random values. Protocol strict brokers like Mosquitto disconnect after receiving such SUBSCRIBE.

Sim800_RxCallBack doesn't detect CLOSED or ERROR

This issue is caused by the presence of '\0' value in rx_buffer element that occurs before the string CLOSED or ERROR, strstr will stop at the occurrence of a terminating null-characters ('\0').

To check this, just decrease the keepAliveInterval and increase the delay in the while(1) loop (i suggest 60 seconds for the delay and 10 seconds for the keepAliveInterval)

To solve this, replace the line 77 in MQTTSim800.c with:
if ( ( rx_index > 9 && strstr( (char *) &(rx_buffer[rx_index-10]), "\r\nCLOSED\r\n" ) ) || ( rx_index > 8 && strstr( (char *) &(rx_buffer[rx_index-9]), "\r\nERROR\r\n" ) ) )

subs support

Hi, are you planning to add support for topic subscribe?

thank

stuck in HAL_Delay after an arbitrary period of time

hi.
thanks for creating this library , it saved me from having to manually create and send my own mqtt packets :D
i am using www.moqiatto.com to test your app. i am using a nucleo f446-re alongside a sim800l module to send mqtt packets.

i have started a fresh project to make sure that my firmware is not conflicting with your code , the problem is that when i set system clock on 80 MHZ(default) i receive messages from my micro with no problem however after some time i stop receiving messages when i set sys clock on 180mhz(max) i get stuck immidietaly before recieving anything..i though it was a server issue but when i debug your code manually by clicking on next step everything works fine but when everything happens automatically i get stuck in HAL_Delay. i think there is an interrupt conflict or something.
im using UART4
baud rate is 115200(maybe it's too high?)
NVIC priority for system clock is 0 and 0
NVIC priority for UART is also 0 , 0 changing it to 0 and 1 did not solve the issue.
can anyone help? thank you

sim808

willl it work on sim808.
do I need to update the sim808 firmware ?

MQTT_Init() is trying 3 times to connect MQTT server

Thanks for great lib.

Observed that MQTT_Init() function is iterating 3 times before connecting to MQTT server though GPRS connection is alive.
Is this expected?

Here is my debug message from main.c

08:32:41.030 --> SIM800 Init
08:32:41.526 --> SIM800 Powering
08:32:43.519 --> SIM800 Connecting
08:32:53.495 --> MQTT Connection Setup
08:32:53.495 --> MQTT Connection Init
08:33:09.470 --> MQTT Connection Init
08:33:26.419 --> MQTT Connection Init
08:33:54.365 --> MQTT Connected

Execution blocked on SIM800_SendCommand

During the MQTT initialization (function MQTT_Init), the execution suddenly blocks on SIM800_SendCommand.

Below is a screenshot showing where the code stop working.

error

I'm not able to understand why the code execution stops right there.

Do you have any suggstion on what to debug?

Thanks,

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.