Giter Site home page Giter Site logo

eclipse-threadx / getting-started Goto Github PK

View Code? Open in Web Editor NEW
317.0 317.0 181.0 58.38 MB

This Getting Started guide is a series of tutorials that shows device developers how to connect to Azure IoT using Eclipse ThreadX.

Home Page: https://learn.microsoft.com/azure/iot-develop

License: Other

CMake 0.11% C 96.62% Batchfile 0.01% Shell 0.01% Assembly 1.21% HTML 1.74% PowerShell 0.01% C++ 0.04% CSS 0.27% Makefile 0.01%
azure-iot eclipse-threadx iot iot-device iot-hub mcu microcontroller

getting-started's People

Contributors

aleun avatar benmcmorran avatar cdvindhya avatar clarkebowers avatar gcampbell-msft avatar goldscott avatar jasmineymlo avatar jdeere5220 avatar juergenschwertl avatar kartben avatar liydu avatar maarten-work avatar marianan avatar mehrdadh avatar metebalci avatar pprovost avatar rido-min avatar ryanwinter avatar smcd253 avatar takeotakahashi2020 avatar tiejunms avatar timlt avatar wickste avatar yuxin-azrtos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

getting-started's Issues

Azure IoT Hub Basic tier is not supported

The current guides publish a device twin property from its main mqtt loop, which is not allowed if using a Basic tier. The results in a disconnect and all following telemetry failing.

DNS client fails to initilaize

I'm following along the tutorial for the MXChip

I keep getting the following error:

SUCCESS: WiFi connected

Initializing DHCP
        IP address: xx.xx.xx.xx
        Mask: 255.255.255.0
        Gateway: xx.xx.xx.xx
SUCCESS: DHCP initialized

Initializing DNS client
ERROR: nx_dhcp_interface_user_option_retrieve (0x00000094)
ERROR: dns_connect

I have tried two different WiFi's with the same result.

I cannot find any suggestions for this issue.

Any ideas?

Different results with two CMake projects for same sources

Hi,

I am facing a weird issue. I have made two projects with same source files that use CMake for compilation.

  1. First project has CMakeLists.txt in multiple subdirectories.
  2. Second project has a single CMakeLists.txt

Both projects using the same tool chain and compilation flags. But the first project hard faults when trying to execute _tx_thread_schedule();. The second project works without any issues.

I have followed the project structures that are similar to the examples in this repo. Which is that, I create libraries for threadX, netxDuo and STM32Hal.

I am wondering what could have gone wrong.

I would be happy to share the sources.

Device: STM32H723
Example project: TCP Echo Client

For reference, please take a look at the image below for the debug trace. Note that the WWDG is not enabled in the project.
image

Controlling other devices

Hello,

I have the sample up and running on my MXchip with Azure RTOS, but I am looking for a good example how I can control for example a motor. Normally I could enable pins on this way when developing for the MXchip (old school via Arduino/ VS Code):

if (temperature >= temperatureThreshold)
{
digitalWrite(PB_0, HIGH);
}

How can I achieve this with this RTOS example?

Could you please help provide me some code examples about how to collect decibel using Azure-rtos?

We are using AZ3166 device with this repo https://github.com/SibeeshVenu/MXChip-Azure-IoT-Arduino
It can collect decibel telementry. This repo based on the DevKit https://github.com/microsoft/devkit-sdk/releases/.

Since it didn't include Digicert G2 certificate, when we migrated to G2 certificate, the device cannot connect to IoT Hub using the old repo.
We must using Azure-rtos to re-flash our AZ3166 device. However, the repo Azure-rtos only has basic telmentry such as temperture and humidity, cannot collect decibel telementry.

Could you please help provide me some code examples about how to collect decibel using Azure-rtos?

Compile error

Hi,

I just followed the guidance for the STM RTOS Device, but when I try to build the new image I get the following error:

**C:\repo\getting-started\STMicroelectronics\STM32L4\tools>rebuild.bat
-- Using ARM GCC from path = C:/Program Files (x86)/GNU Tools Arm Embedded/9 2019-q4-major/bin
-- Using ARM GCC from path = C:/Program Files (x86)/GNU Tools Arm Embedded/9 2019-q4-major/bin
-- The C compiler identification is GNU 9.2.1
-- The ASM compiler identification is GNU
-- Found assembler: C:/Program Files (x86)/GNU Tools Arm Embedded/9 2019-q4-major/bin/arm-none-eabi-gcc.exe
-- Check for working C compiler: C:/Program Files (x86)/GNU Tools Arm Embedded/9 2019-q4-major/bin/arm-none-eabi-gcc.exe
-- Check for working C compiler: C:/Program Files (x86)/GNU Tools Arm Embedded/9 2019-q4-major/bin/arm-none-eabi-gcc.exe - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Using toolchain file: C:/repo/getting-started/cmake/arm-gcc-cortex-m4.cmake
CMake Error at lib/CMakeLists.txt:18 (add_subdirectory):
The source directory

C:/repo/getting-started/core/lib/threadx

does not contain a CMakeLists.txt file.

-- Configuring incomplete, errors occurred!
See also "C:/repo/getting-started/STMicroelectronics/STM32L4/build/CMakeFiles/CMakeOutput.log".
See also "C:/repo/getting-started/STMicroelectronics/STM32L4/build/CMakeFiles/CMakeError.log".
ninja: error: loading 'build.ninja': The system cannot find the file specified.

