Skip to main content

Bring-up 5: Peripherals and AI

The final stage brings up the hardware your product actually uses โ€” GPIO, buses, audio, display, Bluetooth โ€” and then runs the AI application on top of the now-solid base. Do this last: a peripheral bug is easy to find once system, storage, network, and cloud already work.

Goalโ€‹

Your product's peripherals work through TuyaOpen, and an AI application such as your_chat_bot runs end to end (voice in, cloud reasoning, voice/display out).

Files to implementโ€‹

Implement only what your product needs.

FileEnables
tkl_gpio.c / tkl_pinmux.cGPIO and pin multiplexing
tkl_i2c.c / tkl_spi.cI2C and SPI buses (sensors, displays, codecs)
tkl_pwm.c / tkl_adc.c / tkl_dac.cPWM, ADC, DAC
tkl_i2s.cI2S audio โ€” microphone capture and speaker playback
tkl_disp.c (or mcu8080 / rgb / qspi)Display panel interface
tkl_bluetooth.cBLE โ€” provisioning and BLE peripherals
tkl_kws.c / tkl_vad.cWake-word spotting and voice activity detection
tkl_ota.cOTA firmware update

Detailsโ€‹

  • Audio is the AI prerequisite. your_chat_bot needs working I2S capture and playback; bring up tkl_i2s.c and verify a microphone-to-speaker loopback before adding the cloud AI layer.
  • Display is needed only for on-device AI UIs; pick the interface your panel uses (mcu8080, rgb, or qspi).
  • Wake word. tkl_kws.c / tkl_vad.c let the device wake on a keyword; supply the model files for your platform.
  • Validate peripherals individually with the peripheral examples before composing them into the app.
  • The on-device AI stack itself (modes, agent, UI) is reused โ€” see the Component Framework; you only provide the hardware via these adapters.

Verifyโ€‹

Run the relevant peripheral examples (GPIO, I2C, audio) and confirm each works. Then build apps/tuya.ai/your_chat_bot, and confirm a full voice round-trip: speak โ†’ ASR โ†’ cloud reply โ†’ TTS playback (and display, if present). That completes the platform port.

See alsoโ€‹