Skip to content

Commit beef6eb

Browse files
authored
Merge pull request #205 from xmos/release/v5.1.0
Release v5.1.0
2 parents 43f04c3 + 4c9f364 commit beef6eb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+3517
-428
lines changed

.github/scripts/build_test_apps.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#!/bin/bash
2-
set -e
32

43
pwd
54

65
wget https://raw.githubusercontent.com/xmos/xmos_cmake_toolchain/main/xs3a.cmake
76
wget https://raw.githubusercontent.com/xmos/xmos_cmake_toolchain/main/xc_override.cmake
87
cmake -B build.xcore -DDEV_LIB_MIC_ARRAY=1 -DCMAKE_TOOLCHAIN_FILE=./xs3a.cmake
98
pushd build.xcore
10-
make all
9+
make all -j 4 # Jenkins and github don't like large numbers here and will crash
10+
1111
# I can't get the following two (custom) targets to build with 'all'.
1212
# Currently an issue with java prevents these from working in CI.
1313
# make tests-legacy_build

.github/scripts/run_test_apps.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# This script expects to be run from the root of the mic_array repo
2+
3+
pwd
4+
BINARY_PATH=build.xcore/
5+
pushd ${BINARY_PATH}
6+
7+
# Unit tests
8+
xrun --xscope tests/unit/tests-unit.xe
9+
10+
# Signal/Decimator tests
11+
pytest ../tests/signal/TwoStageDecimator/ -vv
12+
13+
# Filter design tests
14+
pytest ../tests/signal/FilterDesign/ -vv
15+
16+
popd

.github/workflows/ci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636

3737
- name: Pull builder container
3838
run: |
39-
docker pull ghcr.io/xmos/xcore_builder:latest
39+
docker pull ghcr.io/xmos/xcore_builder:v2.0.0
4040
4141
- name: Install Python
4242
uses: actions/setup-python@v2
@@ -47,6 +47,8 @@ jobs:
4747
run: |
4848
python -m pip install --upgrade pip
4949
pip install numpy
50+
pip install scipy
51+
pip install matplotlib
5052
5153
- name: Build
5254
run: |

.github/workflows/docs.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434

3535
- name: Pull doc_builder container
3636
run: |
37-
docker pull ghcr.io/xmos/doc_builder:v2.0.0
37+
docker pull ghcr.io/xmos/doc_builder:v3.0.0
3838
3939
- name: Build documentation
4040
run: |
@@ -43,15 +43,15 @@ jobs:
4343
- name: Save HTML documentation artifact
4444
uses: actions/upload-artifact@v2
4545
with:
46-
name: lib_mic_array_docs
46+
name: lib_mic_array_docs_html
4747
path: ./doc/_build/html
4848
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`
4949
retention-days: 5
5050

5151
- name: Save PDF documentation artifact
5252
uses: actions/upload-artifact@v2
5353
with:
54-
name: lib_xcore_math_docs_pdf
54+
name: lib_mic_array_docs_pdf
5555
path: ./doc/_build/pdf/programming_guide.pdf
5656
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`
5757
retention-days: 5

CHANGELOG.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
lib_mic_array change log
22
========================
33

4+
5.1.0
5+
-----
6+
7+
* Added 16ch de-interleave to support 16 DDR mics on a single 8b port
8+
* Added parallel decimation use example
9+
* Fixed documentation generation issues
10+
11+
5.0.3
12+
-----
13+
14+
* Improved default audio filter. Reduces noise floor and improves alias attentuation
15+
* Changed DCOE filter to increase attenuation below 20 Hz
16+
417
5.0.2
518
-----
619

Jenkinsfile

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
@Library('[email protected]') _
2+
getApproval()
3+
pipeline {
4+
agent none
5+
options {
6+
disableConcurrentBuilds()
7+
skipDefaultCheckout()
8+
timestamps()
9+
// on develop discard builds after a certain number else keep forever
10+
buildDiscarder(logRotator(
11+
numToKeepStr: env.BRANCH_NAME ==~ /develop/ ? '25' : '',
12+
artifactNumToKeepStr: env.BRANCH_NAME ==~ /develop/ ? '25' : ''
13+
))
14+
}
15+
parameters {
16+
string(
17+
name: 'TOOLS_VERSION',
18+
defaultValue: '15.2.1',
19+
description: 'The XTC tools version'
20+
)
21+
}
22+
environment {
23+
REPO = 'lib_mic_array'
24+
}
25+
stages {
26+
stage('Basic tests') {
27+
agent {
28+
label 'x86_64 && linux'
29+
}
30+
stages {
31+
stage("Setup") {
32+
// Clone and install build dependencies
33+
steps {
34+
// Print the build agent name
35+
println "RUNNING ON"
36+
println env.NODE_NAME
37+
// Clone infrastructure repos
38+
sh "git clone --branch v1.4.6 [email protected]:xmos/infr_apps"
39+
sh "git clone --branch v1.2.1 [email protected]:xmos/infr_scripts_py"
40+
// clone
41+
dir("$REPO") {
42+
checkout scm
43+
sh "git submodule update --init --recursive"
44+
withTools(params.TOOLS_VERSION) {
45+
installDependencies()
46+
}
47+
}
48+
}
49+
}
50+
stage("Lib checks") {
51+
steps {
52+
println "Unlikely these will pass.."
53+
// warnError("Source Check"){ sourceCheck("${REPO}") }
54+
// warnError("Changelog Check"){ xcoreChangelogCheck("${REPO}") }
55+
}
56+
}
57+
}
58+
post {
59+
cleanup {
60+
xcoreCleanSandbox()
61+
}
62+
}
63+
}
64+
stage('HW tests') {
65+
agent {
66+
label 'xvf3800' // We have plenty of these (6) and they have a single XTAG connected
67+
}
68+
stages {
69+
stage("Setup") {
70+
// Clone and install build dependencies
71+
steps {
72+
// clone
73+
dir("$REPO") {
74+
println "RUNNING ON"
75+
println env.NODE_NAME
76+
checkout scm
77+
sh "git submodule update --init --recursive"
78+
withTools(params.TOOLS_VERSION) {
79+
installDependencies()
80+
}
81+
}
82+
}
83+
}
84+
stage("Build firmware") {
85+
steps {
86+
withTools(params.TOOLS_VERSION) {
87+
dir("$REPO"){
88+
sh ". .github/scripts/build_test_apps.sh"
89+
}
90+
}
91+
}
92+
}
93+
stage('Run tests') {
94+
steps {
95+
dir("${REPO}") {
96+
withTools(params.TOOLS_VERSION) {
97+
withVenv {
98+
// Use xtagctl to reset the relevent adapters first, if attached, to be safe.
99+
// sh "xtagctl reset_all XVF3800_INT XVF3600_USB"
100+
sh ". .github/scripts/run_test_apps.sh"
101+
}
102+
}
103+
}
104+
dir("${REPO}/..") {
105+
// archiveArtifacts artifacts: "src/BeClearMemory.S", fingerprint: true
106+
}
107+
}
108+
}
109+
}
110+
post {
111+
cleanup {
112+
xcoreCleanSandbox()
113+
cleanWs()
114+
}
115+
}
116+
}
117+
}
118+
}

demos/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@ include(../cmake/demo_common.cmake)
2020

2121
add_subdirectory( demo )
2222
add_subdirectory( demo_vanilla )
23+
add_subdirectory( demo_par_decimator )
2324
add_subdirectory( measure_mips )

