diff --git a/source/ameba_pro2/amb82-mini/Example_Guides/Debugging/Debugging - Using the Debug Interface.rst b/bak/amb82-mini/Example_Guides/Debugging/Debugging - Using the Debug Interface.rst similarity index 100% rename from source/ameba_pro2/amb82-mini/Example_Guides/Debugging/Debugging - Using the Debug Interface.rst rename to bak/amb82-mini/Example_Guides/Debugging/Debugging - Using the Debug Interface.rst diff --git a/source/ameba_pro2/amb82-mini/Example_Guides/Debugging/index.rst b/bak/amb82-mini/Example_Guides/Debugging/index.rst similarity index 100% rename from source/ameba_pro2/amb82-mini/Example_Guides/Debugging/index.rst rename to bak/amb82-mini/Example_Guides/Debugging/index.rst diff --git a/source/_common/ameba_d/Example_Guides/MQTT/MQTT - Set up MQTT Client to Communicate with Broker.rst b/source/_common/ameba_d/Example_Guides/MQTT/MQTT - Set up MQTT Client to Communicate with Broker.rst index a63a6e5..999efa3 100644 --- a/source/_common/ameba_d/Example_Guides/MQTT/MQTT - Set up MQTT Client to Communicate with Broker.rst +++ b/source/_common/ameba_d/Example_Guides/MQTT/MQTT - Set up MQTT Client to Communicate with Broker.rst @@ -140,6 +140,28 @@ Click “CONNECT”. The “hello world” message show up at left side. At righ |image13| +**MQTT_NonBlocking example** + +Open the MQTT example: “File” → “Examples” → “AmebaMQTTClient” → “MQTT_NonBlocking”. + +This example demonstrates how to maintain a connection to the MQTT broker using a **non-blocking** reconnect approach. If the connection is lost, the board will attempt to reconnect **every 5 seconds**, without halting the rest of the loop operations. + +Please modify some WiFi-related parameter and some information related to MQTT: + +|image14| + +- All parameters are same as MQTT_Auth example. + +Next, compile the code and upload it to Ameba. Press the reset button, then open the serial monitor. After Ameba is connected to MQTT server, it sends the message “hello world” to “outTopic”. To see the message, another MQTT client needs to be set up. + +Start the MQTT Explore, and setup the auth connection. All setting is same as MQTT_Auth example. + +Click “ADVANCED” at bottom for topic setup. Use “outTopic” that same as “publishTopic” of the board. Click “ADD” then “BACK”. + +Click “CONNECT”. The “hello world” message show up at left side. At right side, under “Publish” use “inTopic” same as “sucribeTopic” of the board. Choose “raw” and input “Text hello Ameba”, then click “PUBLISH”. The board will receive the MQTT Explorer published raw message. Then publish it from the board side and MQTT Explorer will receive at the left side. Note, “hello world” sometimes is not shown up because the boards connect to MQTT broker before the MQTT Explorer. + +.. note :: This example uses a **non-blocking reconnect** mechanism. That means the board does not freeze while waiting to reconnect. You can continue performing other tasks inside `loop()` even during disconnection periods. + .. |image01| image:: ../../../../_static/amebad/Example_Guides/MQTT/MQTT_Set_Up_MQTT_Client_To_Communicate_With_Broker/image01.png :width: 940 :height: 619 @@ -186,3 +208,7 @@ Click “CONNECT”. The “hello world” message show up at left side. At righ .. |image13| image:: ../../../../_static/amebad/Example_Guides/MQTT/MQTT_Set_Up_MQTT_Client_To_Communicate_With_Broker/image13.png :width: 650 :height: 199 +.. |image14| image:: ../../../../_static/amebad/Example_Guides/MQTT/MQTT_Set_Up_MQTT_Client_To_Communicate_With_Broker/image14.png + :width: 1070 + :height: 1217 + :scale: 80% \ No newline at end of file diff --git a/source/_common/ameba_d/Example_Guides/SYS/SYS - MemInfo.rst b/source/_common/ameba_d/Example_Guides/SYS/SYS - MemInfo.rst new file mode 100644 index 0000000..990bef7 --- /dev/null +++ b/source/_common/ameba_d/Example_Guides/SYS/SYS - MemInfo.rst @@ -0,0 +1,57 @@ +SYS - MemInfo +============= + +.. contents:: + :local: + :depth: 2 + +Materials +--------- + +- AmebaD [AMB21 / AMB22 / AMB23 / AMB25 / AMB26 / BW16 / AW-CU488 Thing Plus] x 1 + + +**Introduction** +~~~~~~~~~~~~~~~~ + +This example demonstrates how to monitor the current OS free heap size on the Ameba board using FreeRTOS. + +FreeRTOS uses a memory heap for dynamic memory allocation and creating threads. Monitoring the heap size is important because a low heap size can lead to allocation failures and abnormal behavior. + +**Procedure** +~~~~~~~~~~~~~ + +Step 1. Open Example + +Open the example: ``“Files” → “Examples” → “AmebaSys” → “MemInfo”`` + +|image01| + +Step 2. Upload Code + +Upload the code and open the Serial Monitor. + +The output will show the available heap size before and after memory allocation and freeing: + +- Initial free heap size +- Free heap size after allocating 1000 bytes +- Free heap size after freeing the memory + +This helps you understand how dynamic memory usage affects available heap space at runtime. + +|image02| + +.. note :: If the available heap size becomes too low, and memory is allocated beyond what is available, the allocation will fail. + +|image03| + +.. |image01| image:: ../../../../_static/amebad/Example_Guides/SYS/SYS_MemInfo/image01.png + :width: 2553 + :height: 1376 + :scale: 30% +.. |image02| image:: ../../../../_static/amebad/Example_Guides/SYS/SYS_MemInfo/image02.png + :width: 606 + :height: 254 +.. |image03| image:: ../../../../_static/amebad/Example_Guides/SYS/SYS_MemInfo/image03.png + :width: 809 + :height: 167 \ No newline at end of file diff --git a/source/_common/ameba_d/Example_Guides/SYS/index.rst b/source/_common/ameba_d/Example_Guides/SYS/index.rst new file mode 100644 index 0000000..be88c3d --- /dev/null +++ b/source/_common/ameba_d/Example_Guides/SYS/index.rst @@ -0,0 +1,7 @@ +SYS +=== + +.. toctree:: + :maxdepth: 1 + + SYS - MemInfo diff --git a/source/_static/amebad/Example_Guides/MQTT/MQTT_Set_Up_MQTT_Client_To_Communicate_With_Broker/image14.png b/source/_static/amebad/Example_Guides/MQTT/MQTT_Set_Up_MQTT_Client_To_Communicate_With_Broker/image14.png new file mode 100644 index 0000000..deac630 Binary files /dev/null and b/source/_static/amebad/Example_Guides/MQTT/MQTT_Set_Up_MQTT_Client_To_Communicate_With_Broker/image14.png differ diff --git a/source/_static/amebad/Example_Guides/SYS/SYS_MemInfo/image01.png b/source/_static/amebad/Example_Guides/SYS/SYS_MemInfo/image01.png new file mode 100644 index 0000000..14003ab Binary files /dev/null and b/source/_static/amebad/Example_Guides/SYS/SYS_MemInfo/image01.png differ diff --git a/source/_static/amebad/Example_Guides/SYS/SYS_MemInfo/image02.png b/source/_static/amebad/Example_Guides/SYS/SYS_MemInfo/image02.png new file mode 100644 index 0000000..a75eca1 Binary files /dev/null and b/source/_static/amebad/Example_Guides/SYS/SYS_MemInfo/image02.png differ diff --git a/source/_static/amebad/Example_Guides/SYS/SYS_MemInfo/image03.png b/source/_static/amebad/Example_Guides/SYS/SYS_MemInfo/image03.png new file mode 100644 index 0000000..a068eaa Binary files /dev/null and b/source/_static/amebad/Example_Guides/SYS/SYS_MemInfo/image03.png differ diff --git a/source/ameba_d/amb21/Example_Guides/index.rst b/source/ameba_d/amb21/Example_Guides/index.rst index 2d1baa1..71bd054 100644 --- a/source/ameba_d/amb21/Example_Guides/index.rst +++ b/source/ameba_d/amb21/Example_Guides/index.rst @@ -25,6 +25,7 @@ Example Guides PWM/index RTC/index SPI/index + SYS/index TensorFlow Lite/index UART/index USB/index diff --git a/source/ameba_d/amb23/Example_Guides/index.rst b/source/ameba_d/amb23/Example_Guides/index.rst index 52cbae9..1ab3a8e 100644 --- a/source/ameba_d/amb23/Example_Guides/index.rst +++ b/source/ameba_d/amb23/Example_Guides/index.rst @@ -24,6 +24,7 @@ Example Guides PWM/index RTC/index SPI/index + SYS/index TensorFlow Lite/index UART/index USB/index diff --git a/source/ameba_d/amb25/Example_Guides/index.rst b/source/ameba_d/amb25/Example_Guides/index.rst index a38a05c..f1bb727 100644 --- a/source/ameba_d/amb25/Example_Guides/index.rst +++ b/source/ameba_d/amb25/Example_Guides/index.rst @@ -23,6 +23,7 @@ Example Guides PWM/index RTC/index SPI/index + SYS/index TensorFlow Lite/index UART/index WDT/index diff --git a/source/ameba_d/amb26/Example_Guides/index.rst b/source/ameba_d/amb26/Example_Guides/index.rst index a38a05c..f1bb727 100644 --- a/source/ameba_d/amb26/Example_Guides/index.rst +++ b/source/ameba_d/amb26/Example_Guides/index.rst @@ -23,6 +23,7 @@ Example Guides PWM/index RTC/index SPI/index + SYS/index TensorFlow Lite/index UART/index WDT/index diff --git a/source/ameba_d/aw-cu488/Example_Guides/index.rst b/source/ameba_d/aw-cu488/Example_Guides/index.rst index e1caffb..5626160 100644 --- a/source/ameba_d/aw-cu488/Example_Guides/index.rst +++ b/source/ameba_d/aw-cu488/Example_Guides/index.rst @@ -24,6 +24,7 @@ Example Guides PWM/index RTC/index SPI/index + SYS/index TensorFlow Lite/index UART/index WDT/index diff --git a/source/ameba_d/bw16-typeb/Example_Guides/index.rst b/source/ameba_d/bw16-typeb/Example_Guides/index.rst index 29edb13..e5d7c3b 100644 --- a/source/ameba_d/bw16-typeb/Example_Guides/index.rst +++ b/source/ameba_d/bw16-typeb/Example_Guides/index.rst @@ -23,6 +23,7 @@ Example Guides PWM/index RTC/index SPI/index + SYS/index TensorFlow Lite/index UART/index WDT/index diff --git a/source/ameba_d/bw16-typec/Example_Guides/index.rst b/source/ameba_d/bw16-typec/Example_Guides/index.rst index a533e39..a42284e 100644 --- a/source/ameba_d/bw16-typec/Example_Guides/index.rst +++ b/source/ameba_d/bw16-typec/Example_Guides/index.rst @@ -23,6 +23,7 @@ Example Guides PWM/index RTC/index SPI/index + SYS/index TensorFlow Lite/index UART/index WDT/index diff --git a/source/ameba_pro2/amb82-mini/Example_Guides/index.rst b/source/ameba_pro2/amb82-mini/Example_Guides/index.rst index af47dfd..9003c98 100644 --- a/source/ameba_pro2/amb82-mini/Example_Guides/index.rst +++ b/source/ameba_pro2/amb82-mini/Example_Guides/index.rst @@ -6,7 +6,6 @@ Example Guides Basic/index BLE/index - Debugging/index E-Paper/index File System/index Flash Memory/index diff --git a/source/custom_script.py b/source/custom_script.py index ed76a48..15da061 100644 --- a/source/custom_script.py +++ b/source/custom_script.py @@ -15,7 +15,8 @@ , '_common/ameba_d/API_Documents/SoftwareSerial', '_common/ameba_d/API_Documents/SPI', '_common/ameba_d/API_Documents/Sys', '_common/ameba_d/API_Documents/USB', '_common/ameba_d/API_Documents/WDT' , '_common/ameba_d/API_Documents/Wire', '_common/ameba_d/API_Documents/WS2812B', '_common/ameba_d/Example_Guides/BLE', '_common/ameba_d/Example_Guides/Debugging', '_common/ameba_d/Example_Guides/Flash Memory' , '_common/ameba_d/Example_Guides/GPIO', '_common/ameba_d/Example_Guides/GTimer', '_common/ameba_d/Example_Guides/I2C', '_common/ameba_d/Example_Guides/IPv6', '_common/ameba_d/Example_Guides/MDNS' - , '_common/ameba_d/Example_Guides/MQTT', '_common/ameba_d/Example_Guides/PWM', '_common/ameba_d/Example_Guides/UART', '_common/ameba_d/Example_Guides/WDT', '_common/ameba_d/Example_Guides/WS2812B'], + , '_common/ameba_d/Example_Guides/MQTT', '_common/ameba_d/Example_Guides/PWM', '_common/ameba_d/Example_Guides/UART', '_common/ameba_d/Example_Guides/WDT', '_common/ameba_d/Example_Guides/WS2812B' + , '_common/ameba_d/Example_Guides/SYS'], 'amb23': ['_common/ameba_d/API_Documents/Analog', '_common/ameba_d/API_Documents/AudioCodec' , '_common/ameba_d/API_Documents/BLE', '_common/ameba_d/Example_Guides/OTA', '_common/ameba_d/API_Documents/EPDIF', '_common/ameba_d/API_Documents/FatfsSDcard', '_common/ameba_d/API_Documents/FlashMemory' @@ -25,7 +26,8 @@ , '_common/ameba_d/API_Documents/SoftwareSerial', '_common/ameba_d/API_Documents/SPI', '_common/ameba_d/API_Documents/Sys', '_common/ameba_d/API_Documents/USB', '_common/ameba_d/API_Documents/WDT' , '_common/ameba_d/API_Documents/Wire', '_common/ameba_d/API_Documents/WS2812B', '_common/ameba_d/Example_Guides/BLE', '_common/ameba_d/Example_Guides/Debugging', '_common/ameba_d/Example_Guides/Flash Memory' , '_common/ameba_d/Example_Guides/GPIO', '_common/ameba_d/Example_Guides/GTimer', '_common/ameba_d/Example_Guides/I2C', '_common/ameba_d/Example_Guides/IPv6', '_common/ameba_d/Example_Guides/MDNS' - , '_common/ameba_d/Example_Guides/MQTT', '_common/ameba_d/Example_Guides/PWM', '_common/ameba_d/Example_Guides/UART', '_common/ameba_d/Example_Guides/WDT', '_common/ameba_d/Example_Guides/WS2812B'], + , '_common/ameba_d/Example_Guides/MQTT', '_common/ameba_d/Example_Guides/PWM', '_common/ameba_d/Example_Guides/UART', '_common/ameba_d/Example_Guides/WDT', '_common/ameba_d/Example_Guides/WS2812B' + , '_common/ameba_d/Example_Guides/SYS'], 'amb25': ['_common/ameba_d/API_Documents/Analog', '_common/ameba_d/API_Documents/AudioCodec' , '_common/ameba_d/API_Documents/BLE', '_common/ameba_d/Example_Guides/OTA', '_common/ameba_d/API_Documents/EPDIF', '_common/ameba_d/API_Documents/FatfsSDcard', '_common/ameba_d/API_Documents/FlashMemory' @@ -35,7 +37,8 @@ , '_common/ameba_d/API_Documents/SoftwareSerial', '_common/ameba_d/API_Documents/SPI', '_common/ameba_d/API_Documents/Sys', '_common/ameba_d/API_Documents/USB', '_common/ameba_d/API_Documents/WDT' , '_common/ameba_d/API_Documents/Wire', '_common/ameba_d/API_Documents/WS2812B', '_common/ameba_d/Example_Guides/BLE', '_common/ameba_d/Example_Guides/Debugging', '_common/ameba_d/Example_Guides/Flash Memory' , '_common/ameba_d/Example_Guides/GPIO', '_common/ameba_d/Example_Guides/GTimer', '_common/ameba_d/Example_Guides/I2C', '_common/ameba_d/Example_Guides/IPv6', '_common/ameba_d/Example_Guides/MDNS' - , '_common/ameba_d/Example_Guides/MQTT', '_common/ameba_d/Example_Guides/PWM', '_common/ameba_d/Example_Guides/UART', '_common/ameba_d/Example_Guides/WDT', '_common/ameba_d/Example_Guides/WS2812B'], + , '_common/ameba_d/Example_Guides/MQTT', '_common/ameba_d/Example_Guides/PWM', '_common/ameba_d/Example_Guides/UART', '_common/ameba_d/Example_Guides/WDT', '_common/ameba_d/Example_Guides/WS2812B' + , '_common/ameba_d/Example_Guides/SYS'], 'amb26': ['_common/ameba_d/API_Documents/Analog', '_common/ameba_d/API_Documents/AudioCodec' , '_common/ameba_d/API_Documents/BLE', '_common/ameba_d/Example_Guides/OTA', '_common/ameba_d/API_Documents/EPDIF', '_common/ameba_d/API_Documents/FatfsSDcard', '_common/ameba_d/API_Documents/FlashMemory' @@ -45,7 +48,8 @@ , '_common/ameba_d/API_Documents/SoftwareSerial', '_common/ameba_d/API_Documents/SPI', '_common/ameba_d/API_Documents/Sys', '_common/ameba_d/API_Documents/USB', '_common/ameba_d/API_Documents/WDT' , '_common/ameba_d/API_Documents/Wire', '_common/ameba_d/API_Documents/WS2812B', '_common/ameba_d/Example_Guides/BLE', '_common/ameba_d/Example_Guides/Debugging', '_common/ameba_d/Example_Guides/Flash Memory' , '_common/ameba_d/Example_Guides/GPIO', '_common/ameba_d/Example_Guides/GTimer', '_common/ameba_d/Example_Guides/I2C', '_common/ameba_d/Example_Guides/IPv6', '_common/ameba_d/Example_Guides/MDNS' - , '_common/ameba_d/Example_Guides/MQTT', '_common/ameba_d/Example_Guides/PWM', '_common/ameba_d/Example_Guides/UART', '_common/ameba_d/Example_Guides/WDT', '_common/ameba_d/Example_Guides/WS2812B'], + , '_common/ameba_d/Example_Guides/MQTT', '_common/ameba_d/Example_Guides/PWM', '_common/ameba_d/Example_Guides/UART', '_common/ameba_d/Example_Guides/WDT', '_common/ameba_d/Example_Guides/WS2812B' + , '_common/ameba_d/Example_Guides/SYS'], 'bw16-typeb': ['_common/ameba_d/API_Documents/Analog', '_common/ameba_d/API_Documents/AudioCodec' , '_common/ameba_d/API_Documents/BLE', '_common/ameba_d/Example_Guides/OTA', '_common/ameba_d/API_Documents/EPDIF', '_common/ameba_d/API_Documents/FatfsSDcard', '_common/ameba_d/API_Documents/FlashMemory' @@ -55,7 +59,8 @@ , '_common/ameba_d/API_Documents/SoftwareSerial', '_common/ameba_d/API_Documents/SPI', '_common/ameba_d/API_Documents/Sys', '_common/ameba_d/API_Documents/USB', '_common/ameba_d/API_Documents/WDT' , '_common/ameba_d/API_Documents/Wire', '_common/ameba_d/API_Documents/WS2812B', '_common/ameba_d/Example_Guides/BLE', '_common/ameba_d/Example_Guides/Debugging', '_common/ameba_d/Example_Guides/Flash Memory' , '_common/ameba_d/Example_Guides/GPIO', '_common/ameba_d/Example_Guides/GTimer', '_common/ameba_d/Example_Guides/I2C', '_common/ameba_d/Example_Guides/IPv6', '_common/ameba_d/Example_Guides/MDNS' - , '_common/ameba_d/Example_Guides/MQTT', '_common/ameba_d/Example_Guides/PWM', '_common/ameba_d/Example_Guides/UART', '_common/ameba_d/Example_Guides/WDT', '_common/ameba_d/Example_Guides/WS2812B'], + , '_common/ameba_d/Example_Guides/MQTT', '_common/ameba_d/Example_Guides/PWM', '_common/ameba_d/Example_Guides/UART', '_common/ameba_d/Example_Guides/WDT', '_common/ameba_d/Example_Guides/WS2812B' + , '_common/ameba_d/Example_Guides/SYS'], 'aw-cu488': ['_common/ameba_d/API_Documents/Analog', '_common/ameba_d/API_Documents/AudioCodec' , '_common/ameba_d/API_Documents/BLE', '_common/ameba_d/Example_Guides/OTA', '_common/ameba_d/API_Documents/EPDIF', '_common/ameba_d/API_Documents/FatfsSDcard', '_common/ameba_d/API_Documents/FlashMemory' @@ -65,7 +70,8 @@ , '_common/ameba_d/API_Documents/SoftwareSerial', '_common/ameba_d/API_Documents/SPI', '_common/ameba_d/API_Documents/Sys', '_common/ameba_d/API_Documents/USB', '_common/ameba_d/API_Documents/WDT' , '_common/ameba_d/API_Documents/Wire', '_common/ameba_d/API_Documents/WS2812B', '_common/ameba_d/Example_Guides/BLE', '_common/ameba_d/Example_Guides/Debugging', '_common/ameba_d/Example_Guides/Flash Memory' , '_common/ameba_d/Example_Guides/GPIO', '_common/ameba_d/Example_Guides/GTimer', '_common/ameba_d/Example_Guides/I2C', '_common/ameba_d/Example_Guides/IPv6', '_common/ameba_d/Example_Guides/MDNS' - , '_common/ameba_d/Example_Guides/MQTT', '_common/ameba_d/Example_Guides/PWM', '_common/ameba_d/Example_Guides/UART', '_common/ameba_d/Example_Guides/WDT', '_common/ameba_d/Example_Guides/WS2812B'], + , '_common/ameba_d/Example_Guides/MQTT', '_common/ameba_d/Example_Guides/PWM', '_common/ameba_d/Example_Guides/UART', '_common/ameba_d/Example_Guides/WDT', '_common/ameba_d/Example_Guides/WS2812B' + , '_common/ameba_d/Example_Guides/SYS'], 'bw16-typec': ['_common/ameba_d/API_Documents/Analog', '_common/ameba_d/API_Documents/AudioCodec' , '_common/ameba_d/API_Documents/BLE', '_common/ameba_d/Example_Guides/OTA', '_common/ameba_d/API_Documents/EPDIF', '_common/ameba_d/API_Documents/FatfsSDcard', '_common/ameba_d/API_Documents/FlashMemory' @@ -75,7 +81,8 @@ , '_common/ameba_d/API_Documents/SoftwareSerial', '_common/ameba_d/API_Documents/SPI', '_common/ameba_d/API_Documents/Sys', '_common/ameba_d/API_Documents/USB', '_common/ameba_d/API_Documents/WDT' , '_common/ameba_d/API_Documents/Wire', '_common/ameba_d/API_Documents/WS2812B', '_common/ameba_d/Example_Guides/BLE', '_common/ameba_d/Example_Guides/Debugging', '_common/ameba_d/Example_Guides/Flash Memory' , '_common/ameba_d/Example_Guides/GPIO', '_common/ameba_d/Example_Guides/GTimer', '_common/ameba_d/Example_Guides/I2C', '_common/ameba_d/Example_Guides/IPv6', '_common/ameba_d/Example_Guides/MDNS' - , '_common/ameba_d/Example_Guides/MQTT', '_common/ameba_d/Example_Guides/PWM', '_common/ameba_d/Example_Guides/UART', '_common/ameba_d/Example_Guides/WDT', '_common/ameba_d/Example_Guides/WS2812B'], + , '_common/ameba_d/Example_Guides/MQTT', '_common/ameba_d/Example_Guides/PWM', '_common/ameba_d/Example_Guides/UART', '_common/ameba_d/Example_Guides/WDT', '_common/ameba_d/Example_Guides/WS2812B' + , '_common/ameba_d/Example_Guides/SYS'], } def create_folder(folder_name):