C:\repo\getting-started\STMicroelectronics\STM32L4\tools>**`

I am running on latest version of Windows 10 and installed all the software that was required. I have there the CMakeError output:

'**Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: C:/Program Files (x86)/GNU Tools Arm Embedded/9 2019-q4-major/bin/arm-none-eabi-gcc.exe
Build flags: -mthumb;-mcpu=cortex-m4;-mfloat-abi=hard;-mfpu=fpv4-sp-d16;--specs=nano.specs;-u;_printf_float;-ffunction-sections;-fdata-sections;-Wunused;-Wuninitialized;-Wall
Id flags:

The output was:
1
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard\libc_nano.a(lib_a-exit.o): in function exit': exit.c:(.text.exit+0x1a): undefined reference to _exit'
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard\libc_nano.a(lib_a-sbrkr.o): in function _sbrk_r': sbrkr.c:(.text._sbrk_r+0xc): undefined reference to _sbrk'
collect2.exe: error: ld returned 1 exit status**

Any idea what I am doing wrong?

Connection to IoT hub failed

Hello
I tried the project with but having the below error while trying to connected to IoT hub:
ERROR: nx_azure_iot_hub_client_connect (0x000000a3)
PS: I had the #define ENABLE_DPS" commented out

Environment:

  • Development is on visual studio 2022 enterprise edition

  • The below settings were used in the config.h file:
    #define IOT_HUB_HOSTNAME "my specific IoT hub host name"
    #define IOT_HUB_DEVICE_ID "STM32L4S5-001"
    #define IOT_DEVICE_SAS_KEY "my device primary key"

  • Here is the Serial log:
    ========
    Starting Azure thread
    Initializing WiFi
                 Module: ISM43362-M3G-L44-SPI
                 MAC address: xx:xx:xx:xx:xx:xx
                 Firmware revision: C3.5.2.7.STM
    SUCCESS: WiFi initialized

Connecting WiFi
             Connecting to SSID 'xxxx'
             Attempt 1...
SUCCESS: WiFi connected

Initializing DHCP
             IP address: xxx.xxx.xxx.xxx
             Mask: 255.255.255.0
             Gateway: xxx.xxx.xxx.xxx
SUCCESS: DHCP initialized

 Initializing DNS client
             DNS address xxx.xxx.xxx.xxx
             DNS address 2: 8.8.8.8
SUCCESS: DNS client initialized

Initializing SNTP time sync
             SNTP server 0.pool.ntp.org
             SNTP server 1.pool.ntp.org
             SNTP server 2.pool.ntp.org
             SNTP time update: Apr 5, 2023 15:29:55.558 UTC
SUCCESS: SNTP initialized

Initializing Azure IoT Hub client
             Hub hostname: xxxxxxxxx
             Device id: STM32L4S5-001
             Model id: dtmi:azurertos:devkit:gsgstml4s5;2
ERROR: nx_azure_iot_hub_client_connect (0x000000a3)

ST's netxduo of wifi version failure in DPS

Hi,

I am Nuvoton's engineer and on porting azure iot, based on azure rtos 6.0.1, onto Nuvoton's NuMaker-IoT-M487 board, which is Cortex-M4 MCU and has one on-board ESP8266 wifi module. Because ESP8266 WiFi module has its own stack, I follow ST's reduced netxduo for wifi to substitute for the standard one. Adding ESP8266 wifi driver, it can work well with this netxduo of wifi version.

To connect with azure iot, I port the sample sample_azure_iot_embedded_sdk. Without DPS enabled, I can successfully connect with azure iot hub. But after enabling DPS, it fails because the netxduo of wifi version disables the nx_tcp_socket_establish_notify(...).

https://github.com/azure-rtos/getting-started/blob/829122217a643ce60d0b468c71358fcb9522aa38/STMicroelectronics/STM32L4_L4%2B/lib/netxduo/src/nx_tcp_socket_establish_notify.c#L78

Do you have plan to enhance the netxduo of wifi version to support use case like DPS here?

Unable to resolve DNS for SNTP Server 0.pool.ntp.org (0xa3) on B-L4S5I-IOT01A

I get the SNTP error using a B-L4S5I-IOT01A board built 1720. I repeatedly pinged the SNTP server from PowerShell to confirm it is there.

Starting Azure thread

Initializing WiFi
Module: ISM43362-M3G-L44-SPI
MAC address: C4:7F:51:8D:E2:83
Firmware revision: C3.5.2.5.STM
Connecting to SSID 'MySpectrumWiFic0-2G'
SUCCESS: WiFi connected to MySpectrumWiFic0-2G

Initializing DHCP
IP address: 192.168.1.10
Gateway: 192.168.1.1
SUCCESS: DHCP initialized

Initializing DNS client
DNS address: 192.168.1.1
SUCCESS: DNS client initialized

Initializing SNTP client
SNTP server 0.pool.ntp.org
FAIL: Unable to resolve DNS for SNTP Server 0.pool.ntp.org (0xa3)
ERROR: Failed to run the SNTP client
SNTP server timeout, restarting client
SNTP server 0.pool.ntp.org
FAIL: Unable to resolve DNS for SNTP Server 0.pool.ntp.org (0xa3)
SNTP server timeout, restarting client
SNTP server 0.pool.ntp.org
FAIL: Unable to resolve DNS for SNTP Server 0.pool.ntp.org (0xa3)

Checking the SNTP ping from PowerShell from laptop on the same network as STM32L4+ board

PS D:\sT\azure\getting-started> ping 0.pool.ntp.org

Pinging 0.pool.ntp.org [200.160.7.186] with 32 bytes of data:
Reply from 200.160.7.186: bytes=32 time=178ms TTL=49
Reply from 200.160.7.186: bytes=32 time=191ms TTL=49
Reply from 200.160.7.186: bytes=32 time=179ms TTL=49
Reply from 200.160.7.186: bytes=32 time=189ms TTL=49

Ping statistics for 200.160.7.186:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 178ms, Maximum = 191ms, Average = 184ms

Disable interrupt in ST's netx wifi driver?

How pinch AZURE_IOT_NX_CONTEXT to send new state of device properties to IoT Hub

Hi, I am trying to change the reported ledState in device twin when I change it in the actual device (mxchip AZ3166).

If I send this message to IoT Hub from nx_client.c when a device button is pressed, I think nx_context is not ready and the packet fails on tls packet error checks.

It works by changing a bool in nx_client.c when the button state changes and setting up a callback in azure_iot_nx_client.c that is executed by client_run() in azure_iot_nx_client.c. However this creates unnecessary overhead checking the button status constantly. Unfortunatly including nx_client.c to azure_iot_nx_client.c doesn't work to pick-up device led state variables.

Storing AZURE_IOT_NX_CONTEXT at nx_client.c from a prior use when a callback occurred threw the same packet error checks.

Is there an easier way to pinch AZURE_IOT_NX_CONTEXT at nx_client when a device button is pressed?

Thank you for your help

MxChip Application Device and WIFI Configuration

The sample for MxChip app requires the developer to set build time configuration such as Wifi and Device connection strings in the 'azure_cofig.h" file. This means that the app needs to be built for each and every device separately. Instead, is it possible to build the app once and configure network settings externally from windows 10? Could you please advise how and where the sample needs to be modified in order to acheive this?
Thank you.

ERROR: Unable to find folder at https://aka.ms/vcpkg-ce-default at command vcpkg activate

At step vcpkg activate I get error

Updating registry data from https://aka.ms/vcpkg-ce-default
ERROR: Unable to find project in folder (or parent folders) for undefined

PS C:\AR-VR-Github\mxchip-install\MXChip\AZ3166> vcpkg activate
warning: vcpkg-artifacts are experimental and may change at any time.
A suitable version of node was not found (required v16.15.1). Downloading portable node v16.15.1...
Downloading node...
https://nodejs.org/dist/v16.15.1/node-v16.15.1-win-x64.7z -> C:\Users\Sergio.vcpkg\downloads\node-v16.15.1-win-x64.7z
Extracting node...
A suitable version of cmake was not found (required v3.22.2). Downloading portable cmake v3.22.2...
Downloading cmake...
https://github.com/Kitware/CMake/releases/download/v3.22.2/cmake-3.22.2-windows-i386.zip -> C:\Users\Sergio.vcpkg\downloads\cmake-3.22.2-windows-i386.zip
Extracting cmake...
Downloading vcpkg-ce bundle 2022-10-12...
npm notice
npm notice New minor version of npm available! 8.11.0 -> 8.19.2
npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.19.2
npm notice Run npm install -g [email protected] to update!
npm notice
Updating registry data from https://aka.ms/vcpkg-ce-default
ERROR: Unable to find project in folder (or parent folders) for undefined

I then run start devenv . and VS opens but shows message VS not running on vcpkg env:
image

My system Win11, powershell 7.2.6, npm updated, VS2022 Community
Please help

Thank you!

IOT_DPS_ID_SCOPE empty azure error at connection

Hi, I can connect to wifi when I flash mxchip but I get this error at connection.

ERROR: azure_iot_nx_client_dps_entry incorrect parameters as shown in Termite:

`Initializing WiFi
MAC address: XX:XX:XX:XX:XX:XX
SUCCESS: WiFi initialized

