Go Down

Topic: ESP8266 not working with Lora transmit that uses yield() internally (Read 122 times) previous topic - next topic

wonderfuliot

Hi,

I have a code that reads a GPIO and sends it it over Lora radio on ESP8266. There is a wifi page that shows the status on a web client.
Both the radio and wifi code works independently, however WiFi doesnt work when integrated together

While debugging the problem, I reached a call to yield in the LoRa library. Commenting the yield() function makes both work.

So, my question is, what is about a call to the yield() that the wifi does not like.
Here is the problematic LoRa transmit function

Hope somebody can pinpoint the problem and provide the solution.

Code: [Select]

int LoRaClass::endPacket()
{
  // put in TX mode
  writeRegister(REG_OP_MODE, MODE_LONG_RANGE_MODE | MODE_TX);

  // wait for TX done
  while ((readRegister(REG_IRQ_FLAGS) & IRQ_TX_DONE_MASK) == 0) {
    //yield();
  }

  // clear IRQ's
  writeRegister(REG_IRQ_FLAGS, IRQ_TX_DONE_MASK);

  return 1;
}


Thanks and Regards,
WI

wonderfuliot

Similar issue in this thread https://arduino.stackexchange.com/questions/45023/why-isnt-esp8266-connecting-to-wifi-when-calling-yield?answertab=active#tab-top

pylon


wonderfuliot

https://github.com/sandeepmistry/arduino-LoRa/tree/master/src

wonderfuliot

Before calling yield() in the LoRa library, if I call 'server.handleClient()' in an attempt to let WiFi do what it wants to do then the issue seems to be fixed.


pylon

I would have expected the yield() function to do that. It's necessary to call this function on the ESP8266 from time to time if you do lengthy task on it, so the loop() doesn't return often enough. According to the documentation it's responsible that all the code that handles WiFi and other hardware features is executed often enough to not let it starve.

Go Up