My UNO Q is not doing well in App Lab 0.4.0

In the previous version (0.3.2) of App Lab the following application (in every 10 sec interval MPU asks the MCU to blink LED3_R for five times) was working well. In the current version (0.4.0) of App Lab which was automatically updated, the program does not run. This is the error message: (Any program that involves Bridge.call()/provide()/notify() does not run!)

python provisioning
python downloading
Network blink-led3_r-for-five-times-requested-by-mpuworking_default  Creating
Network blink-led3_r-for-five-times-requested-by-mpuworking_default  Error
failed to create network blink-led3_r-for-five-times-requested-by-mpuworking_default: Error response from daemon: could not find an available, non-overlapping IPv4 address pool among the defaults to assign to the network
exit status 

Please advice what should I do now?

Sketch:

#include "Arduino_RouterBridge.h" //provides data excage facilities for UART2 

void setup() 
{
    pinMode(LED3_R, OUTPUT);
    digitalWrite(LED3_R, HIGH);  //HIGH state means LED is OFF
  
    Bridge.begin();    //enables UART2's loe level functions 
    Bridge.provide("led_blink", led_blink);  //led_blin is the name of ISR
}

void loop() 
{
  
}

void led_blink(byte count) //ISR when TX2 is ready; count comes from MPU
{
  for(int i = 0 ; i<count; i++)
    {
      digitalWrite(LED3_R, HIGH);
      delay(500);
      digitalWrite(LED3_R, LOW);
      delay(500);
    }
  digitalWrite(LED3_R, HIGH);
}

Script:

from arduino.app_utils import *
import time

last_time = 0      # the last time LED did blinking
interval = 10      # Interval in seconds

def loop():
    global last_time

    current_time = time.time()  # Get current time in seconds
   
    if current_time - last_time >= interval:  # Check if 10 seconds have passed
        Bridge.call("led_blink", 5)  #comand string, five times to blink
        last_time = current_time       
    
App.run(user_loop=loop) # Start the App Lab loop`

I would downgrade the STM core to 52, 53 seems to kill the bridge..
I used the command from this post..
They need to be run from a terminal or shell..
good luck.. ~q

1 Like

Hi @GolamMostafa. Try this:

  1. Start Arduino App Lab and connect it to your UNO Q board (if using the board in PC hosted mode).
  2. If you are using the board in PC hosted mode, click the >_ ("Connect to the board's shell") icon near the bottom left hand corner of the Arduino App Lab window. Otherwise, open the terminal via the desktop menu.
    A terminal window will open.
  3. Type the following command in the terminal window:
    arduino-app-cli system cleanup
    
  4. Press the Enter key.
    A message will appear:
    Running cleanup...
    
  5. Wait for the cleanup process to finish.
  6. Close the terminal window.

Now try starting your App again. Hopefully this time it will start up successfully.

@ptillisch
I have followed your steps of #3 and saw that 6 containers are cleaned. Anyway, it has not helped. The failed app is not running!

OK, run this command from the terminal:

docker network prune

Then try starting the App again.

1 Like

@ptillisch

This time it works after following your #5!

Would be glad to know wat happened to the router bridge and now it is healthy.

Thanks!

The first time you start an App, a Docker container is created. This container provides a dedicated environment in which the App's Python script is executed, isolated from the environment of the UNO Q's Linux operating system.

A dedicated Docker network is created for each App, in order to allow network communication.

Docker allocates a subnet to the network from an address pool:

https://docs.docker.com/engine/network/#automatic-subnet-allocation

This pool is quite limited, so can be quickly exhausted as you create more Apps. When the pool is exhausted, starting a new App fails with the error message you encountered, due to not being able to create the network for the App's container:

The arduino-app-cli system cleanup command removes all containers that are not in use by a running App.

The docker network prune command removes all Docker networks that not referenced by a container.

So by running these commands in sequence, you free up space in the address pool, and thus make it possible for a new network to be created for the App you are trying to start.

There is more information on the subject here:

4 Likes

The Arduino developers are adding the network pruning operation to the arduino-app-cli system cleanup command of the Arduino App CLI tool:

In addition to being convenient to those users who work directly with Arduino App CLI from the command line, this also makes the functionality available to Arduino App Lab (since Arduino App CLI serves as its backend).

2 Likes