Configure and use UART, I2C, SPI, ADC, and PWM peripherals on the ANX dev module with code examples for each interface type.
The ANX dev module exposes five hardware peripheral interfaces — UART, I2C, SPI, ADC, and PWM — all accessible through the ANX SDK’s C API. Each interface is backed by dedicated hardware in the microcontroller, meaning they operate independently and can run concurrently without blocking each other. The examples below show the minimal configuration required to initialise each peripheral and perform a basic operation; swap in your own pin assignments, speeds, and device addresses as your design requires.
The code examples on this page show the most common configuration for each peripheral. For the complete list of configuration fields, return values, error codes, and advanced options such as DMA transfers and interrupt callbacks, refer to the ANX SDK API Reference included with your SDK installation or available in the developer portal.
UART
I2C
SPI
ADC
PWM
UART
The ANX dev module provides two independent hardware UART ports. UART0 is mapped to GPIO0 (TX) and GPIO1 (RX) on the P1 header and is also used for serial logging during development. UART1 is mapped to GPIO30 (TX) and GPIO31 (RX) on the P2 header and is available for communicating with external devices such as GPS modules, GSM modems, or other microcontrollers.Both ports default to 115200 baud and support standard frame formats from 5 to 8 data bits, 1 or 2 stop bits, and none, even, or odd parity. Hardware flow control (RTS/CTS) is available on UART0.
If you use UART0 for application data, redirect the SDK’s debug log output to UART1 by calling anx_log_set_port(ANX_UART1) during initialisation to avoid mixing log messages with your data stream.
I2C
The ANX dev module provides two I2C buses. I2C0 is mapped to GPIO2 (SDA) and GPIO3 (SCL) on the P1 header. I2C1 is mapped to GPIO32 (SDA) and GPIO33 (SCL) on the P2 header. Both buses support standard mode at 100 kHz and fast mode at 400 kHz.The SDK operates the module as an I2C controller (master). Add 4.7 kΩ pull-up resistors from SDA and SCL to 3.3 V on your board — the internal pull-ups are weak and unsuitable for reliable communication above short cable lengths.
Use ANX_I2C_STANDARD (100 kHz) when working with older or slower peripherals such as EEPROMs and certain RTC chips that do not support fast mode.
SPI
The ANX dev module provides one SPI bus — SPI0 — mapped to GPIO4 (MOSI), GPIO5 (MISO), GPIO6 (CLK), and GPIO7 (CS) on the P1 header. SPI0 supports clock speeds from 100 kHz up to 40 MHz and all four standard SPI modes (mode 0–3).The SDK drives the CS line automatically during transfers when you use the hardware CS pin. If you need to manage multiple SPI devices, drive additional GPIO pins as manual chip selects and assert them yourself before each transfer.
Start at a conservative clock speed (1 MHz or lower) when first bringing up a new SPI peripheral. Increase the speed incrementally once you confirm the device responds correctly.
ADC
The ANX dev module includes an 8-channel, 12-bit successive-approximation ADC. The eight channels are mapped to GPIO18 through GPIO25 on the P2 header and accept input voltages in the 0 V to 3.3 V range. The ADC produces readings from 0 to 4095, where 0 represents 0 V and 4095 represents the full-scale 3.3 V reference.Do not apply voltages outside the 0 V to 3.3 V range to the ADC input pins. Negative voltages and voltages above 3.3 V will damage the converter. If your signal source has a different range, use an op-amp scaling circuit to map it to 0–3.3 V before connecting.
#include "anx/adc.h"anx_adc_init(ANX_ADC0);uint16_t raw = anx_adc_read(ANX_ADC0);float voltage = (raw / 4095.0f) * 3.3f;
For more stable readings on noisy signals, oversample by averaging multiple consecutive reads. The SDK provides anx_adc_read_avg(channel, samples) as a convenience function for this pattern.
PWM
The ANX dev module provides four independent hardware PWM channels mapped to GPIO26 through GPIO29 on the P2 header. Each channel supports frequencies from 1 Hz to 1 MHz and a duty cycle from 0% to 100% with 16-bit resolution. All four channels are driven from the same base timer but can be configured to different frequencies if required.Common applications include LED brightness control, DC motor speed regulation, servo control (50 Hz, 1–2 ms pulse width), and generating audio tones.
Stop a PWM channel cleanly by calling anx_pwm_stop(ANX_PWM0) rather than simply reconfiguring the duty to 0%. Stopping the channel releases the timer resource and drives the output pin low immediately.
{"docsConfig":{"theme":"aspen","$schema":"https://mintlify.com/docs.json","name":"ANX Labs","colors":{"primary":"#ef7025","light":"#eec9bc","dark":"#4fa1ab"},"favicon":"https://mintcdn.com/anx-labs/H0aHZx4SlmwWLATt/favicon.svg?fit=max\u0026auto=format\u0026n=H0aHZx4SlmwWLATt\u0026q=85\u0026s=4a861bb7f869c9f6a31c9b1c852565ba","navbar":{"primary":{"type":"github","href":"https://github.com/anx-labs"}},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"anx-labs","hasAudioNarration":false,"actualSubdomain":"anx-labs","customDomains":["launchpad.anxlabs.com"],"gitSource":{"type":"github","owner":"mintlify-community","repo":"docs-anx-labs-29c3cb4e","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"entitlements":{"AI_CHAT":{"status":"DISABLED"}},"buildId":"6ae95c5b9249234afda65411:success","clientVersion":"0.0.4143","searchFilterCounts":[{"language":"default","tag":"Documentation","count":17},{"language":"default","tag":"API Reference","count":4},{"language":"default","tag":"SDK","count":4},{"language":"default","tag":"Dev Module","count":4},{"language":"default","tag":"Example Applications","count":4},{"language":"default","tag":"OS Firmware","count":4},{"language":"default","tag":"Get Started","count":3},{"language":"default","tag":"Troubleshooting","count":2}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"dev-module/peripherals","slug":"/dev-module/peripherals","pageMetadata":{"title":"ANX Dev Module Peripheral Interfaces Guide","sidebarTitle":"Peripherals","description":"Configure and use UART, I2C, SPI, ADC, and PWM peripherals on the ANX dev module with code examples for each interface type.","href":"/dev-module/peripherals"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Configure and use UART, I2C, SPI, ADC, and PWM peripherals on the ANX dev module with code examples for each interface type.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={code:`code`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,..._provideComponents(),...props.components},{CodeBlock,CodeGroup,Heading,Note,Tab,Tabs,Tip}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!CodeGroup)_missingMdxReference(`CodeGroup`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Note)_missingMdxReference(`Note`,true);if(!Tab)_missingMdxReference(`Tab`,true);if(!Tabs)_missingMdxReference(`Tabs`,true);if(!Tip)_missingMdxReference(`Tip`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`The ANX dev module exposes five hardware peripheral interfaces — UART, I2C, SPI, ADC, and PWM — all accessible through the ANX SDK’s C API. Each interface is backed by dedicated hardware in the microcontroller, meaning they operate independently and can run concurrently without blocking each other. The examples below show the minimal configuration required to initialise each peripheral and perform a basic operation; swap in your own pin assignments, speeds, and device addresses as your design requires.`}),`\n`,_jsx(Tip,{children:_jsxs(_components.p,{children:[`The code examples on this page show the most common configuration for each peripheral. For the complete list of configuration fields, return values, error codes, and advanced options such as DMA transfers and interrupt callbacks, refer to the `,_jsx(_components.strong,{children:`ANX SDK API Reference`}),` included with your SDK installation or available in the developer portal.`]})}),`\n`,_jsxs(Tabs,{children:[_jsxs(Tab,{title:`UART`,id:`uart`,\"data-child-heading-ids\":`[\"uart\"]`,children:[_jsx(Heading,{level:`2`,id:`uart`,children:`UART`}),_jsxs(_components.p,{children:[`The ANX dev module provides two independent hardware UART ports. `,_jsx(_components.strong,{children:`UART0`}),` is mapped to GPIO0 (TX) and GPIO1 (RX) on the P1 header and is also used for serial logging during development. `,_jsx(_components.strong,{children:`UART1`}),` is mapped to GPIO30 (TX) and GPIO31 (RX) on the P2 header and is available for communicating with external devices such as GPS modules, GSM modems, or other microcontrollers.`]}),_jsxs(_components.p,{children:[`Both ports default to `,_jsx(_components.strong,{children:`115200 baud`}),` and support standard frame formats from 5 to 8 data bits, 1 or 2 stop bits, and none, even, or odd parity. Hardware flow control (RTS/CTS) is available on UART0.`]}),_jsx(CodeGroup,{children:_jsx(CodeBlock,{filename:`uart_example.c`,numberOfLines:`11`,language:`c`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`c`,children:_jsxs(_components.code,{language:`c`,numberOfLines:`11`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`#include`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"anx/uart.h\"`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`anx_uart_config_t`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` cfg `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` .port `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ANX_UART0,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` .baud `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 115200`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` .data_bits `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 8`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` .stop_bits `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` .parity `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ANX_PARITY_NONE,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`};`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`anx_uart_init`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`\u0026`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`cfg`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`anx_uart_write`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(ANX_UART0, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Hello`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\n`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`6`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`]})})})}),_jsx(Note,{children:_jsxs(_components.p,{children:[`If you use UART0 for application data, redirect the SDK’s debug log output to UART1 by calling `,_jsx(_components.code,{children:`anx_log_set_port(ANX_UART1)`}),` during initialisation to avoid mixing log messages with your data stream.`]})})]}),_jsxs(Tab,{title:`I2C`,id:`i2c`,\"data-child-heading-ids\":`[\"i2c\"]`,children:[_jsx(Heading,{level:`2`,id:`i2c`,children:`I2C`}),_jsxs(_components.p,{children:[`The ANX dev module provides two I2C buses. `,_jsx(_components.strong,{children:`I2C0`}),` is mapped to GPIO2 (SDA) and GPIO3 (SCL) on the P1 header. `,_jsx(_components.strong,{children:`I2C1`}),` is mapped to GPIO32 (SDA) and GPIO33 (SCL) on the P2 header. Both buses support standard mode at `,_jsx(_components.strong,{children:`100 kHz`}),` and fast mode at `,_jsx(_components.strong,{children:`400 kHz`}),`.`]}),_jsx(_components.p,{children:`The SDK operates the module as an I2C controller (master). Add 4.7 kΩ pull-up resistors from SDA and SCL to 3.3 V on your board — the internal pull-ups are weak and unsuitable for reliable communication above short cable lengths.`}),_jsx(CodeGroup,{children:_jsx(CodeBlock,{filename:`i2c_example.c`,numberOfLines:`10`,language:`c`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`c`,children:_jsxs(_components.code,{language:`c`,numberOfLines:`10`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`#include`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"anx/i2c.h\"`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`anx_i2c_config_t`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` cfg `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` .bus `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ANX_I2C0,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` .speed `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ANX_I2C_FAST,`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // 400 kHz`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`};`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`anx_i2c_init`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`\u0026`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`cfg`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`uint8_t`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`2`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`];`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`anx_i2c_read`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(ANX_I2C0, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#B5CEA8`},children:`0x`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`48`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, data, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`2`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // read 2 bytes from device at address 0x48`})]}),`\n`]})})})}),_jsx(Note,{children:_jsxs(_components.p,{children:[`Use `,_jsx(_components.code,{children:`ANX_I2C_STANDARD`}),` (100 kHz) when working with older or slower peripherals such as EEPROMs and certain RTC chips that do not support fast mode.`]})})]}),_jsxs(Tab,{title:`SPI`,id:`spi`,\"data-child-heading-ids\":`[\"spi\"]`,children:[_jsx(Heading,{level:`2`,id:`spi`,children:`SPI`}),_jsxs(_components.p,{children:[`The ANX dev module provides one SPI bus — `,_jsx(_components.strong,{children:`SPI0`}),` — mapped to GPIO4 (MOSI), GPIO5 (MISO), GPIO6 (CLK), and GPIO7 (CS) on the P1 header. SPI0 supports clock speeds from 100 kHz up to `,_jsx(_components.strong,{children:`40 MHz`}),` and all four standard SPI modes (mode 0–3).`]}),_jsx(_components.p,{children:`The SDK drives the CS line automatically during transfers when you use the hardware CS pin. If you need to manage multiple SPI devices, drive additional GPIO pins as manual chip selects and assert them yourself before each transfer.`}),_jsx(CodeGroup,{children:_jsx(CodeBlock,{filename:`spi_example.c`,numberOfLines:`12`,language:`c`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`c`,children:_jsxs(_components.code,{language:`c`,numberOfLines:`12`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`#include`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"anx/spi.h\"`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`anx_spi_config_t`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` cfg `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` .bus `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ANX_SPI0,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` .speed `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1000000`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // 1 MHz`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` .mode `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ANX_SPI_MODE0,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`};`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`anx_spi_init`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`\u0026`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`cfg`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`uint8_t`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` tx`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`[]`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#B5CEA8`},children:`0x`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`01`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#B5CEA8`},children:`0x`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`02`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`};`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`uint8_t`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` rx`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`2`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`];`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`anx_spi_transfer`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(ANX_SPI0, tx, rx, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`2`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`]})})})}),_jsx(Note,{children:_jsx(_components.p,{children:`Start at a conservative clock speed (1 MHz or lower) when first bringing up a new SPI peripheral. Increase the speed incrementally once you confirm the device responds correctly.`})})]}),_jsxs(Tab,{title:`ADC`,id:`adc`,\"data-child-heading-ids\":`[\"adc\"]`,children:[_jsx(Heading,{level:`2`,id:`adc`,children:`ADC`}),_jsxs(_components.p,{children:[`The ANX dev module includes an 8-channel, 12-bit successive-approximation ADC. The eight channels are mapped to GPIO18 through GPIO25 on the P2 header and accept input voltages in the `,_jsx(_components.strong,{children:`0 V to 3.3 V`}),` range. The ADC produces readings from 0 to 4095, where 0 represents 0 V and 4095 represents the full-scale 3.3 V reference.`]}),_jsx(_components.p,{children:`Do not apply voltages outside the 0 V to 3.3 V range to the ADC input pins. Negative voltages and voltages above 3.3 V will damage the converter. If your signal source has a different range, use an op-amp scaling circuit to map it to 0–3.3 V before connecting.`}),_jsx(CodeGroup,{children:_jsx(CodeBlock,{filename:`adc_example.c`,numberOfLines:`5`,language:`c`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`c`,children:_jsxs(_components.code,{language:`c`,numberOfLines:`5`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`#include`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"anx/adc.h\"`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`anx_adc_init`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(ANX_ADC0);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`uint16_t`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` raw `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` anx_adc_read`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(ANX_ADC0);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`float`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` voltage `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (raw `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`/`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 4095.0`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#B5CEA8`},children:`f`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 3.3`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#B5CEA8`},children:`f`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`]})})})}),_jsx(Note,{children:_jsxs(_components.p,{children:[`For more stable readings on noisy signals, oversample by averaging multiple consecutive reads. The SDK provides `,_jsx(_components.code,{children:`anx_adc_read_avg(channel, samples)`}),` as a convenience function for this pattern.`]})})]}),_jsxs(Tab,{title:`PWM`,id:`pwm`,\"data-child-heading-ids\":`[\"pwm\"]`,children:[_jsx(Heading,{level:`2`,id:`pwm`,children:`PWM`}),_jsxs(_components.p,{children:[`The ANX dev module provides four independent hardware PWM channels mapped to GPIO26 through GPIO29 on the P2 header. Each channel supports frequencies from `,_jsx(_components.strong,{children:`1 Hz to 1 MHz`}),` and a duty cycle from 0% to 100% with 16-bit resolution. All four channels are driven from the same base timer but can be configured to different frequencies if required.`]}),_jsx(_components.p,{children:`Common applications include LED brightness control, DC motor speed regulation, servo control (50 Hz, 1–2 ms pulse width), and generating audio tones.`}),_jsx(CodeGroup,{children:_jsx(CodeBlock,{filename:`pwm_example.c`,numberOfLines:`9`,language:`c`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`c`,children:_jsxs(_components.code,{language:`c`,numberOfLines:`9`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`#include`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"anx/pwm.h\"`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`anx_pwm_config_t`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` cfg `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` .channel `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ANX_PWM0,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` .frequency `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1000`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // 1 kHz`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` .duty `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 50`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // 50% duty cycle`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`};`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`anx_pwm_init`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`\u0026`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`cfg`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`anx_pwm_start`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(ANX_PWM0);`})]}),`\n`]})})})}),_jsx(Note,{children:_jsxs(_components.p,{children:[`Stop a PWM channel cleanly by calling `,_jsx(_components.code,{children:`anx_pwm_stop(ANX_PWM0)`}),` rather than simply reconfiguring the duty to 0%. Stopping the channel releases the timer resource and drives the output pin low immediately.`]})})]})]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"ANX Dev Module Peripheral Interfaces Guide","sidebarTitle":"Peripherals","description":"Configure and use UART, I2C, SPI, ADC, and PWM peripherals on the ANX dev module with code examples for each interface type.","href":"/dev-module/peripherals"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"UART","slug":"uart","depth":2,"children":[],"tabId":"uart"},{"title":"I2C","slug":"i2c","depth":2,"children":[],"tabId":"i2c"},{"title":"SPI","slug":"spi","depth":2,"children":[],"tabId":"spi"},{"title":"ADC","slug":"adc","depth":2,"children":[],"tabId":"adc"},{"title":"PWM","slug":"pwm","depth":2,"children":[],"tabId":"pwm"}],"codeExamples":{}},"jsLinks":[],"subdomain":"anx-labs","siteName":"ANX Labs","title":"ANX Dev Module Peripheral Interfaces Guide - ANX Labs","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-07-17T14:27:25.075Z","originalFileLocation":"dev-module/peripherals.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Configure and use UART, I2C, SPI, ADC, and PWM peripherals on the ANX dev module with code examples for each interface type.\">\u003cmeta data-mint-head name=\"application-name\" content=\"ANX Labs\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/anx-labs/z-GSEWZrCxjpatX7/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/anx-labs/z-GSEWZrCxjpatX7/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/anx-labs/z-GSEWZrCxjpatX7/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/anx-labs/z-GSEWZrCxjpatX7/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/anx-labs/z-GSEWZrCxjpatX7/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/anx-labs/z-GSEWZrCxjpatX7/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/anx-labs/z-GSEWZrCxjpatX7/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/anx-labs/z-GSEWZrCxjpatX7/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/anx-labs/z-GSEWZrCxjpatX7/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"ANX Dev Module Peripheral Interfaces Guide - ANX Labs\">\u003cmeta data-mint-head property=\"og:description\" content=\"Configure and use UART, I2C, SPI, ADC, and PWM peripherals on the ANX dev module with code examples for each interface type.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"ANX Labs\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://launchpad.anxlabs.com/dev-module/peripherals\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://anx-labs.mintlify.site/_mintlify/api/og/v2?division=Dev+Module\u0026amp;title=ANX+Dev+Module+Peripheral+Interfaces+Guide\u0026amp;description=Configure+and+use+UART%2C+I2C%2C+SPI%2C+ADC%2C+and+PWM+peripherals+on+the+ANX+dev+module+with+code+examples+for+each+interface+type.\u0026amp;theme=c2f844e4eb2bbb817b1fc1a7\u0026amp;signature=2b80e60058415105626d37189170e4c177e344905bfb7d2faa4cf6c8cdf3c1d8\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"ANX Dev Module Peripheral Interfaces Guide - ANX Labs\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Configure and use UART, I2C, SPI, ADC, and PWM peripherals on the ANX dev module with code examples for each interface type.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://anx-labs.mintlify.site/_mintlify/api/og/v2?division=Dev+Module\u0026amp;title=ANX+Dev+Module+Peripheral+Interfaces+Guide\u0026amp;description=Configure+and+use+UART%2C+I2C%2C+SPI%2C+ADC%2C+and+PWM+peripherals+on+the+ANX+dev+module+with+code+examples+for+each+interface+type.\u0026amp;theme=c2f844e4eb2bbb817b1fc1a7\u0026amp;signature=2b80e60058415105626d37189170e4c177e344905bfb7d2faa4cf6c8cdf3c1d8\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/anx-labs/z-GSEWZrCxjpatX7/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"ANX Labs\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#ef7025\">\u003clink data-mint-head rel=\"canonical\" href=\"https://launchpad.anxlabs.com/dev-module/peripherals\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/dev-module/peripherals.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://launchpad.anxlabs.com/#organization\",\"name\":\"ANX Labs\",\"url\":\"https://launchpad.anxlabs.com\"},{\"@type\":\"WebSite\",\"@id\":\"https://launchpad.anxlabs.com#website\",\"name\":\"ANX Labs\",\"url\":\"https://launchpad.anxlabs.com\",\"publisher\":{\"@id\":\"https://launchpad.anxlabs.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://launchpad.anxlabs.com/dev-module/peripherals#webpage\",\"url\":\"https://launchpad.anxlabs.com/dev-module/peripherals\",\"name\":\"ANX Dev Module Peripheral Interfaces Guide\",\"description\":\"Configure and use UART, I2C, SPI, ADC, and PWM peripherals on the ANX dev module with code examples for each interface type.\",\"dateModified\":\"2026-07-17T14:27:25.075Z\",\"isPartOf\":{\"@id\":\"https://launchpad.anxlabs.com#website\"},\"breadcrumb\":{\"@id\":\"https://launchpad.anxlabs.com/dev-module/peripherals#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://launchpad.anxlabs.com/dev-module/peripherals#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Dev Module\",\"item\":\"https://launchpad.anxlabs.com/dev-module/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"ANX Dev Module Peripheral Interfaces Guide\",\"item\":\"https://launchpad.anxlabs.com/dev-module/peripherals\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://launchpad.anxlabs.com/dev-module/peripherals#article\",\"headline\":\"ANX Dev Module Peripheral Interfaces Guide\",\"name\":\"ANX Dev Module Peripheral Interfaces Guide\",\"description\":\"Configure and use UART, I2C, SPI, ADC, and PWM peripherals on the ANX dev module with code examples for each interface type.\",\"url\":\"https://launchpad.anxlabs.com/dev-module/peripherals\",\"mainEntityOfPage\":{\"@id\":\"https://launchpad.anxlabs.com/dev-module/peripherals#webpage\"},\"dateModified\":\"2026-07-17T14:27:25.075Z\",\"publisher\":{\"@id\":\"https://launchpad.anxlabs.com/#organization\"},\"isPartOf\":{\"@id\":\"https://launchpad.anxlabs.com#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"ANX Labs\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"ANX Labs\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/dev-module/peripherals.md","siteName":"ANX Labs","nav":{"global":null,"tabs":[{"tab":"Documentation","groups":[{"group":"Get Started","pages":[{"title":"ANX Labs: Embedded Development Modules and Firmware","sidebarTitle":"Introduction","href":"/introduction"},{"title":"Get Started with ANX Labs Dev Module","sidebarTitle":"Quick Start","href":"/quickstart"},{"title":"ANX Dev Module Hardware Specifications","sidebarTitle":"Hardware Overview","href":"/hardware-overview"}]},{"group":"Dev Module","pages":[{"title":"ANX Dev Module: Features and Capabilities","sidebarTitle":"Overview","href":"/dev-module/overview"},{"title":"Set Up the ANX Dev Module on Your Computer","sidebarTitle":"Setup","href":"/dev-module/setup"},{"title":"ANX Dev Module Pin Reference and GPIO Map","sidebarTitle":"Pinout","description":"Complete pin assignment reference for the ANX dev module: GPIO numbers, alternate functions, voltage levels, current limits, and reserved pins.","href":"/dev-module/pinout"},{"title":"ANX Dev Module Peripheral Interfaces Guide","sidebarTitle":"Peripherals","href":"/dev-module/peripherals"}]},{"group":"OS Firmware","pages":[{"title":"ANX OS Firmware: Architecture and Capabilities","sidebarTitle":"Overview","description":"ANX OS firmware provides a real-time execution environment, Wi-Fi and BLE stacks, a file system, and OTA update support for ANX dev modules.","href":"/firmware/overview"},{"title":"Flash ANX OS Firmware onto Your Dev Module","sidebarTitle":"Flashing","href":"/firmware/flashing"},{"title":"Configure ANX OS Firmware Settings and Options","sidebarTitle":"Configuration","href":"/firmware/configuration"},{"title":"Update ANX OS Firmware Over the Air (OTA)","sidebarTitle":"OTA Updates","href":"/firmware/ota-updates"}]},{"group":"Example Applications","pages":[{"title":"ANX Labs Example Applications Library","sidebarTitle":"Overview","href":"/examples/overview"},{"title":"Blinky: Your First ANX Dev Module Program","sidebarTitle":"Blinky","href":"/examples/blinky"},{"title":"Read Sensor Data with the ANX Dev Module","sidebarTitle":"Sensor Data","href":"/examples/sensor-data"},{"title":"Connect ANX Dev Module to Wi-Fi and Cloud MQTT","sidebarTitle":"Connectivity","href":"/examples/connectivity"}]},{"group":"Troubleshooting","pages":[{"title":"Diagnose Common ANX Dev Module Issues","sidebarTitle":"Common Issues","href":"/troubleshooting/common-issues"},{"title":"ANX Labs Frequently Asked Questions","sidebarTitle":"FAQ","href":"/troubleshooting/faq"}]}]},{"tab":"API Reference","pages":[{"title":"API Reference","href":"/api/overview"}]}]},"basePath":"","title":"ANX Dev Module Peripheral Interfaces Guide - ANX Labs","buildId":"dpl_Fyv1NbzwP68g2bEH2Roy98uY1zmE","deploymentId":"dpl_Fyv1NbzwP68g2bEH2Roy98uY1zmE","dynamics":[],"chunks":[]}