Connecting WiFi
Connecting to SSID 'MYSSID'
Attempt 1...
SUCCESS: WiFi connected

Initializing DHCP
IP address: XXX.XX.XX.X
Mask: 255.255.255.240
Gateway: XXX.XX.XX.X
SUCCESS: DHCP initialized

Initializing DNS client
DNS address: XXX.XX.XX.X
SUCCESS: DNS client initialized

Initializing SNTP time sync
SNTP server 0.pool.ntp.org
SNTP time update: Sep 1, 2022 10:4:27.15 UTC
SUCCESS: SNTP initialized

Initializing Azure IoT Hub client
Hub hostname: MYIOTHUBNAME.azure-devices.net
Device id: mxchip
Model id: dtmi:azurertos:devkit:gsgmxchip;2
ERROR: nx_azure_iot_hub_client_connect (0x00010085)

Initializing DHCP
IP address: XXX.XX.XX.X
Mask: 255.255.255.240
Gateway: XXX.XX.XX.X
SUCCESS: DHCP initialized

Initializing DNS client
DNS address: XXX.XX.XX.X
SUCCESS: DNS client initialized

Initializing SNTP time sync
SNTP server 0.pool.ntp.org
SNTP time update: Sep 1, 2022 10:4:31.86 UTC
SUCCESS: SNTP initialized
`

I note I have commented out // #define ENABLE_DPS as per the documentation.

My guess is that IOT_DPS_ID_SCOPE may need to be provided in azure_config.h. However this document makes no reference to IOT_DPS_ID_SCOPE and it does not show in Azure IoT Explorer.

I see in documentation to connect with Azure IoT Central that this param would be provided, but with Azure IoT Explorer it is not the case.

image

versus Azure IoT Central documentation where scope would be provided:
image

I then also tried to register the IoT DPS as per documentation and removed the comment from // #define ENABLE_DPS and added scope and dps id in azure_config.h, but termine throws.

Initializing Azure IoT DPS client DPS endpoint: global.azure-devices-provisioning.net DPS ID scope: mydpsscope Registration ID: mydpsregname ERROR: nx_azure_iot_provisioning_client_register (0x0002000e)

Please help, thank you, Sergio

[Enter feedback here]


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

compile error on B-L475E-IOT01A board

Hello,

I was following this guide to compile it for B-L475E-IOT01A board, but got errors like:

../lib/netx_driver/src/es_wifi.h:253:22: error: field 'IO_Init' declared as a function
253 | IO_Init_Func IO_Init;

the code is:
typedef struct {
IO_Init_Func IO_Init;
...
} ES_WIFI_IO_t;

IO_Init_Func is defined as:
typedef int8_t *IO_Init_Func(uint16_t );

It looks good to me, any ideas on this error?

SNTP timeout

Hi, I was following this tutorial & I was stuck at "Confirm device connection details" step 7, my console showed issues with SNTP server timeout, restarting client, & it stuck in a loop as below:
errtimeout
I have no idea what could be the reason, thanks for any help in advance.

Move dependencies outside of the build directory

Since this project is tightly coupled to threadx repos it would be appreciated if you would replace the non-standard CPM cmake module with standard git sub modules that are not located under the build directory. CPM is just unnecessary complexity, and makes integrating with existing development workflows (not CI workflows) difficult.

Callbacks not working on STM32L4 Disco

I am using the unmodified getting started repo. I have an STM32L4 discovery kit. The application works fine for sending the telemetry but fails for callbacks (C2D, desired prop, twin prop) except invoking methods.

Legacy mqtt vs nx client

What is the difference between the legacy mqtt client and the nx client? What will be the benefits for me to switch to the nx client instead of the legacy mqtt?

Sending telemetry to IoT Hub fails after SNTP time update

Using both MXChip and STM32 devices, I noticed the following behavior (see the attached file for logging information):

MXChip

  • After an hour there is a SNTP time update
  • Shortly after, the device disconnects from IoT Hub
  • This is independent from interval times.

STM32

  • Interval time > 240 seconds
    • After sending a few telemetry messages successfully, the device gets disconnected from the IoT Hub with 0x0002000c code.
  • Interval time < 240 seconds
    • After an hour there is a SNTP time update
    • Shortly after, the device cannot send telemetry messages anymore, but it stays connected to the IoT Hub

The behavior above was repeatable, at least for 3 different runs with different interval times.

I wonder if the difference in behavior on STM32 with different interval times is caused by keep alive processing as documented here.

I cloned the getting_started repo master branch on Dec 10.

TelemetryLog.txt

Build Failure

Hello,

I am using the STMircro BL475E board.

I have executed the batch file that installs all the dependencies latest revision. But when I run the revbuild.bat file in adminstrator mode, the build fails and I get CMake error.

I have the latest version of CMake installed. Verified it with the cmake --version command. Can you please let me know how to solve the issue. Attached is the error log.

Error_log.txt

Screen.draw() is offset by one

Not sure if this the correct repo. The faulty code is bundled in stm32f4/2.0.0/system/libdevkit-sdk-core-lib.a but I can't find the source.

I noticed that when using draw(), the bitmap is not printed correctly. There is always a one pixel offset on the left. If the bitmap is not as wide as the display, then it shows a small gap. If the bitmap is supposed to fit the display, then it will wrap around and show the last column at x = 0.

Here's a picture of the issue. The horizontal line is made of underscores, showing that the problem does not occur when using print(). However one line below, the vertical line is one pixel to the right, whereas it should be all the way on the left.

1627135949819

void setup() {
  Screen.init();
}

void loop() {
  // Print some underscores for reference
  Screen.print(1, "________________");

  // Draw a single vertical line at x = 0 below the underscores
  unsigned char bmp[1] = { 255 };
  Screen.draw(0, 4, 1, 4 + 1, bmp);
  
  // Loop forever
  while (true) {
    delay(1000);
  }
}

EDIT: more info:

# version
DevKitSDK version: 2.0.0
Mico version: 31620002.049
mbed-os version: 5.4.3
mbed TLS version: 2.15.0
WIFI version: wl0: Sep 10 2014 11:28:46 version 5.90.230.10

SNTP - DNS cannot resolve

Hello,

When I try the example and check with termite I see the following error:

Initializing SNTP client
SNTP server 0.pool.ntp.org
FAIL: Unable to resolve DNS for SNTP Server 0.pool.ntp.org (0xa3)
ERROR: Failed to run the sntp client

On my Wi-Fi network everything is working fine and can resolve the NTP server.

no tools for macos

Is it possible to have the instructions and tooling available for macos. Currently there are only scripts for getting the tools for windows and linux

Can't build the firmware

C:/Users/eksko/OneDrive - Microsoft/code/repos/azure-rtos/getting-started/shared/lib/netxduo/addons/azure_iot/azure_iot_security_module/iot-security-module-core/src/serializer/extensions/custom_builder_allocator.c:78:1: fatal error: opening dependency file lib\netxduo\addons\azure_iot\azure_iot_security_module\iot-security-module-core\CMakeFiles\asc_security_core.dir\src\serializer\extensions\custom_builder_allocator.c.obj.d: No such file or directory
78 | }

STM32L4 build failure with TX_ENABLE_EXECUTION_CHANGE_NOTIFY defined

If TX_ENABLE_EXECUTION_CHANGE_NOTIFY is defined, then building tx_initialize_low_level.S.obj fails with the following message:

../app/startup/tx_initialize_low_level.S: Assembler messages:                                            
../app/startup/tx_initialize_low_level.S:195: Error: bad instruction `call the ISR enter function'                   
../app/startup/tx_initialize_low_level.S:202: Error: bad instruction `call the ISR exit function'                    
../app/startup/tx_initialize_low_level.S:219: Error: bad instruction `call the ISR enter function'                   
../app/startup/tx_initialize_low_level.S:223: Error: bad instruction `call the ISR exit function'

Looks like a minor edit to tx_initialize_low_level.S would do the trick.

Detials in the Config File

Hello,

I am following the steps for executing the project on the STM board. I am filling out the details foe the azure_config.h file and not sure where do i get the information for the following:

// ----------------------------------------------------------------------------
// Azure IoT DPS config
// ----------------------------------------------------------------------------
#define IOT_DPS_ENDPOINT "global.azure-devices-provisioning.net"
#define IOT_DPS_ID_SCOPE ""
#define IOT_DPS_REGISTRATION_ID ""

Thanks and Regards
Suraj Sridhar

How can I get IoT Hub Events to subscribe to property updates

IoT Hub Event does not receive recorded property changes in the device twin. For example, property ledState is updated by the actual device (with patch) and the device twin updates the reported property, but the IoT Hub Event does not receive the event. This limits me in passing this property change to a digital twin with an azure function.

The IoT Hub Event does not show updated properties, unlike telemetry which IoT Hub Event receives. Considering IoT Hub Event only receives Device Created, Deleted, Connected, Disconnected, Telemetry Event Types, how can I get IoT Hub Events to subscribe to property updates?

Further description:

The actual device sends packet (MQTT function _nxd_mqtt_client_publish_packet_send) and I can see this logged in Termite: $iothub/twin/PATCH/properties/reported/?$rid=1121{"ledState":true} . The hub successfully responds with 204.

This is my device as shown in IoT hub and the device's ledState (reported) property is updated to true when I press button A in mxchip:

a

`{
"deviceId": "mxchip",

"etag": "AAAAAAAAAF8=",
"deviceEtag": "NDY5NTIxODE1",
"status": "enabled",
"statusUpdateTime": "0001-01-01T00:00:00Z",
"connectionState": "Connected",
"lastActivityTime": "2022-09-16T14:51:32.9293466Z",
"cloudToDeviceMessageCount": 0,
"authenticationType": "sas",
"x509Thumbprint": {
    "primaryThumbprint": null,
    "secondaryThumbprint": null
},
"modelId": "dtmi:azurertos:devkit:gsgmxchip;2",
"version": 5310,
"properties": {
    "desired": {
        "telemetryInterval": 5,
        "$metadata": {
            "$lastUpdated": "2022-09-16T12:44:24.4494023Z",
            "$lastUpdatedVersion": 95,
            "telemetryInterval": {
                "$lastUpdated": "2022-09-16T12:44:24.4494023Z",
                "$lastUpdatedVersion": 95
            }
        },
        "$version": 95
    },
    "reported": {
        "deviceInformation": {
            "__t": "c",
            "manufacturer": "MXCHIP",
            "model": "AZ3166",
            "swVersion": "1.0.0",
            "osName": "Azure RTOS",
            "processorArchitecture": "Arm Cortex M4",
            "processorManufacturer": "STMicroelectronics",
            "totalStorage": 1024,
            "totalMemory": 128
        },
        "ledState": true,
        "telemetryInterval": {
            "ac": 200,
            "av": 1,
            "value": 5
        },
        "$metadata": {
            "$lastUpdated": "2022-09-16T14:55:52.6321409Z",
            "deviceInformation": {
                "$lastUpdated": "2022-09-16T13:54:57.5894378Z",
                "__t": {
                    "$lastUpdated": "2022-09-16T13:54:57.5894378Z"
                },
                "manufacturer": {
                    "$lastUpdated": "2022-09-16T13:54:57.5894378Z"
                },
                "model": {
                    "$lastUpdated": "2022-09-16T13:54:57.5894378Z"
                },
                "swVersion": {
                    "$lastUpdated": "2022-09-16T13:54:57.5894378Z"
                },
                "osName": {
                    "$lastUpdated": "2022-09-16T13:54:57.5894378Z"
                },
                "processorArchitecture": {
                    "$lastUpdated": "2022-09-16T13:54:57.5894378Z"
                },
                "processorManufacturer": {
                    "$lastUpdated": "2022-09-16T13:54:57.5894378Z"
                },
                "totalStorage": {
                    "$lastUpdated": "2022-09-16T13:54:57.5894378Z"
                },
                "totalMemory": {
                    "$lastUpdated": "2022-09-16T13:54:57.5894378Z"
                }
            },
            "ledState": {
                "$lastUpdated": "2022-09-16T14:55:52.6321409Z"
            },
            "telemetryInterval": {
                "$lastUpdated": "2022-09-16T13:54:58.1675571Z",
                "ac": {
                    "$lastUpdated": "2022-09-16T13:54:58.1675571Z"
                },
                "av": {
                    "$lastUpdated": "2022-09-16T13:54:58.1675571Z"
                },
                "value": {
                    "$lastUpdated": "2022-09-16T13:54:58.1675571Z"
                }
            }
        },
        "$version": 5215
    }
},
"capabilities": {
    "iotEdge": false
}

}`

I have commented out telemetry messages in the code so only recorded property changes are sent to IoT hub but property changes don't show for Events:
image

MxChip Application Telemetry nested Json

How can I create nested json telemetry data using the 'nx_azure_iot_json_writer_append_json_text' API in MxChip application? I would like to deserialize telemetry data from the Azure function (IoT hub Telmetry data trigger) to the MxChipDeviceData class as given below. I am not sure how to implement this in the Mxchip application code. Please advise.

public class MxChipDeviceData { public MxChipSensors sensors { get; set; }; public MxChipMagnetometer magnetometer { get; set; }; public MxChipAcceleroMeter accelorometer { get; set; }; public MxChipGyroScope gyroscope { get; set; } ; public static MxChipDeviceData ToObject(string json) => JsonSerializer.Deserialize<MxChipDeviceData>(json); }
.

Username field for WIFI

Is it possible to include a username field for WIFI that requires it on this line?

I'm trying to connect to WIFI that requires both a username and password.

arm-none-eabi-gdb.exe

Good morning;
I was following the video: "Getting Started with IoT devices and Azure" (https://www.youtube.com/watch?v=MFGqlNeTWHk&list=LL&index=142&t=522s) but when I am trying to use the debugger to run the applicaiton I get the next error:
test

(OpenOCD GDB executable "arm-none-eabi-gdb.exe" was not found. Please configure "cortex-debug.armToolchainPath" or "cortex-debug.gdbPath" correctly)

I would like to ask if by any chance I missed something or if there are any advices you can give to me to solve this problem.
Thank you very much.

[mimxrt1050] openocd config file issue

I tried to use this file
https://github.com/azure-rtos/getting-started/blob/cd17938a9ed7325d6ac3c6b194ee6411226d0275/NXP/MIMXRT1050-EVKB/tools/mimxrt1050-evkb.cfg

But I get this error:

Open On-Chip Debugger 0.11.0
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
Error: Debug adapter does not support any transports? Check config file order.
Error: unable to select a session transport. Can't continue.
shutdown command invoked

I used openocd 0.11.0 and here is the command that I used:

openocd -f /path/to/mimxrt1050-evkb.cfg -c init -c "program /path/to/ELF/file"

Any idea what's the problem?

Didn't start shell prompt

This repository has the devcontainer.
Open it in VSCode Remote-Container and click 'New Terminal', I cannot see the shell prompt.
image

DNS error

Hi,

I have followed the manual for the MXchip (AZ3166), but get this error when running the app on the MXchip:

`Initializing DHCP
IP address: 192.168.1.18
Mask: 255.255.255.0
Gateway: 192.168.1.1
SUCCESS: DHCP initialized

