Nau88c22-driver: Professional Audio CODEC Solution

Hello! If you're developing audio-based embedded systems, meet a solution that will take your project to the next level: the Nau88c22-driver.

This project provides a simple, modular, and reliable C-based driver framework for high-quality audio CODEC integration.


🔧 Project Purpose & Benefits

The project includes a driver software that provides direct access to the NAU88C22 audio CODEC. This allows you to easily manage audio streams—stereo, speaker, or headphone output—in microcontroller-based systems.

The driver design is kept simple: register-based control over the basic I²C interface; if necessary, it can be extended with higher-level I²S configuration and code additions. This makes it a suitable solution even for embedded and resource-constrained devices.


GitHub

Shared with an open source approach; It can be freely used as a reference or modified—providing flexibility for both industrial and hobby/research projects.


📦 Who is it Suitable For?

Engineers working with ARM or lightweight embedded platforms,

Developers of embedded devices requiring audio output/recording,

Hobby projects seeking stereo audio CODEC support,

Developers seeking an open-source and modular infrastructure.


Lightweight, Modular and Embedded System-Oriented Driver for NAU88C22 Audio CODEC

This project is an open-source driver package for the NAU88C22 stereo audio CODEC.
The goal is to simplify the use of the NAU88C22 in microcontroller-based projects, provide a clean API, and simplify low-level register management.

This driver is compatible with ARM-based MCUs (STM32, RP2040, ESP32-S3, etc.) and provides a functional basis such as CODEC register control over I²C , working with the I²S/SAI audio interface , and headphone/speaker output management .


Features

  • ✔ Simple API for NAU88C22 register map

  • ✔ Full control over I²C (read/write)

  • ✔ Speaker, headphone, DAC, ADC configuration functions

  • ✔ Compatible with I2S/SAI audio interface

  • ✔ Lightweight, minimal design

  • ✔ Modular and expandable


📁 Project Structure

Nau88c22-driver/ │ ├── src/ │ ├── nau88c22.c │ └── nau88c22.h │ ├── examples/ │ └── io.c # Örnek kullanım │ └── README.md


🚀 Start / Integration

1️⃣ Include Files in Your Project

nau88c22.c and nau88c22.h add the files to the project directory.

2️⃣ Implement I²C Functions

The driver expects the following two functions to be provided by the platform:

c
extern void i2c_write_reg(uint8_t devAddr, uint16_t reg, uint16_t data); extern uint16_t i2c_read_reg(uint8_t devAddr, uint16_t reg);

STM32 HAL sample application:

c uint8_t write_bus(uint8_t reg, uint16_t data){ /*uint16_t datas = (reg & 0x7) | ((data<<7) & 0x1ff); uint8_t _data[3]; memcpy(_data, &datas, sizeof(uint16_t)); return _write_spi_bus(_data);*/ reg = (reg<<1) | ((data >> 8) & 0x01); uint8_t senddata[1] = {data & 0xff}; //return HAL_I2C_Mem_Write(&hi2c2, NAU_DEV_ID<<1, reg, 1, senddata, 1, 1000); //return HAL_I2C_Mem_Write(&hi2c2, NAU_DEV_ID<<1, reg, 1, senddata, 1, 1000); return !I2C_Write(NAU_DEV_ID, reg, senddata, 1, 10); } //3 write not use; uint8_t read_bus(uint8_t reg, uint16_t *data){ uint8_t receiveBuffer[3], rd = NAU_OK; /*uint8_t _data[3]; _data[0] = reg & 0x7; uint8_t rd = _read_spi_bus(_data); data = (_data[0] & 0x07) | ((_data[1] <<7 ) & 0x1ff);*/ //rd = HAL_I2C_Mem_Read(&hi2c2, NAU_DEV_ID<<1, reg<<1, 1, receiveBuffer, 2, 1000); rd = !I2C_Read(NAU_DEV_ID, reg<<1, receiveBuffer, 2, 10); *data = (receiveBuffer[0] & 0x01)<<8 | (receiveBuffer[1] & 0xff); return rd; }

Basic Use Case

c
#include "nau88c22.h" void codec_init(void) { audio_volume(VOL_HP); microfone_interface(); output_driver(); output_mixer(); hpf_filter(&n_ALC); }


⚙️ Important Functions

c
#include "nau88c22.h" void codec_init(void) { if(audio_init(&n_ALC)!=AUDIO_OK){//codec init led_on(RED); while(1); } }

🧩 Hardware Connections

NAU88C22MCU
SDAI²C SDA
SCLI²C SCL
BCLKI2S Bit Clock
LRCKI2S Word Select
FROMI2S Data Out
DOUBTI2S Data In
VDD3.3V


📌 Compatibility Tested Platforms

  • STM32F4 Series

  • STM32H7 Series

  • RP2040

  • ESP32-S3

  • (List may be expanded)


📝 License

This project is released under the MIT License.
You can use it as you wish, modify it, and integrate it into your projects.


🤝 Contribution

Pull requests, improvement suggestions, and bug reports are welcome.

Comments

Popular posts from this blog

XC7Z010, SoC PCB design with FPGA IC

Designed for Flight, Redesigned for Your Wrist: The New Vario Watch Edition