Skip to content

Added M5Atom S3R + M5Atom Echo Base target file #1501

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: public
Choose a base branch
from

Conversation

kitazaki
Copy link
Contributor

I added M5Atomic Echo Base device in #1498
I added one more target file for M5Atom S3R.

m5atom_s3r_echo_base

I also updated setup-target.js of M5Atom Lite + M5Atomic Echo Base and M5Atom S3 + M5Atomic Echo Base.
The reason why I moved the M5Atomic Echo Base init process from inside of startup sound check proess to outside, the init process is called when startup sound is false in sample program.

1 parent

kitazaki added 4 commits May 11, 2025 22:15
<A HREF="https://docs.m5stack.com/en/atom/Atomic%20Echo%20Base">Atomic Echo Base</A> is speaker and microphone base for M5 Atom series.

I added M5Atom Lite and M5Atom S3 with Atomic Echo Base target files.
Added 1 target file of M5Atom S3R + M5Atomic Echo Base.
I also updated setup-target.js of M5Atom Lite + M5Atomic Echo Base and M5Atom S3 + M5Atomic Echo Base.
The reason why I moved the M5Atomic Echo Base init process from inside of startup sound check proess to outside, the init process is called when startup sound is false in sample program.
Deleted audioIn definition because of audioIn function is under testing.
A microphone is not PDM type but I2S STD type.
@kitazaki
Copy link
Contributor Author

Deleted audioIn definition because of audioIn function is under testing.
A microphone is not PDM type but I2S STD type.

Supported microphone of M5Atomic Echo Base
@kitazaki
Copy link
Contributor Author

Supported microphone of M5Atomic Echo Base.
Updated $MODDABLE/modules/pins/audioin/esp32/audioin.c to support I2S STD type microphone.
Tested with $MODDABLE/examples/pins/audioin/replay and this works fine.

@stc1988
Copy link
Contributor

stc1988 commented May 18, 2025

@kitazaki
Great work. Does this also work with ECMA419 AudioIn?

@kitazaki
Copy link
Contributor Author

@stc1988
I'm not sure on ECMA419 AudioIn specification.
There are many parameters in I2S audio interface with init process of hardware.
https://github.com/kitazaki/M5Atomic_Echo_Base/blob/main/ES8311%20DS.pdf
Some parameters are hard coded in $MODDABLE/modules/pins/audioin/esp32/audioin.c
Is there any sample code to check it?

@stc1988
Copy link
Contributor

stc1988 commented May 18, 2025

You can try example apps in https://github.com/Moddable-OpenSource/moddable/tree/public/examples/io/audioin .

@kitazaki
Copy link
Contributor Author

kitazaki commented May 21, 2025

I checked two examples of below, build failed with linker errors in both esp32 and esp32s3.
$MODDABLE/io/audioin/capture-sync
$MODDABLE/io/audioin/levelmonitor

esp32 case
/Users/kitazaki/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld: xs_esp32.a(mc.xs.c.o):(.rodata.gxBuilders37+0xc): undefined reference toxs_audioin_constructor'
/Users/kitazaki/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld: xs_esp32.a(mc.xs.c.o):(.rodata.gxBuilders37+0x30): undefined reference to xs_audioin_level' /Users/kitazaki/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld: xs_esp32.a(mc.xs.c.o):(.rodata.gxBuilders37+0x3c): undefined reference to xs_audioin_start'
/Users/kitazaki/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld: xs_esp32.a(mc.xs.c.o):(.rodata.gxBuilders37+0x48): undefined reference to xs_audioin_stop' /Users/kitazaki/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld: xs_esp32.a(mc.xs.c.o):(.rodata.gxBuilders37+0x54): undefined reference to xs_audioin_get_format'
/Users/kitazaki/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld: xs_esp32.a(mc.xs.c.o):(.rodata.gxBuilders37+0x60): undefined reference to xs_audioin_set_format' /Users/kitazaki/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld: xs_esp32.a(mc.xs.c.o):(.rodata.gxBuilders37+0x78): undefined reference to xs_audioin_get_channels'
/Users/kitazaki/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld: xs_esp32.a(mc.xs.c.o):(.rodata.gxHeap+0xcb08): undefined reference to xs_audioin_get_channels' /Users/kitazaki/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld: xs_esp32.a(mc.xs.c.o):(.rodata.gxHeap+0xcb48): undefined reference to xs_audioin_set_format'
/Users/kitazaki/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld: xs_esp32.a(mc.xs.c.o):(.rodata.gxHeap+0xcca8): undefined reference to xs_audioin_get_format' /Users/kitazaki/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld: xs_esp32.a(mc.xs.c.o):(.rodata.gxHeap+0xcd78): undefined reference to xs_audioin_constructor'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
`

esp32s3 case
/Users/kitazaki/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld: xs_esp32s3.a(mc.xs.c.o):(.rodata.gxBuilders38+0xc): undefined reference toxs_audioin_constructor'
/Users/kitazaki/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld: xs_esp32s3.a(mc.xs.c.o):(.rodata.gxBuilders38+0x30): undefined reference to xs_audioin_level' /Users/kitazaki/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld: xs_esp32s3.a(mc.xs.c.o):(.rodata.gxBuilders38+0x3c): undefined reference to xs_audioin_start'
/Users/kitazaki/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld: xs_esp32s3.a(mc.xs.c.o):(.rodata.gxBuilders38+0x48): undefined reference to xs_audioin_stop' /Users/kitazaki/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld: xs_esp32s3.a(mc.xs.c.o):(.rodata.gxBuilders38+0x54): undefined reference to xs_audioin_get_format'
/Users/kitazaki/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld: xs_esp32s3.a(mc.xs.c.o):(.rodata.gxBuilders38+0x60): undefined reference to xs_audioin_set_format' /Users/kitazaki/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld: xs_esp32s3.a(mc.xs.c.o):(.rodata.gxBuilders38+0x78): undefined reference to xs_audioin_get_channels'
/Users/kitazaki/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld: xs_esp32s3.a(mc.xs.c.o):(.rodata.gxHeap+0xd708): undefined reference to xs_audioin_get_channels' /Users/kitazaki/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld: xs_esp32s3.a(mc.xs.c.o):(.rodata.gxHeap+0xd748): undefined reference to xs_audioin_set_format'
/Users/kitazaki/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld: xs_esp32s3.a(mc.xs.c.o):(.rodata.gxHeap+0xd768): undefined reference to xs_audioin_get_format' /Users/kitazaki/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld: xs_esp32s3.a(mc.xs.c.o):(.rodata.gxHeap+0xd788): undefined reference to xs_audioin_constructor'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
`

@stc1988
Copy link
Contributor

stc1988 commented May 21, 2025

@kitazaki

You include pins/audioin Module in manifest.json of device, but it conflicts with embedded:io/audio/in.

	"modules": {
		"*": [
			"$(MODULES)/pins/audioin/*",
			"$(MODULES)/pins/audioin/esp32/*"

Which one to use should be decided by the application side.
I removeed this section from manifest.json and successed to build.

@phoddie
Copy link
Collaborator

phoddie commented May 21, 2025

Which one to use should be decided by the application side.

That's a reasonable approach. It eliminates the possibility of a start-up sound defined by device, but that seems like an acceptable sacrifice.

@kitazaki
Copy link
Contributor Author

kitazaki commented May 22, 2025

Updated to work with ECMA419 AudioIn.
I also updated $MODDABLE/modules/io/audioin/esp32/audioin.c to match bitsPerSample defined in manifest.json.

@stc1988
Thank you for your comment. It works fine for me.

@phoddie
sounds good.

Result of examples.

  • $MODDABLE/examples/pins/audioin/replay
    works
  • $MODDABLE/examples/io/audioin/capture-sync
    works with change numChannels 1 -> 2 in manifest.json.
    this parameter is depends on device. if numChannels 1, recorded data is played fast.

"defines": { "audioIn": { "sampleRate": 22050, "numChannels": 2, "bitsPerSample": 16 },

for m5atom_s3_echo_base and m5atom_lite_echo_base target files.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants