From 812b3abff7955054aa829c2c17897fb2cbf13d61 Mon Sep 17 00:00:00 2001 From: Armando Visconti Date: Wed, 28 Apr 2021 16:36:40 +0200 Subject: [PATCH] samples/shields/x_nucleo_iks02a1: Review README file for microphone Review README file adding some more comments and removing hints which are no longer needed. Signed-off-by: Armando Visconti --- .../x_nucleo_iks02a1/microphone/README.rst | 49 ++++++++++++------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/samples/shields/x_nucleo_iks02a1/microphone/README.rst b/samples/shields/x_nucleo_iks02a1/microphone/README.rst index 42d0a42a85b..7740f521b9b 100644 --- a/samples/shields/x_nucleo_iks02a1/microphone/README.rst +++ b/samples/shields/x_nucleo_iks02a1/microphone/README.rst @@ -18,13 +18,14 @@ Requirements ************ This sample communicates over I2C with the X-NUCLEO-IKS02A1 shield -stacked on a board with an Arduino connector. The board's I2C must be -configured for the I2C Arduino connector (both for pin muxing -and device tree). See for example the :ref:`nucleo_f411re_board` board -source code: +stacked on a board with an Arduino connector. -- :zephyr_file:`boards/arm/nucleo_f411re/nucleo_f411re.dts` -- :zephyr_file:`boards/arm/nucleo_f411re/pinmux.c` +.. note:: + + Please note that, in order to make the shield working on top of this board, + it is needed to have SB24 and SB29 solder bridges properly closed. In this way + the PDM microphone clock and data lines get connected to SPI clock and MOSI. + Similar consideration may apply to other boards as well. References ********** @@ -44,19 +45,18 @@ To build the sample you can use following command: :goals: build :compact: -Please note that, in order to make the shield working on top of this board, it is needed to have -SB24 and SB29 solder bridges properly closed. In this way the PDM -microphone clock and data lines get connected to SPI clock and MOSI. -Similar consideration may apply to other boards as well. +.. note:: -One of the things that must be verified before building the sample is the I2S output clock frequency -configuration. For example, for nucleo_f441re board, we have the following shield file that -configures the I2SPLL and have a dependency on HSE/HSI: -:zephyr_file:`boards/shields/x_nucleo_iks02a1/boards/nucleo_f411re.defconfig` + In case a different board is used, one of the things that must be verified before + building the sample is the I2S output clock frequency configuration. For example, + for nucleo_f411re board, we have the following file that configures the I2SPLL and + have a dependency on HSE/HSI: + :zephyr_file:`boards/shields/x_nucleo_iks02a1/boards/nucleo_f411re.defconfig` + + The user is invited to to verify which osci is configured on the used host board + defconfig file and calculate the final I2SClk frequency, e.g. + :zephyr_file:`boards/arm/nucleo_f411re/nucleo_f411re.dts` -The user is invited to to verify which osci is configured on the used host board defconfig file -and calculate the final I2SClk frequency: -:zephyr_file:`boards/arm/nucleo_f411re/nucleo_f411re_defconfig` Sample Output ============= @@ -91,7 +91,7 @@ as a USB CDC class, and will use ``/dev/ttyACM0`` device for communication. The ``/dev/ttyACM0`` port must be configured in raw mode to avoid having special characters (such as :kbd:`CTRL-Z` or :kbd:`CTRL-D`) -processed or 'cooked' out. +processed and 'cooked out'. .. code-block:: console @@ -99,10 +99,21 @@ processed or 'cooked' out. cat /dev/ttyACM0 > /tmp/sound.raw dos2unix -f /tmp/sound.raw -.. note:: The dos2unix command is used to recover the situation in which the character 0x0a is +.. note:: + + The dos2unix command is used to recover the situation in which the character 0x0a is interpreted as NL and an 0x0d (CR) is added. If you don't remove it the audio stream would get corrupted. +.. warning:: + + The /tmp/sound.raw file final size should result exactly of 32000 byte, but sometimes may + happen that 1 or 2 spurious 0x00 bytes are put at the beginning. In this case the user + may get rid of them using the following linux command (change ``skip`` value according + to number of spurious bytes to be removed): + + dd if=sound.raw of=sound_clean.raw bs=1 skip=1 + ASCII PCM Output ----------------