demos/common/src/aic3204/aic3204.c

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
// Copyright 2020-2023 XMOS LIMITED.
2+
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
3+
4+
/* App headers */
5+
#include "aic3204.h"
6+
7+
#include "i2c.h"
8+
extern i2c_master_t i2c_master_ctx;
9+
10+
/*
11+
* Example configuration of the TLV320AIC3204 DAC using i2c.
12+
*
13+
* For details on the TLV320AIC3204 registers and configuration sequence,
14+
* see chapters 4 and 5 here: https://www.ti.com/lit/ml/slaa557/slaa557.pdf
15+
*
16+
* Must be called after the RTOS scheduler is started.
17+
*/
18+
int aic3204_init(void)
19+
{
20+
if (
21+
// Set register page to 0
22+
aic3204_reg_write(AIC3204_PAGE_CTRL, 0x00) == 0 &&
23+
24+
// Initiate SW reset (PLL is powered off as part of reset)
25+
aic3204_reg_write(AIC3204_SW_RST, 0x01) == 0 &&
26+
27+
// Program clock settings
28+
29+
// Default is CODEC_CLKIN is from MCLK pin. Don't need to change this.
30+
// Power up NDAC and set to 1
31+
aic3204_reg_write(AIC3204_NDAC, 0x81) == 0 &&
32+
// Power up MDAC and set to 4
33+
aic3204_reg_write(AIC3204_MDAC, 0x84) == 0 &&
34+
// Power up NADC and set to 1
35+
aic3204_reg_write(AIC3204_NADC, 0x81) == 0 &&
36+
// Power up MADC and set to 4
37+
aic3204_reg_write(AIC3204_MADC, 0x84) == 0 &&
38+
// Program DOSR = 128
39+
aic3204_reg_write(AIC3204_DOSR, 0x80) == 0 &&
40+
// Program AOSR = 128
41+
aic3204_reg_write(AIC3204_AOSR, 0x80) == 0 &&
42+
// Set Audio Interface Config: I2S, 24 bits, slave mode, DOUT always driving.
43+
aic3204_reg_write(AIC3204_CODEC_IF, 0x20) == 0 &&
44+
// Program the DAC processing block to be used - PRB_P1
45+
aic3204_reg_write(AIC3204_DAC_SIG_PROC, 0x01) == 0 &&
46+
// Program the ADC processing block to be used - PRB_R1
47+
aic3204_reg_write(AIC3204_ADC_SIG_PROC, 0x01) == 0 &&
48+
// Select Page 1
49+
aic3204_reg_write(AIC3204_PAGE_CTRL, 0x01) == 0 &&
50+
// Enable the internal AVDD_LDO:
51+
aic3204_reg_write(AIC3204_LDO_CTRL, 0x09) == 0 &&
52+
53+
//
54+
// Program Analog Blocks
55+
// ---------------------
56+
//
57+
// Disable Internal Crude AVdd in presence of external AVdd supply or before powering up internal AVdd LDO
58+
aic3204_reg_write(AIC3204_PWR_CFG, 0x08) == 0 &&
59+
// Enable Master Analog Power Control
60+
aic3204_reg_write(AIC3204_LDO_CTRL, 0x01) == 0 &&
61+
// Set Common Mode voltages: Full Chip CM to 0.9V and Output Common Mode for Headphone to 1.65V and HP powered from LDOin @ 3.3V.
62+
aic3204_reg_write(AIC3204_CM_CTRL, 0x33) == 0 &&
63+
// Set PowerTune Modes
64+
// Set the Left & Right DAC PowerTune mode to PTM_P3/4. Use Class-AB driver.
65+
aic3204_reg_write(AIC3204_PLAY_CFG1, 0x00) == 0 &&
66+
aic3204_reg_write(AIC3204_PLAY_CFG2, 0x00) == 0 &&
67+
// Set ADC PowerTune mode PTM_R4.
68+
aic3204_reg_write(AIC3204_ADC_PTM, 0x00) == 0 &&
69+
// Set MicPGA startup delay to 3.1ms
70+
aic3204_reg_write(AIC3204_AN_IN_CHRG, 0x31) == 0 &&
71+
// Set the REF charging time to 40ms
72+
aic3204_reg_write(AIC3204_REF_STARTUP, 0x01) == 0 &&
73+
// HP soft stepping settings for optimal pop performance at power up
74+
// Rpop used is 6k with N = 6 and soft step = 20usec. This should work with 47uF coupling
75+
// capacitor. Can try N=5,6 or 7 time constants as well. Trade-off delay vs “pop” sound.
76+
aic3204_reg_write(AIC3204_HP_START, 0x25) == 0 &&
77+
// Route Left DAC to HPL
78+
aic3204_reg_write(AIC3204_HPL_ROUTE, 0x08) == 0 &&
79+
// Route Right DAC to HPR
80+
aic3204_reg_write(AIC3204_HPR_ROUTE, 0x08) == 0 &&
81+
// We are using Line input with low gain for PGA so can use 40k input R but lets stick to 20k for now.
82+
// Route IN2_L to LEFT_P with 20K input impedance
83+
aic3204_reg_write(AIC3204_LPGA_P_ROUTE, 0x20) == 0 &&
84+
// Route IN2_R to LEFT_M with 20K input impedance
85+
aic3204_reg_write(AIC3204_LPGA_N_ROUTE, 0x20) == 0 &&
86+
// Route IN1_R to RIGHT_P with 20K input impedance
87+
aic3204_reg_write(AIC3204_RPGA_P_ROUTE, 0x80) == 0 &&
88+
// Route IN1_L to RIGHT_M with 20K input impedance
89+
aic3204_reg_write(AIC3204_RPGA_N_ROUTE, 0x20) == 0 &&
90+
// Unmute HPL and set gain to 0dB
91+
aic3204_reg_write(AIC3204_HPL_GAIN, 0x00) == 0 &&
92+
// Unmute HPR and set gain to 0dB
93+
aic3204_reg_write(AIC3204_HPR_GAIN, 0x00) == 0 &&
94+
// Unmute Left MICPGA, Set Gain to 0dB.
95+
aic3204_reg_write(AIC3204_LPGA_VOL, 0x00) == 0 &&
96+
// Unmute Right MICPGA, Set Gain to 0dB.
97+
aic3204_reg_write(AIC3204_RPGA_VOL, 0x00) == 0 &&
98+
// Power up HPL and HPR drivers
99+
aic3204_reg_write(AIC3204_OP_PWR_CTRL, 0x30) == 0
100+
)
101+
{
102+
// Wait for 2.5 sec for soft stepping to take effect
103+
aic3204_wait(2500);
104+
}
105+
else
106+
{
107+
return -1;
108+
}
109+
110+
if (
111+
//
112+
// Power Up DAC/ADC
113+
// ----------------
114+
//
115+
// Select Page 0
116+
aic3204_reg_write(AIC3204_PAGE_CTRL, 0x00) == 0 &&
117+
// Power up the Left and Right DAC Channels. Route Left data to Left DAC and Right data to Right DAC.
118+
// DAC Vol control soft step 1 step per DAC word clock.
119+
aic3204_reg_write(AIC3204_DAC_CH_SET1, 0xd4) == 0 &&
120+
// Power up Left and Right ADC Channels, ADC vol ctrl soft step 1 step per ADC word clock.
121+
aic3204_reg_write(AIC3204_ADC_CH_SET, 0xc0) == 0 &&
122+
// Unmute Left and Right DAC digital volume control
123+
aic3204_reg_write(AIC3204_DAC_CH_SET2, 0x00) == 0 &&
124+
// Unmute Left and Right ADC Digital Volume Control.
125+
aic3204_reg_write(AIC3204_ADC_FGA_MUTE, 0x00) == 0
126+
)
127+
{
128+
return 0;
129+
}
130+
else
131+
{
132+
return -1;
133+
}
134+
}

0 commit comments

Comments
 (0)