Skip to content
This repository has been archived by the owner on Jan 11, 2020. It is now read-only.

Unstable OTA #52

Open
Fuempel opened this issue May 2, 2018 · 2 comments
Open

Unstable OTA #52

Fuempel opened this issue May 2, 2018 · 2 comments

Comments

@Fuempel
Copy link
Contributor

Fuempel commented May 2, 2018

When using Basecamp 0.1.8 with PlatformIO / Atom, the OTA feature works very easily. However it is not stable and not successful in a high number of attempts.

I guess, main reason for this is the excessive delay in Basecamp.cpp:

void Basecamp::OTAHandling(void * OTAParams) {

    ...

    // The while loop checks if OTA requests are received and sleeps for a bit if not
    while (1) {
      ArduinoOTA.handle();
      vTaskDelay(100);
    }
}

The original value of 100 ms is way too high for the UDP based transmission, for high speed connections. Changing the value to 5 solved the problem for me for the moment.

But I am not sure on the side effects (runtime consumption) and if 5 ms is sufficiently low. Can you please check ?

@Fuempel Fuempel changed the title Unstable OTA due to too high delay Unstable OTA May 4, 2018
@Fuempel
Copy link
Contributor Author

Fuempel commented May 4, 2018

After some additional investigation, I guess the above mentioned delay is not the real root cause. Still it remains unstable.
Also the parameter to vTaskDelay is not in ms, but in ticks.

But: I suspect the real root cause is that the ArduinoOTA library is not designed to run in a separate task in core 0, in parallel to the Arduino infrastucture.

I did a prototype, where the creatin of an additional task via xTaskCreatePinnedToCore(&OTAHandling, "ArduinoOTATask", ...) is avoided.

I have implemented a member function Basecamp::handle, called from main.cpp loop() function which then calls ArduinoOTA.handle(); Then ArduinoOTA runs on core 1 together with other Arduino infrastracture.

With this, I have a stabel setup of OTA functionality.

@Fuempel
Copy link
Contributor Author

Fuempel commented May 4, 2018

see PR #53

@poesel poesel mentioned this issue Jun 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant