Skip to content
Richard Hu edited this page Oct 7, 2019 · 8 revisions

Description

TechNexion VoiceHat information page

TechNexion VoiceHat includes four parts:

TFA9892 (speaker), SPH0645(MIC), PCA9955(LEDs), 8 GPIO keys.

TechNexion VoiceHat is used in Amazon Alexa project with TechNexion PICO-IMX7D/PICO-IMX8MQ.

NXP added a Yocto meta-layer("meta-avs-demos") to integrate Amazon Alexa SDK.

Compatible baseboard/SOM/software

SOM BaseBoard Software
PICO-IMX7D PICO-PI After Yocto 2.5(included)
PICO-IMX8MQ PICO-PI-8M After Yocto 2.5(included)
PICO-IMX8MM PICO-PI-8M After Yocto 2.5(included)
FLEX-IMX8MM FLEX-PI After Yocto 2.5(included)

PS. "meta-avs-demos" isn't integrated in TechNexion Yocto

Hardware Configuration

voicehat_appearance.png

1. J6 jumper header:

Configure it to use the power supply of VoiceHat from external independent power(J5, 12V) or baseboard.

With Jumper on Pin1 Pin2andPin9 Pin10: VoiceHat uses the power from baseboard.

Without jumpers on Pin1 Pin2andPin9 Pin10: VoiceHat uses the power from external independent power(J5, 12V).

(For PICO-IMX7D with PICO-PI, we suggest using external 12V power from J5.)

voicehat_schematic_J6.png

2. DIP SWITCH1:

Control the routing patch of the signal.

For PICO-IMX7D : Set D1, D3, D5, D7 as UP(ON).

For PICO-IMX8MM/8MQ : Set D2, D4, D6, D8 as UP(ON).

voicehat_schematic_SWITCH1.png

Test VoiceHat in Yocto

1. Set the correct DTB(device tree blob) with Voicehat support:

For PICO-IMX7D with PICO-PI baseboard:

For PICO-PI rev.B1:
=> setenv setfdt 'setenv fdtfile imx7d-pico-pi-voicehat.dtb'
For PICO-PI rev.C2:
=> setenv setfdt 'setenv fdtfile imx7d-pico-pi-c2-voicehat.dtb'

For i.MX8MQ/i.MX8MM:

Please refer to:

Change DTB for i.MX8MQ

Change DTB for i.MX8MM

2. Check kernel message:

# dmesg

Ensure that loaded DTB is correct.

OF: fdt: Machine model: TechNexion PICO-IMX7D and PI baseboard with VoiceHat

Ensure that SPH0645(MIC) driver is initialized correctly.

imx_sph0645_probe(): imx_sph0645_probe
imx_sph0645_probe(): Found 1 codec(s)
imx_sph0645_probe(): Reference clock found: pll_audio_main @ 663552000
imx_sph0645_init():
imx-sph0645 sound-sph0645: imx_sph0645_init,177: dai_init
imx-sph0645 sound-sph0645: sph0645 <-> 308c0000.sai mapping ok
imx_sph0645_probe(): done

Ensure that TFA9892(speaker) driver is initialized correctly.

snd_soc_tfa98xx: loading out-of-tree module taints kernel.
tfa98xx_i2c_init(): TFA98XX driver version v6.5.5
tfa98xx_i2c_probe(): addr=0x34
tfa98xx_i2c_probe(): TFA9912 detected
tfa98xx_i2c_probe(): tfa98xx_i2c_probe Probe completed successfully!
tfa98xx_i2c_probe(): addr=0x35

Found 2 codec(s)

Ensure the TFA98xx module driver are loaded successfully.

# lsmod

Module                  Size  Used by
snd_soc_tfa98xx       147456  2

The used count should be 2. used count 2 corresponds to left and right TFA98xx.

If TFA98xx off-tree module driver fails to be loaded.

Please check if the firmware exists and is put in the correct path.

(Yocto 2.5 already integrates TFA98xx firmware in the target image.)

The firmware should be under the path:

# ls -al /lib/firmware/tfa98/9912/TFA9892N1A_stereo_32FS.cnt
-r--r--r-- 1 root root 29090 Aug 20  2019 /lib/firmware/tfa98/9912/TFA9892N1A_stereo_32FS.cnt

3. Check sound cards :

Ensure there are two sound cards in the system: SPH0645(MIC) and TFA9912(speaker).

# cat /proc/asound/cards
 0 [SPH0645        ]: SPH0645 - SPH0645
                      SPH0645
 1 [TFA9912        ]: TFA9912 - TFA9912
                      TFA9912

Check if the ALSA PLAYBACK(TFA9912) and CAPTURE(SPH0645) devices exist.

# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 1: TFA9912 [TFA9912], device 0: HiFi multicodec-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
# arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: SPH0645 [SPH0645], device 0: HiFi sph0645-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: TFA9912 [TFA9912], device 0: HiFi multicodec-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

4. Run test scripts in Yocto:

To make it easier for the user, we prepare the test scripts to test functions on VoiceHat.

# /opt/voicehat-test/voicehat_main.sh

***********************************
      LED Testing
***********************************

***********************************
      Speaker Testing
***********************************

speaker-test 1.1.5

Playback device is hw:1
Stream parameters are 48000Hz, S16_LE, 2 channels
WAV file(s)

Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 64 to 16384
Period size range from 32 to 8192
Using max buffer size 16384
Periods = 4
was set period_size = 4096
was set buffer_size = 16384
 0 - Front Left

 1 - Front Right
Time per period = 2.736881
 0 - Front Left
 1 - Front Right
Time per period = 2.986900



***********************************
      MIC Testing
***********************************
Record for 5 sec, observe the volume bar, then playback:
imx_sph0645_startup():
Recording WAVE '/tmp/test.wav' : Signed 32 bit Little Endian, Ratimx_sph0645_trigger():
e 48000 Hz, Stereo
Plug PCM: Hardware PCM card 0 'SPH0645' device 0 subdevice 0
Its setup is:
  stream       : CAPTURE
  access       : RW_INTERLEAVED
  format       : S32_LE
  subformat    : STD
  channels     : 2
  rate         : 48000
  exact rate   : 48000 (48000/1)
  msbits       : 32
  buffer_size  : 8192
  period_size  : 2048
  period_time  : 42666
  tstamp_mode  : NONE
  tstamp_type  : MONOTONIC
  period_step  : 1
  avail_min    : 2048
  period_event : 0
  start_threshold  : 1
  stop_threshold   : 8192
  silence_threshold: 0
  silence_size : 0
  boundary     : 1073741824
  appl_ptr     : 0
  hw_ptr       : 0
######+                          imx_sph0645_trigger():
                  | 11%
imx_sph0645_shutdown():

Playing WAVE '/tmp/test.wav' : Signed 32 bit Little Endian, Rate 48000 Hz, Stereo




***********************************
      Button Testing
***********************************
Please PREV button
PREV pressed
Please PLAY button
PLAY pressed
Please NEXT button
NEXT pressed
Please UP button
UP pressed
Please DOWN button
DOWN pressed
Please MUTE button
MUTE pressed
Please PAIR button
PAIR pressed
Please ACT button
ACT pressed

Troubleshooting

1. The board resets unexpectedly when it is playing or recording audio.

Most cases for unexpected reset of the board are caused by insufficient power.

Please follow the guide to use external independent power supply for VoiceHat.

2. If you don't see any sound cards shown under /proc/asound/cards

Case 1. Check if the loaded DTB is the correct one with enabled VoiceHat.

Case 2. Check J6 jumper to see if you configure J6 jumper header to use external independent power but the power cable isn't plugged to J5.