[MUST] Same as 1.1. Azure portal
in _1_APP_TELEMETRY_manual.md
In the following RP2040-HAT-AZURE-C/exmaples/main.c
source file, find the line similar to this and replace it as you want:
(...)
// The application you wish to use should be uncommented
//
//#define APP_TELEMETRY
#define APP_C2D
//#define APP_CLI_X509
//#define APP_PROV_X509
// The application you wish to use DHCP mode should be uncommented
#define _DHCP
static wiz_NetInfo g_net_info =
{
.mac = {0x00, 0x08, 0xDC, 0x12, 0x34, 0x56}, // MAC address
.ip = {192, 168, 11, 2}, // IP address
.sn = {255, 255, 255, 0}, // Subnet Mask
.gw = {192, 168, 11, 1}, // Gateway
.dns = {8, 8, 8, 8}, // DNS server
#ifdef _DHCP
.dhcp = NETINFO_DHCP // DHCP enable/disable
#else
// this example uses static IP
.dhcp = NETINFO_STATIC
#endif
};
Edit the RP2040-HAT-AZURE-C/examples/sample_certs.c
entering the proper connection string and key value from the Azure Portal:
/* Paste in the your iothub connection string */
const char pico_az_connectionString[] = "[device connection string]";
Run make
command
(PWD) RP2040-HAT-AZURE-C/build/examples
$ make
[ 12%] Built target AZURE_SDK_FILES
[ 12%] Built target bs2_default
[ 12%] Built target bs2_default_padded_checksummed_asm
[ 12%] Built target W5100S_FILES
[ 13%] Built target ETHERNET_FILES
[ 13%] Built target DHCP_FILES
[ 13%] Built target DNS_FILES
[ 21%] Built target SNTP_FILES
[ 43%] Built target AZURE_SDK_PORT_FILES
[ 43%] Performing build step for 'ELF2UF2Build'
[100%] Built target elf2uf2
[ 43%] No install step for 'ELF2UF2Build'
[ 43%] Completed 'ELF2UF2Build'
[ 44%] Built target ELF2UF2Build
[ 56%] Built target mbedcrypto
[ 58%] Built target mbedx509
[ 59%] Built target mbedtls
[ 66%] Built target TIMER_FILES
[ 73%] Built target SPI_FILES
Consolidate compiler generated dependencies of target main
[ 75%] Building C object examples/CMakeFiles/main.dir/main.c.obj
[ 75%] Linking CXX executable main.elf
[100%] Built target main
[MUST] Same as1.2.3. Azure IoT Explorer (preview) setting in _1_APP_TELEMETRY_manual.md
Open "COM" port to see debug code
This example has 2 functions:
- Send 3 messages from IoT device.
- Receive 3 C2D (Cloud to Device) messages.
(PWD) RP2040-HAT-AZURE-C/build/examples
$ cp main.uf2 /f/
Send 3 messages same as _1_APP_TELEMETRY_manual.md
You can get result of "function 1" result as below "Azure IoT Explorer" window.
For "function 2", you can send C2D messages to your device with "Azure IoT Explorer" program as follows:
Then, you can see the received #1 C2D message through your "Serial Terminal" window as below:
- C2D Message #2
- C2D Message #3