How to share i2c master between ADF and other application tasks ?
Posted: Mon Aug 25, 2025 4:25 pm
by esp32.damiano
Current setup
- ESP-ADF latest
- Targeting chip ES8388
- custom board that wish to use i2c to contol the ES8388 and also a clock chip (date+time)
apparently at line 81 of es8388.c there is a i2c_init function that is called by es8388_init
the question: What would be the proper way to share a single master driver for i2c ?
Re: How to share i2c master between ADF and other application tasks ?
Posted: Sun Oct 05, 2025 3:52 pm
by esp32.damiano
message for Espressif, please have some competent people help developers
so, lots of hours spent discovering this (valid on october 2025)
- there is a bunch of I2S in standard IDF and that CAN share the bus master
- start with a demo close to what you sish to do, source from the idf !
then, the real problem is if you wish to add the ADF to the game
I cannot attach to a pipeline component something that writes to the IDF i2s channel, at the moment I have a thread that take from a raw device in the pipeline and write to the i2s channel using i2s_channel_write
the whole "architecture" is quite a mess, ok, yes, there are reasons, however.... having a void * as a holder of a datastructure is NOT something that should be done, if REALLY you can have divverent structures, use a union
I am talking about esp_codec_dev_handle_t esp_codec_dev_new(esp_codec_dev_cfg_t *cfg) where
esp_codec_dev_handle_t is just void *
at the moment I am battling with "how to change the samplerate", so fare closing and reopening the device works (with noise)
errcode = esp_codec_dev_open(audio.codec_devP, &audio.sample_cfg);