elementzonline / SIM800_MQTT

Visit our blog/website for more information
http://www.elementzonline.com
GNU General Public License v3.0
170 stars 96 forks source link

UART gets stuck after publishing once. #21

Closed siddharthtaunk closed 4 years ago

siddharthtaunk commented 7 years ago

Hi,

We have the data coming on the UART which has to receieved and send to the MQTT broker. The issue is when ever I send the first publish message, the UART data is either lost or incomplete.

I am using the following routine to do so.

if (MQTT.available())
{

   digitalWrite(7, LOW);
   delay(200);
   digitalWrite(7, HIGH);  
   if(Serial1.available()>0)
   {
     str1 =Serial1.readString();
   }
    . . . . .
}

I have tried reading character by character but having the same issue.

Thanks and regards. Siddharth Taunk

siddharthtaunk commented 6 years ago

to be more clear on this UART0 is used for SIM800 as mentioned in the code and we are using UART1 to sniff the data from another source.

before Hitting mqtt.available() or mqtt.processing() UART1 works perfectly. But as soon as any of these lines are hit, the data from UART1 starts getting corrupted / incomplete.

kindly suggest some solution for the same.

Thanks and regards. Siddharth