Initializing DNS client
DNS address: 192.168.1.1
DNS address: 8.8.8.8
DNS address: 8.8.8.8
ERROR: nx_dns_server_add (0x000000af)
ERROR: dns_connect`

My DNS is correctly working (Same Wi-Fi as other devices)

[MXCHIP] app can't connect to WiFi; default firmware has no problem

My MXCHIP DevKit can connect to my 2.4GHz WiFi without any problems if I flash the v2.0.0 firmware to it, but the getting-started app fails to connect, with the join-result returned as 1024, which appears to indicate it can't see the network; see the output below, with reference to network IceBear:

**************************************************
** DOWNLOAD FIRMWARE v2.0.0 AND RESET THE BOARD **
**************************************************
[00]
************************************************
** MXChip - Microsoft IoT Developer Kit **
************************************************
You can 1. press Button A and reset to enter configuration mode.
        2. press Button B and reset to enter AP mode.

Wi-Fi IceBear connected.
Now is (UTC): Tue Feb 28 16:38:55 2023

>>> Failed to send telemetry data: Http fault.
0) Guest7B4786	Signal: -69	Enc type: 4
1) IceBear	Signal: -69	Enc type: 4
2) BT-JZATTF	Signal: -75	Enc type: 4
3) BT-JZATTF	Signal: -79	Enc type: 4
4) VM5611921	Signal: -80	Enc type: 4
5) SKYCHEY9	Signal: -81	Enc type: 4
6) TALKTALK73E565	Signal: -84	Enc type: 4
7) BTWi-fi	Signal: -84	Enc type: 7
8) BT-GRA625	Signal: -84	Enc type: 4
9) BTWi-fi	Signal: -84	Enc type: 7
>>> Failed to send telemetry data: Http fault.

******************************************************************
** BUILD AND DOWNLOAD 'getting-started' APP AND RESET THE BOARD **
******************************************************************
[00]Scanning I2C bus
	.........................0x190x1a...0x1e.0x20...........................0x3c...............................0x5c..0x5f..........0x6a.....................

Starting Azure thread


Initializing WiFi
	MAC address: C8:93:46:86:09:6C
SUCCESS: WiFi initialized

Connecting WiFi
	Connecting to SSID 'IceBear'
	Attempt 1...
	join_result = 1024
	Attempt 2...
	join_result = 1024
	Attempt 3...
	join_result = 1024
	Attempt 4...
	join_result = 1024
	Attempt 5...
	join_result = 1024

(etc.)

My network is set-up for WPA2; I'm assuming AES (but I've tried forcing-setting the TKIP flag with WPA2 just in case, which is no better), and the key (password) is definitely correct. What could I be missing? What should I check next?

License Terms

Using Azure RTOS - ThreadX, NetX and FileX on Renesas S7G2. What are the License terms for using these in our application?

mxchip press button send led_state to to Azure IoT

Can someone share an example or guidance how I can send the property led_State when a button in the mxchip IoT device is pressed the signal is sent to Azure IoT?
I can light led in board_init.c:

At board_init.c
weak void button_a_callback()
{

//WIFI_LED_ON();
//AZURE_LED_ON();
//USER_LED_ON();
if (BUTTON_A_IS_PRESSED)
{
    val += 32;
    if (val > 2047)
        val = 2047;
    RGB_LED_SET_R(val);
    //RGB_LED_SET_G(val);
    //RGB_LED_SET_B(val);

    printf("\tLED is turned ON\r\n");

  properties_complete_cb();//how can I call this function in nx_client.c from ?
}

}

At nx_client.c I want to execute when the button is pressed:
azure_iot_nx_client_publish_bool_property(&azure_iot_nx_client, NULL, LED_STATE_PROPERTY, arg);

How can I link these two c functions, meaning from button_a_callback to call nx_client.c azure_iot_nx_client_publish_bool_property?

Thanks a bunch

Compiler errors for ARM GCC 10

Though it is compiler clean for ARM GCC 9, it would be great to fix the following compiler error reported by ARM GCC 10.

/usr/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/bin/ld: app/CMakeFiles/stm32l4S5_azure_iot.dir/networking.c.obj:(.bss.nx_ip+0x0): multiple definition of `nx_ip'; common/CMakeFiles/app_common.dir/networking.c.obj:(.bss.nx_ip+0x0): first defined here
/usr/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/bin/ld: app/CMakeFiles/stm32l4S5_azure_iot.dir/networking.c.obj:(.bss.nx_pool+0x0): multiple definition of `nx_pool'; common/CMakeFiles/app_common.dir/networking.c.obj:(.bss.nx_pool+0x0): first defined here
/usr/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/bin/ld: app/CMakeFiles/stm32l4S5_azure_iot.dir/networking.c.obj:(.bss.nx_dns_client+0x0): multiple definition of `nx_dns_client'; common/CMakeFiles/app_common.dir/networking.c.obj:(.bss.nx_dns_client+0x0): first defined here

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.