How microchiptech/aws-iot-firmware-pic32mz works
Project type and purpose
• This is an embedded-firmware project for a PIC32MZ microcontroller that demonstrates how to connect an IoT Ethernet device to AWS IoT.
File structure
Top level:
• documents/ – guides and markdowns
• hardware/ – electrical schematic PDF
• software/aws-iot-ethernet/firmware/ – source code under a Microchip Harmony project
In firmware/src:
• app.c/.h, app1.c/.h, app2.c/.h – application modules
• app_insight_support, app_nvm_support – vendor-support libraries
• bsp_sys_init.c – board support package
• parson.c/.h – JSON parsing
• wolfmqttsdk/ – MQTT library
• system_config/.../framework – HAL drivers for ADC, CMP, clocks, ports
• system_config/.../net/pres – TLS/crypto glue
• system_config/.../system_* – startup, exceptions, tasks, interrupt handlers
Build system:
• Makefile, .hconfig, NetBeans project files
Extract architecture insights from README
• Connects IoT device securely to AWS IoT
• Based on Microchip Harmony + FreeRTOS
• Uses wolfMQTT for MQTT protocol
Main components
A. Hardware Platform
– PIC32MZ microcontroller board (Ethernet PHY + RJ45, external flash, sensors)
– Schematic (hardware/iot-ethernet-schematic.pdf)
B. Firmware Layers (stacked)
1. Boot & Initialization
• system_init, bsp_sys_init, FreeRTOS start
2. HAL / Drivers (Microchip Harmony framework)
• ADC, comparator, clock, ports, Ethernet MAC driver
3. Middleware
• Net Pres (TLS/crypto), parson JSON parser
• wolfMQTT SDK (mqtt_client, packet, socket)
4. Application Tasks
• app.c (sensor reading, state machine, MQTT publish/subscribe)
• app1.c, app2.c – additional feature demos
• app_insight_support, app_nvm_support – cloud insight & non-volatile storage
C. External Services
– AWS IoT Core (MQTT broker, certificates stored in device)
Relationships and interactions
• On reset→ bootloader/system_init initializes clocks, ports, FreeRTOS
• RTOS scheduler spins up application tasks
• App tasks call wolfMQTT client → which uses Net Pres for TLS →
which uses Ethernet driver → which goes to physical PHY → Ethernet cable → AWS IoT endpoint
• JSON payloads are built by parson and pushed via MQTT
• NVM support module persists device state locally
Architectural patterns and design principles
– Layered architecture (Hardware Abstraction → Middleware → Application)
– RTOS-based concurrency (tasks for networking, sensor, cloud)
– Secure communication via TLS and certificate authentication
– Modular code-separation (app, drivers, system_config, sdk)
Relevant technologies/frameworks
– Microchip Harmony framework (system_config & drivers)
– FreeRTOS (task scheduling)
– wolfMQTT (embedded MQTT client)
– parson (JSON parser)
– TLS/crypto via Net Pres module
– Microchip MPLAB X / Makefile build system