diff --git a/dis10_lab2.1A b/dis10_lab2.1A
deleted file mode 160000
index 84afbb3..0000000
--- a/dis10_lab2.1A
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 84afbb3b5b5cfdf2fc04355fe0a514696bd7db3e
diff --git a/dis10_lab2.1A/.ccsproject b/dis10_lab2.1A/.ccsproject
new file mode 100644
index 0000000..8ed2f71
--- /dev/null
+++ b/dis10_lab2.1A/.ccsproject
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dis10_lab2.1A/.cproject b/dis10_lab2.1A/.cproject
new file mode 100644
index 0000000..3ff00cd
--- /dev/null
+++ b/dis10_lab2.1A/.cproject
@@ -0,0 +1,248 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dis10_lab2.1A/.gitignore b/dis10_lab2.1A/.gitignore
new file mode 100644
index 0000000..7c1916f
--- /dev/null
+++ b/dis10_lab2.1A/.gitignore
@@ -0,0 +1,2 @@
+/MCU+Image/
+/Debug/
diff --git a/dis10_lab2.1A/.launches/dis10_lab2.1A.launch b/dis10_lab2.1A/.launches/dis10_lab2.1A.launch
new file mode 100644
index 0000000..cbcf282
--- /dev/null
+++ b/dis10_lab2.1A/.launches/dis10_lab2.1A.launch
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dis10_lab2.1A/.launches/line_in_2_line_out.launch b/dis10_lab2.1A/.launches/line_in_2_line_out.launch
new file mode 100644
index 0000000..e08bac4
--- /dev/null
+++ b/dis10_lab2.1A/.launches/line_in_2_line_out.launch
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dis10_lab2.1A/.project b/dis10_lab2.1A/.project
new file mode 100644
index 0000000..57ab0ae
--- /dev/null
+++ b/dis10_lab2.1A/.project
@@ -0,0 +1,34 @@
+
+
+ dis10_lab2.1A
+
+
+
+
+
+ org.eclipse.cdt.managedbuilder.core.genmakebuilder
+
+
+
+
+ org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
+ full,incremental,
+
+
+
+
+
+ com.ti.ccstudio.core.ccsNature
+ org.eclipse.cdt.core.cnature
+ org.eclipse.cdt.managedbuilder.core.managedBuildNature
+ org.eclipse.cdt.core.ccnature
+ org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
+
+
+
+ Board.html
+ 1
+ COM_TI_SIMPLELINK_CC32XX_SDK_INSTALL_DIR/source/ti/boards/CC3220S_LAUNCHXL/Board.html
+
+
+
diff --git a/dis10_lab2.1A/.settings/org.eclipse.cdt.codan.core.prefs b/dis10_lab2.1A/.settings/org.eclipse.cdt.codan.core.prefs
new file mode 100644
index 0000000..98b6350
--- /dev/null
+++ b/dis10_lab2.1A/.settings/org.eclipse.cdt.codan.core.prefs
@@ -0,0 +1,3 @@
+eclipse.preferences.version=1
+inEditor=false
+onBuild=false
diff --git a/dis10_lab2.1A/.settings/org.eclipse.cdt.debug.core.prefs b/dis10_lab2.1A/.settings/org.eclipse.cdt.debug.core.prefs
new file mode 100644
index 0000000..58d4fb2
--- /dev/null
+++ b/dis10_lab2.1A/.settings/org.eclipse.cdt.debug.core.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+org.eclipse.cdt.debug.core.toggleBreakpointModel=com.ti.ccstudio.debug.CCSBreakpointMarker
diff --git a/dis10_lab2.1A/.settings/org.eclipse.core.resources.prefs b/dis10_lab2.1A/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..7c051cc
--- /dev/null
+++ b/dis10_lab2.1A/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,6 @@
+eclipse.preferences.version=1
+encoding//Debug/makefile=UTF-8
+encoding//Debug/objects.mk=UTF-8
+encoding//Debug/sources.mk=UTF-8
+encoding//Debug/subdir_rules.mk=UTF-8
+encoding//Debug/subdir_vars.mk=UTF-8
diff --git a/dis10_lab2.1A/audio.syscfg b/dis10_lab2.1A/audio.syscfg
new file mode 100644
index 0000000..1ce1557
--- /dev/null
+++ b/dis10_lab2.1A/audio.syscfg
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2018-2021, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of Texas Instruments Incorporated nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+// @cliArgs --board /ti/boards/CC3220S_LAUNCHXL --rtos nortos
+
+/*
+ * gpiointerrupt.syscfg
+ */
+/* ======== Boosterpacks ========= BroJZ 20220415*/
+const CC3200AUDBOOST = scripting.addHardware("/ti/boards/boosterpacks/CC3200AUDBOOST");
+
+/* ======== TIRTOS7 ======== */
+if (system.getRTOS() === "tirtos7") {
+ const tirtos7_release_syscfg_js = system.getScript("tirtos7_release.syscfg.js");
+}
+
+/**
+ * Import the modules used in this configuration.
+ */
+const I2C = scripting.addModule("/ti/drivers/I2C");
+const I2C1 = I2C.addInstance();
+const I2S = scripting.addModule("/ti/drivers/I2S");
+const I2S1 = I2S.addInstance();
+const RTOS = scripting.addModule("/ti/drivers/RTOS");
+
+/**
+ * Write custom configuration values to the imported modules.
+ */
+I2C1.$name = "CONFIG_I2C_0";
+I2C1.$hardware = system.deviceData.board.components.LP_I2C;
+
+I2S1.$name = "CONFIG_I2S_0";
+I2S1.interruptPriority = "2";
+I2S1.$hardware = CC3200AUDBOOST.components.CC3200AUDBOOST_I2S;
+
+const Power = scripting.addModule("/ti/drivers/Power", {}, false);
+Power.parkPins.$name = "ti_drivers_power_PowerCC32XXPins0";
+
+RTOS.name = "NoRTOS";
+
+/**
+ * Pinmux solution for unlocked pins/peripherals. This ensures that minor changes to the automatic solver in a future
+ * version of the tool will not impact the pinmux you originally saw. These lines can be completely deleted in order to
+ * re-solve from scratch.
+ */
+I2C1.i2c.$suggestSolution = "I2C0";
+I2C1.i2c.sdaPin.$suggestSolution = "boosterpack.10";
+I2C1.i2c.sclPin.$suggestSolution = "boosterpack.9";
+I2S1.i2s.$suggestSolution = "McASP0";
+I2S1.i2s.SD0Pin.$suggestSolution = "boosterpack.29";
+I2S1.i2s.SD1Pin.$suggestSolution = "boosterpack.30";
+I2S1.i2s.SCKPin.$suggestSolution = "boosterpack.28";
+I2S1.i2s.WSPin.$suggestSolution = "boosterpack.27";
+I2S1.i2s.dmaRxChannel.$suggestSolution = "UDMA_CH18";
+I2S1.i2s.dmaTxChannel.$suggestSolution = "UDMA_CH19";
diff --git a/dis10_lab2.1A/berekeningen klokinstellingen codec.xlsx b/dis10_lab2.1A/berekeningen klokinstellingen codec.xlsx
new file mode 100644
index 0000000..304dcbd
Binary files /dev/null and b/dis10_lab2.1A/berekeningen klokinstellingen codec.xlsx differ
diff --git a/dis10_lab2.1A/cc32xxs_nortos.cmd b/dis10_lab2.1A/cc32xxs_nortos.cmd
new file mode 100644
index 0000000..4e6d27a
--- /dev/null
+++ b/dis10_lab2.1A/cc32xxs_nortos.cmd
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2018-2020, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of Texas Instruments Incorporated nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+--stack_size=0x1000
+--heap_size=0x8000
+--entry_point=resetISR
+--diag_suppress=10063 /* suppress warning about non _c_int00 entry point */
+
+/*
+ * The starting address of the application. Normally the interrupt vectors
+ * must be located at the beginning of the application.
+ */
+#define SRAM_BASE 0x20004000
+#define SRAM2_BASE 0x20000000
+
+MEMORY
+{
+ SRAM (RWX) : origin = 0x20004000, length = 0x00040000 - 0x4000
+ SRAM2 (RWX) : origin = 0x20000000, length = 0x4000
+ /* Explicitly placed off target for the storage of logging data.
+ * The data placed here is NOT loaded onto the target device.
+ * This is part of 1 GB of external memory from 0x60000000 - 0x9FFFFFFF.
+ * ARM memory map can be found here:
+ * https://developer.arm.com/documentation/ddi0337/e/memory-map/about-the-memory-map
+ */
+ LOG_DATA (R) : origin = 0x90000000, length = 0x40000
+}
+
+/* Section allocation in memory */
+
+SECTIONS
+{
+ .text : > SRAM
+ .TI.ramfunc : > SRAM
+ .const : > SRAM
+ .rodata : > SRAM
+ .cinit : > SRAM
+ .pinit : > SRAM
+ .init_array : > SRAM
+
+ .data : > SRAM
+ .bss : > SRAM
+ .sysmem : > SRAM
+ .stack : > SRAM2(HIGH)
+
+ .resetVecs : > SRAM_BASE
+ .ramVecs : > SRAM2_BASE, type=NOLOAD
+
+ .log_data : > LOG_DATA, type = COPY
+}
diff --git a/dis10_lab2.1A/config.c b/dis10_lab2.1A/config.c
new file mode 100644
index 0000000..af9798e
--- /dev/null
+++ b/dis10_lab2.1A/config.c
@@ -0,0 +1,289 @@
+/*
+ * Configure functions to use the TI TLV320AIC3254 codec on the
+ * CC3200AUDBOOST board with the CC3220S-LAUNCHXL board
+ * without using DMA.
+ *
+ * Copyright (C) 2018, Hogeschool Rotterdam, Harry Broeders
+ * All rights reserved.
+ *
+ * Based on Driver for TI TLV320AIC3110 CODEC
+ * Copyright (C) 2015-2017 Texas Instruments Incorporated - http://www.ti.com/
+ * All rights reserved.
+ */
+
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+
+#include "config.h"
+
+// Configure an I2C connection using the TI I2C driver.
+
+I2C_Handle ConfigureI2C(uint_least8_t index, I2C_BitRate bitRate)
+{
+ I2C_Handle i2cHandle;
+ I2C_Params i2cParams;
+ I2C_init();
+ I2C_Params_init(&i2cParams);
+ i2cParams.bitRate = bitRate;
+ i2cHandle = I2C_open(index, &i2cParams);
+ if (i2cHandle == NULL) {
+ // Error initializing I2C.
+ while (1);
+ }
+ return i2cHandle;
+}
+
+// Configure an I2S connection which is use to send/receive samples to/from the codec.
+
+void ConfigureI2S(unsigned long peripheral, unsigned long base, unsigned int samplingFrequency)
+{
+ // Register power dependency. Keeps the I2S clock running in SLP and DSLP modes.
+ int_fast16_t ret = Power_setDependency(PowerCC32XX_PERIPH_I2S);
+ if (ret != Power_SOK) {
+ // Error setting power dependency.
+ while (1);
+ }
+
+ // There is no TI I2S driver (without DMA) available so the TI driverlib API is used.
+ PRCMPeripheralReset(peripheral);
+ I2SEnable(base, I2S_MODE_TX_RX_SYNC);
+
+ unsigned int bitClock = samplingFrequency * 16 * 2;
+ PRCMI2SClockFreqSet(bitClock);
+ I2SConfigSetExpClk(base, bitClock, bitClock, I2S_MODE_MASTER | I2S_SLOT_SIZE_16 | I2S_PORT_CPU);
+
+ I2SSerializerConfig(base, I2S_DATA_LINE_0, I2S_SER_MODE_TX, I2S_INACT_LOW_LEVEL);
+ I2SSerializerConfig(base, I2S_DATA_LINE_1, I2S_SER_MODE_RX, I2S_INACT_LOW_LEVEL);
+
+ // Configure I2S pins in pin mux
+ PinTypeI2S(PIN_64, PIN_MODE_7); // xr0Pin = I2S SDout (CC3220S-LAUNCHXL) = DIN_J3 (CC3200AUDBOOST)
+ PinTypeI2S(PIN_50, PIN_MODE_6); // xr1Pin = I2S SDin (CC3220S-LAUNCHXL) = DOUT_J3 (CC3200AUDBOOST)
+ PinTypeI2S(PIN_53, PIN_MODE_2); // clkPin = I2S SCLK (CC3220S-LAUNCHXL) = BCLK_J3 (CC3200AUDBOOST)
+ PinTypeI2S(PIN_63, PIN_MODE_7); // fsxPin = I2S WC (CC3220S-LAUNCHXL) = FSYNC_J3 (CC3200AUDBOOST)
+
+ PRCMPeripheralClkEnable(peripheral, PRCM_RUN_MODE_CLK);
+}
+
+#define CODEC_I2C_SLAVE_ADDR ((0x30 >> 1))
+
+static uint8_t CodecRegRead(I2C_Handle i2cHandle, uint8_t regAddr)
+{
+ I2C_Transaction i2cTransaction;
+ uint8_t data;
+
+ i2cTransaction.slaveAddress = CODEC_I2C_SLAVE_ADDR;
+ i2cTransaction.writeBuf = ®Addr;
+ i2cTransaction.writeCount = 1;
+ i2cTransaction.readBuf = &data;
+ i2cTransaction.readCount = 1;
+ if (!I2C_transfer(i2cHandle, &i2cTransaction))
+ {
+ // I2C transfer failed
+ while (1);
+ }
+ return data;
+}
+
+static void CodecRegWrite(I2C_Handle i2cHandle, uint8_t regAddr, uint8_t regValue)
+{
+ uint8_t data[2];
+ I2C_Transaction i2cTransaction;
+
+ data[0] = regAddr;
+ data[1] = regValue;
+
+ i2cTransaction.slaveAddress = CODEC_I2C_SLAVE_ADDR;
+ i2cTransaction.writeBuf = &data[0];
+ i2cTransaction.writeCount = 2;
+ i2cTransaction.readBuf = NULL;
+ i2cTransaction.readCount = 0;
+ if (!I2C_transfer(i2cHandle, &i2cTransaction))
+ {
+ // I2C transfer failed
+ while (1);
+ }
+}
+
+static void CodecPageSelect(I2C_Handle i2cHandle, unsigned long pageAddress)
+{
+ CodecRegWrite(i2cHandle, 0, pageAddress);
+}
+
+static void CodecReset(I2C_Handle i2cHandle)
+{
+ // Select page 0.
+ CodecPageSelect(i2cHandle, 0);
+ // Soft RESET.
+ CodecRegWrite(i2cHandle, 1, 0x01);
+ // Wait for 27000 * 3 = 81000 clock cycles @ 80 MHz ~ 1 ms.
+ UtilsDelay(27000);
+}
+
+// volume: 0 -> 0 bB (Highest) to 116 -> -72.3 dB (Lowest)
+void AudioVolumeControl(I2C_Handle i2cHandle, signed char volume)
+{
+ // Select page 1
+ CodecPageSelect(i2cHandle, 1);
+ // Enable HPL output analog volume
+ CodecRegWrite(i2cHandle, 22, volume);
+ CodecRegWrite(i2cHandle, 23, volume);
+}
+
+void CodecMute(I2C_Handle i2cHandle)
+{
+ // Select page 0.
+ CodecPageSelect(i2cHandle, 0);
+ // Mute.
+ CodecRegWrite(i2cHandle, 64, 0x0C);
+}
+
+void CodecUnmute(I2C_Handle i2cHandle)
+{
+ // Select page 0.
+ CodecPageSelect(i2cHandle, 0);
+ // Unmute.
+ CodecRegWrite(i2cHandle, 64, 0x00);
+}
+
+// Codec configure:
+ // PGA (Programmable Gain Amplifier) = 0 dB.
+ // Headphone Output = enabled.
+ // Line outputs (to class D amplifier) = disabled.
+ // ADC gain = 0 dB.
+ // AGC (Automatic Gain Control) = disabled.
+ // ADC processing block = PRB_R1 (default).
+ // Microphone = disabled.
+ // DAC processing block = PRB_P1 (default).
+ // DRC (Dynamic Gain Compression) = disabled.
+
+void ConfigureAudioCodec(I2C_Handle i2cHandle, unsigned int samplingFrequency)
+{
+ // Check parameter.
+ if (samplingFrequency < 8000 || samplingFrequency > 48000 || samplingFrequency % 4000 != 0)
+ {
+ while(1);
+ // Wrong value for sampling frequency.
+ }
+ size_t sampleIndex = (samplingFrequency / 4000) - 2;
+ // values for DOSR, MDAC, NDAC, NADC and J in steps of 4 kHz starting from 8 kHz to 48 kHz.
+ // 8 12 16 20 24 28 32 36 40 44 48
+ int DOSR[] = {512, 512, 384, 304, 256, 208, 192, 160, 144, 128, 128};
+ int MDAC[] = { 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2};
+ int NDAC[] = { 1, 1, 2, 16, 8, 8, 8, 8, 8, 8, 8};
+ int NADC[] = { 2, 2, 3, 19, 16, 13, 12, 10, 9, 8, 8};
+ int J[] = { 4, 4, 6, 38, 32, 26, 24, 20, 18, 16, 16};
+
+ // Reset code for startup.
+ CodecReset(i2cHandle);
+
+ // Select page 0.
+ CodecPageSelect(i2cHandle, 0);
+
+ // Set I2S Mode and Word Length = 16 bits, BCLK and WCLK are inputs to the device.
+ CodecRegWrite(i2cHandle, 27, 0x00);
+ // Clock settings chip
+ CodecRegWrite(i2cHandle, 4, 0x03); // PLL CLock is CODEC_CLKIN
+ CodecRegWrite(i2cHandle, 5, 0x94); // PLL enabled, P = 1, R = 4
+ CodecRegWrite(i2cHandle, 6, J[sampleIndex]); // PLL J
+ CodecRegWrite(i2cHandle, 7, 0); // PLL D = 0
+ CodecRegWrite(i2cHandle, 8, 0); // PLL D = 0
+ // PLL_CLK = PLL_CLKIN * R * J.D / P = PLL_CLKIN * 4 * J = (Fs * 32) * 4 * J
+
+ // Clock settings DAC.
+ CodecRegWrite(i2cHandle, 11, 0x80 + NDAC[sampleIndex]); // NDAC is powered up
+ CodecRegWrite(i2cHandle, 12, 0x80 + MDAC[sampleIndex]); // MDAC is powered up
+ CodecRegWrite(i2cHandle, 13, DOSR[sampleIndex] / 256); // DOSR
+ CodecRegWrite(i2cHandle, 14, DOSR[sampleIndex] % 256);
+ // DAC_fs = CODEC_CLKIN / (NDAC * MDAC * DOSR)
+
+ // Clock settings ADC.
+ CodecRegWrite(i2cHandle, 18, 0x80 + NADC[sampleIndex]); // NADC is powered up, NADC = 2
+ CodecRegWrite(i2cHandle, 19, 0x80 + 2); // MADC is powered up, MADC = 2
+ CodecRegWrite(i2cHandle, 20, 128); // AOSR = 128
+ // ADC_fs = CODEC_CLKIN / (NADC * MADC * AOSR)
+
+ // Configure power supplies.
+ CodecPageSelect(i2cHandle, 1);
+ CodecRegWrite(i2cHandle, 1, 0x08); // AVdd and DVdd are connected
+ CodecRegWrite(i2cHandle, 2, 0x01); // LDO enabled AVDD LDO output = 1.72 V
+ CodecRegWrite(i2cHandle, 71, 0x32); // Aanalog input powerup = 6.4 ms
+ CodecRegWrite(i2cHandle, 123, 0x01); // Reference powered up in 40 ms
+
+ // Configure ADC channel.
+ // Route IN1L to Left MICPGA with 10K input impedance.
+ CodecRegWrite(i2cHandle, 52, 0x40);
+ // Route CM to Left MICPGA with 10K input impedance.
+ CodecRegWrite(i2cHandle, 54, 0x40);
+ // Route IN1R to Right MICPGA with 10K input impedance.
+ CodecRegWrite(i2cHandle, 55, 0x40);
+ // Route CM to Right MICPGA with 10K input impedance.
+ CodecRegWrite(i2cHandle, 57,0x40);
+ // Floating IN1L.
+ CodecRegWrite(i2cHandle, 58, 0xC0);
+
+ // Select Page 0.
+ CodecPageSelect(i2cHandle, 0);
+ // Power up LADC/RADC.
+ CodecRegWrite(i2cHandle, 81, 0xC0);
+ // Unmute LADC/RADC.
+ CodecRegWrite(i2cHandle, 82, 0x00);
+
+ // Configure DAC channel.
+ // Select Page 1.
+ CodecPageSelect(i2cHandle, 1);
+
+ // De-pop: soft stepping disabled, N = 5, Rpop = 6k. See SLAA408A page 11,12,13.
+ CodecRegWrite(i2cHandle, 20, 0x25);
+
+ // Route LDAC/RDAC to HPL/HPR.
+ CodecRegWrite(i2cHandle, 12, 0x08);
+ CodecRegWrite(i2cHandle, 13, 0x08);
+
+ // Power up HPL/HPR drivers.
+ CodecRegWrite(i2cHandle, 9, 0x30);
+
+ // Unmute HPL/HPR driver, 0dB Gain.
+ CodecRegWrite(i2cHandle, 16, 0x00);
+ CodecRegWrite(i2cHandle, 17, 0x00);
+
+ // Select Page 0.
+ CodecPageSelect(i2cHandle, 0);
+
+ // Unmute DAC, 0dB Gain.
+ CodecRegWrite(i2cHandle, 65, 0x00);
+ CodecRegWrite(i2cHandle, 66, 0x00);
+
+ // Select Page 1.
+ CodecPageSelect(i2cHandle, 1);
+
+ while (CodecRegRead(i2cHandle, 63) & 0x11000000 != 0x11000000)
+ {
+ UtilsDelay(27000); // delay 27000 * 3 = 81000 clock cycles @ 80 MHz ~ 1 ms.
+ }
+
+ // Select Page 0.
+ CodecPageSelect(i2cHandle, 0);
+
+ // Power up LDAC/RDAC.
+ CodecRegWrite(i2cHandle, 63, 0xd4);
+
+ // Unmute LDAC/RDAC.
+ CodecRegWrite(i2cHandle, 64, 0x00);
+}
diff --git a/dis10_lab2.1A/config.h b/dis10_lab2.1A/config.h
new file mode 100644
index 0000000..bfaa628
--- /dev/null
+++ b/dis10_lab2.1A/config.h
@@ -0,0 +1,41 @@
+/*
+ * Configure functions to use the TI TLV320AIC3254 codec on the
+ * CC3200AUDBOOST board with the CC3220S-LAUNCHXL board
+ * without using DMA.
+ *
+ * Copyright (C) 2018, Hogeschool Rotterdam, Harry Broeders
+ * All rights reserved.
+ *
+ * Based on Driver for TI TLV320AIC3110 codec
+ * Copyright (C) 2015-2017 Texas Instruments Incorporated - http://www.ti.com/
+ * All rights reserved.
+ */
+#ifndef __HR_CONFIG_H__
+#define __HR_CONFIG_H__
+
+#include
+
+// Configure an I2C connection using the TI I2C driver.
+extern I2C_Handle ConfigureI2C(uint_least8_t index, I2C_BitRate bitRate);
+
+// Configure an I2S connection using the TI driverlib API.
+extern void ConfigureI2S(unsigned long peripheral, unsigned long base, unsigned int samplingFrequency);
+
+// Functions to configure the codec using an I2C connection
+// volume: 0 -> 0 bB (Highest) to 116 -> -72.3 dB (Lowest)
+extern void AudioVolumeControl(I2C_Handle i2cHandle, signed char volume);
+extern void CodecMute(I2C_Handle i2cHandle);
+extern void CodecUnmute(I2C_Handle i2cHandle);
+// Codec configure:
+ // PGA (Programmable Gain Amplifier) = 0 dB.
+ // Headphone Output = enabled.
+ // Line outputs (to class D amplifier) = disabled.
+ // ADC gain = 0 dB.
+ // AGC (Automatic Gain Control) = disabled.
+ // ADC processing block = PRB_R1 (default).
+ // Microphone = disabled.
+ // DAC processing block = PRB_P1 (default).
+ // DRC (Dynamic Gain Compression) = disabled.
+extern void ConfigureAudioCodec(I2C_Handle i2cHandle, unsigned int samplingFrequency);
+
+#endif
diff --git a/dis10_lab2.1A/main_nortos.c b/dis10_lab2.1A/main_nortos.c
new file mode 100644
index 0000000..3e9fecf
--- /dev/null
+++ b/dis10_lab2.1A/main_nortos.c
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2018, Hogeschool Rotterdam, Harry Broeders
+ * All rights reserved.
+ */
+
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+
+#include "ti_drivers_config.h"
+#include "config.h"
+
+// You can select the sample rate here:
+#define SAMPLINGFREQUENCY 8000
+#if SAMPLINGFREQUENCY < 8000 || SAMPLINGFREQUENCY > 48000 || SAMPLINGFREQUENCY % 4000 != 0
+#error Sampling Frequency must be between 8 kHz and 48 kHz (included) and must be a multiple of 4 kHz.
+#endif
+
+#define N 15
+
+#define BL 15
+const float B[15] = { -0.03215415403, -0.0530516468, -0.04501581565,
+ 9.745429214e-18, 0.07502636313, 0.1591549367,
+ 0.2250790745, 0.25, 0.2250790745, 0.1591549367,
+ 0.07502636313, 9.745429214e-18, -0.04501581565,
+ -0.0530516468, -0.03215415403 };
+
+
+float buffer_R[N] = { 0 };
+
+int main(void)
+{
+ // Init CC3220S LAUNCHXL board.
+ Board_initGeneral();
+ // Prepare to use TI drivers without operating system.
+ NoRTOS_start();
+
+ printf("line-in_2_line_out: STEREO LINE IN ==> HP LINE OUT.\n");
+ printf("Sampling frequency = %d Hz.\n", SAMPLINGFREQUENCY);
+
+ // Configure an I2C connection which is used to configure the audio codec.
+ I2C_Handle i2cHandle = ConfigureI2C(CONFIG_I2C_0, I2C_400kHz);
+ // Configure the audio codec.
+ ConfigureAudioCodec(i2cHandle, SAMPLINGFREQUENCY);
+
+ // Configure an I2S connection which is use to send/receive samples to/from the codec.
+ ConfigureI2S(CONFIG_I2S_0, I2S_BASE, SAMPLINGFREQUENCY);
+ int16_t dataLeft, dataRight;
+ int k;
+ int i;
+ while (1)
+ {
+ float outR;
+ // The 16-bit samples are stored in 32-bit variables because the API also supports 24-bit samples.
+ I2SDataGet(I2S_BASE, I2S_DATA_LINE_1, &dataLeft);
+ // You can process the 16-bit left sample here.
+ I2SDataPut(I2S_BASE, I2S_DATA_LINE_0, 0);
+ I2SDataGet(I2S_BASE, I2S_DATA_LINE_1, &dataRight);
+ buffer_R[0] = dataRight;
+ outR = 0;
+ for (k = 0; k < BL; k++){
+ outR += B[k] * buffer_R[k];
+ }
+ for (i = BL - 1; i >= 1; i--){
+ buffer_R[i] = buffer_R[i - 1];
+ }
+ // You can process the 16-bit right sample here.
+ I2SDataPut(I2S_BASE, I2S_DATA_LINE_0, outR);
+
+ }
+ return 0;
+}
diff --git a/dis10_lab2.1A/targetConfigs/CC3220S.ccxml b/dis10_lab2.1A/targetConfigs/CC3220S.ccxml
new file mode 100644
index 0000000..ae9589d
--- /dev/null
+++ b/dis10_lab2.1A/targetConfigs/CC3220S.ccxml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dis10_lab2.1A/targetConfigs/readme.txt b/dis10_lab2.1A/targetConfigs/readme.txt
new file mode 100644
index 0000000..af97b62
--- /dev/null
+++ b/dis10_lab2.1A/targetConfigs/readme.txt
@@ -0,0 +1,9 @@
+The 'targetConfigs' folder contains target-configuration (.ccxml) files, automatically generated based
+on the device and connection settings specified in your project on the Properties > General page.
+
+Please note that in automatic target-configuration management, changes to the project's device and/or
+connection settings will either modify an existing or generate a new target-configuration file. Thus,
+if you manually edit these auto-generated files, you may need to re-apply your changes. Alternatively,
+you may create your own target-configuration file for this project and manage it manually. You can
+always switch back to automatic target-configuration management by checking the "Manage the project's
+target-configuration automatically" checkbox on the project's Properties > General page.
\ No newline at end of file
diff --git a/dis10_lab2.1B b/dis10_lab2.1B
deleted file mode 160000
index 75e408f..0000000
--- a/dis10_lab2.1B
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 75e408f7cf887aaba3715fa6db4b586455634873
diff --git a/dis10_lab2.1B/.ccsproject b/dis10_lab2.1B/.ccsproject
new file mode 100644
index 0000000..8ed2f71
--- /dev/null
+++ b/dis10_lab2.1B/.ccsproject
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dis10_lab2.1B/.cproject b/dis10_lab2.1B/.cproject
new file mode 100644
index 0000000..01503bb
--- /dev/null
+++ b/dis10_lab2.1B/.cproject
@@ -0,0 +1,372 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dis10_lab2.1B/.gitignore b/dis10_lab2.1B/.gitignore
new file mode 100644
index 0000000..7c1916f
--- /dev/null
+++ b/dis10_lab2.1B/.gitignore
@@ -0,0 +1,2 @@
+/MCU+Image/
+/Debug/
diff --git a/dis10_lab2.1B/.launches/dis10_4.2_2.1.launch b/dis10_lab2.1B/.launches/dis10_4.2_2.1.launch
new file mode 100644
index 0000000..cecaeb9
--- /dev/null
+++ b/dis10_lab2.1B/.launches/dis10_4.2_2.1.launch
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dis10_lab2.1B/.launches/dis10_4.2_2.2.launch b/dis10_lab2.1B/.launches/dis10_4.2_2.2.launch
new file mode 100644
index 0000000..81082fd
--- /dev/null
+++ b/dis10_lab2.1B/.launches/dis10_4.2_2.2.launch
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dis10_lab2.1B/.launches/dis10_4.3_3.2.launch b/dis10_lab2.1B/.launches/dis10_4.3_3.2.launch
new file mode 100644
index 0000000..63248ea
--- /dev/null
+++ b/dis10_lab2.1B/.launches/dis10_4.3_3.2.launch
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dis10_lab2.1B/.launches/dis10_4.3_3.3.launch b/dis10_lab2.1B/.launches/dis10_4.3_3.3.launch
new file mode 100644
index 0000000..671e413
--- /dev/null
+++ b/dis10_lab2.1B/.launches/dis10_4.3_3.3.launch
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dis10_lab2.1B/.launches/dis10_lab2.1B.launch b/dis10_lab2.1B/.launches/dis10_lab2.1B.launch
new file mode 100644
index 0000000..a3e8289
--- /dev/null
+++ b/dis10_lab2.1B/.launches/dis10_lab2.1B.launch
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dis10_lab2.1B/.launches/line_in_2_line_out.launch b/dis10_lab2.1B/.launches/line_in_2_line_out.launch
new file mode 100644
index 0000000..e08bac4
--- /dev/null
+++ b/dis10_lab2.1B/.launches/line_in_2_line_out.launch
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dis10_lab2.1B/.project b/dis10_lab2.1B/.project
new file mode 100644
index 0000000..0f9bb35
--- /dev/null
+++ b/dis10_lab2.1B/.project
@@ -0,0 +1,34 @@
+
+
+ dis10_lab2.1B
+
+
+
+
+
+ org.eclipse.cdt.managedbuilder.core.genmakebuilder
+
+
+
+
+ org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
+ full,incremental,
+
+
+
+
+
+ com.ti.ccstudio.core.ccsNature
+ org.eclipse.cdt.core.cnature
+ org.eclipse.cdt.managedbuilder.core.managedBuildNature
+ org.eclipse.cdt.core.ccnature
+ org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
+
+
+
+ Board.html
+ 1
+ COM_TI_SIMPLELINK_CC32XX_SDK_INSTALL_DIR/source/ti/boards/CC3220S_LAUNCHXL/Board.html
+
+
+
diff --git a/dis10_lab2.1B/.settings/org.eclipse.cdt.codan.core.prefs b/dis10_lab2.1B/.settings/org.eclipse.cdt.codan.core.prefs
new file mode 100644
index 0000000..98b6350
--- /dev/null
+++ b/dis10_lab2.1B/.settings/org.eclipse.cdt.codan.core.prefs
@@ -0,0 +1,3 @@
+eclipse.preferences.version=1
+inEditor=false
+onBuild=false
diff --git a/dis10_lab2.1B/.settings/org.eclipse.cdt.debug.core.prefs b/dis10_lab2.1B/.settings/org.eclipse.cdt.debug.core.prefs
new file mode 100644
index 0000000..58d4fb2
--- /dev/null
+++ b/dis10_lab2.1B/.settings/org.eclipse.cdt.debug.core.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+org.eclipse.cdt.debug.core.toggleBreakpointModel=com.ti.ccstudio.debug.CCSBreakpointMarker
diff --git a/dis10_lab2.1B/.settings/org.eclipse.core.resources.prefs b/dis10_lab2.1B/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..093dbb9
--- /dev/null
+++ b/dis10_lab2.1B/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,6 @@
+eclipse.preferences.version=1
+encoding//Debug/makefile=UTF-8
+encoding//Debug/objects.mk=UTF-8
+encoding//Debug/sources.mk=UTF-8
+encoding//Debug/subdir_rules.mk=UTF-8
+encoding//Debug/subdir_vars.mk=UTF-8
diff --git a/dis10_lab2.1B/Debug.tar b/dis10_lab2.1B/Debug.tar
new file mode 100644
index 0000000..35bb50c
Binary files /dev/null and b/dis10_lab2.1B/Debug.tar differ
diff --git a/dis10_lab2.1B/audio.syscfg b/dis10_lab2.1B/audio.syscfg
new file mode 100644
index 0000000..1ce1557
--- /dev/null
+++ b/dis10_lab2.1B/audio.syscfg
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2018-2021, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of Texas Instruments Incorporated nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+// @cliArgs --board /ti/boards/CC3220S_LAUNCHXL --rtos nortos
+
+/*
+ * gpiointerrupt.syscfg
+ */
+/* ======== Boosterpacks ========= BroJZ 20220415*/
+const CC3200AUDBOOST = scripting.addHardware("/ti/boards/boosterpacks/CC3200AUDBOOST");
+
+/* ======== TIRTOS7 ======== */
+if (system.getRTOS() === "tirtos7") {
+ const tirtos7_release_syscfg_js = system.getScript("tirtos7_release.syscfg.js");
+}
+
+/**
+ * Import the modules used in this configuration.
+ */
+const I2C = scripting.addModule("/ti/drivers/I2C");
+const I2C1 = I2C.addInstance();
+const I2S = scripting.addModule("/ti/drivers/I2S");
+const I2S1 = I2S.addInstance();
+const RTOS = scripting.addModule("/ti/drivers/RTOS");
+
+/**
+ * Write custom configuration values to the imported modules.
+ */
+I2C1.$name = "CONFIG_I2C_0";
+I2C1.$hardware = system.deviceData.board.components.LP_I2C;
+
+I2S1.$name = "CONFIG_I2S_0";
+I2S1.interruptPriority = "2";
+I2S1.$hardware = CC3200AUDBOOST.components.CC3200AUDBOOST_I2S;
+
+const Power = scripting.addModule("/ti/drivers/Power", {}, false);
+Power.parkPins.$name = "ti_drivers_power_PowerCC32XXPins0";
+
+RTOS.name = "NoRTOS";
+
+/**
+ * Pinmux solution for unlocked pins/peripherals. This ensures that minor changes to the automatic solver in a future
+ * version of the tool will not impact the pinmux you originally saw. These lines can be completely deleted in order to
+ * re-solve from scratch.
+ */
+I2C1.i2c.$suggestSolution = "I2C0";
+I2C1.i2c.sdaPin.$suggestSolution = "boosterpack.10";
+I2C1.i2c.sclPin.$suggestSolution = "boosterpack.9";
+I2S1.i2s.$suggestSolution = "McASP0";
+I2S1.i2s.SD0Pin.$suggestSolution = "boosterpack.29";
+I2S1.i2s.SD1Pin.$suggestSolution = "boosterpack.30";
+I2S1.i2s.SCKPin.$suggestSolution = "boosterpack.28";
+I2S1.i2s.WSPin.$suggestSolution = "boosterpack.27";
+I2S1.i2s.dmaRxChannel.$suggestSolution = "UDMA_CH18";
+I2S1.i2s.dmaTxChannel.$suggestSolution = "UDMA_CH19";
diff --git a/dis10_lab2.1B/berekeningen klokinstellingen codec.xlsx b/dis10_lab2.1B/berekeningen klokinstellingen codec.xlsx
new file mode 100644
index 0000000..304dcbd
Binary files /dev/null and b/dis10_lab2.1B/berekeningen klokinstellingen codec.xlsx differ
diff --git a/dis10_lab2.1B/cc32xxs_nortos.cmd b/dis10_lab2.1B/cc32xxs_nortos.cmd
new file mode 100644
index 0000000..4e6d27a
--- /dev/null
+++ b/dis10_lab2.1B/cc32xxs_nortos.cmd
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2018-2020, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of Texas Instruments Incorporated nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+--stack_size=0x1000
+--heap_size=0x8000
+--entry_point=resetISR
+--diag_suppress=10063 /* suppress warning about non _c_int00 entry point */
+
+/*
+ * The starting address of the application. Normally the interrupt vectors
+ * must be located at the beginning of the application.
+ */
+#define SRAM_BASE 0x20004000
+#define SRAM2_BASE 0x20000000
+
+MEMORY
+{
+ SRAM (RWX) : origin = 0x20004000, length = 0x00040000 - 0x4000
+ SRAM2 (RWX) : origin = 0x20000000, length = 0x4000
+ /* Explicitly placed off target for the storage of logging data.
+ * The data placed here is NOT loaded onto the target device.
+ * This is part of 1 GB of external memory from 0x60000000 - 0x9FFFFFFF.
+ * ARM memory map can be found here:
+ * https://developer.arm.com/documentation/ddi0337/e/memory-map/about-the-memory-map
+ */
+ LOG_DATA (R) : origin = 0x90000000, length = 0x40000
+}
+
+/* Section allocation in memory */
+
+SECTIONS
+{
+ .text : > SRAM
+ .TI.ramfunc : > SRAM
+ .const : > SRAM
+ .rodata : > SRAM
+ .cinit : > SRAM
+ .pinit : > SRAM
+ .init_array : > SRAM
+
+ .data : > SRAM
+ .bss : > SRAM
+ .sysmem : > SRAM
+ .stack : > SRAM2(HIGH)
+
+ .resetVecs : > SRAM_BASE
+ .ramVecs : > SRAM2_BASE, type=NOLOAD
+
+ .log_data : > LOG_DATA, type = COPY
+}
diff --git a/dis10_lab2.1B/config.c b/dis10_lab2.1B/config.c
new file mode 100644
index 0000000..af9798e
--- /dev/null
+++ b/dis10_lab2.1B/config.c
@@ -0,0 +1,289 @@
+/*
+ * Configure functions to use the TI TLV320AIC3254 codec on the
+ * CC3200AUDBOOST board with the CC3220S-LAUNCHXL board
+ * without using DMA.
+ *
+ * Copyright (C) 2018, Hogeschool Rotterdam, Harry Broeders
+ * All rights reserved.
+ *
+ * Based on Driver for TI TLV320AIC3110 CODEC
+ * Copyright (C) 2015-2017 Texas Instruments Incorporated - http://www.ti.com/
+ * All rights reserved.
+ */
+
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+
+#include "config.h"
+
+// Configure an I2C connection using the TI I2C driver.
+
+I2C_Handle ConfigureI2C(uint_least8_t index, I2C_BitRate bitRate)
+{
+ I2C_Handle i2cHandle;
+ I2C_Params i2cParams;
+ I2C_init();
+ I2C_Params_init(&i2cParams);
+ i2cParams.bitRate = bitRate;
+ i2cHandle = I2C_open(index, &i2cParams);
+ if (i2cHandle == NULL) {
+ // Error initializing I2C.
+ while (1);
+ }
+ return i2cHandle;
+}
+
+// Configure an I2S connection which is use to send/receive samples to/from the codec.
+
+void ConfigureI2S(unsigned long peripheral, unsigned long base, unsigned int samplingFrequency)
+{
+ // Register power dependency. Keeps the I2S clock running in SLP and DSLP modes.
+ int_fast16_t ret = Power_setDependency(PowerCC32XX_PERIPH_I2S);
+ if (ret != Power_SOK) {
+ // Error setting power dependency.
+ while (1);
+ }
+
+ // There is no TI I2S driver (without DMA) available so the TI driverlib API is used.
+ PRCMPeripheralReset(peripheral);
+ I2SEnable(base, I2S_MODE_TX_RX_SYNC);
+
+ unsigned int bitClock = samplingFrequency * 16 * 2;
+ PRCMI2SClockFreqSet(bitClock);
+ I2SConfigSetExpClk(base, bitClock, bitClock, I2S_MODE_MASTER | I2S_SLOT_SIZE_16 | I2S_PORT_CPU);
+
+ I2SSerializerConfig(base, I2S_DATA_LINE_0, I2S_SER_MODE_TX, I2S_INACT_LOW_LEVEL);
+ I2SSerializerConfig(base, I2S_DATA_LINE_1, I2S_SER_MODE_RX, I2S_INACT_LOW_LEVEL);
+
+ // Configure I2S pins in pin mux
+ PinTypeI2S(PIN_64, PIN_MODE_7); // xr0Pin = I2S SDout (CC3220S-LAUNCHXL) = DIN_J3 (CC3200AUDBOOST)
+ PinTypeI2S(PIN_50, PIN_MODE_6); // xr1Pin = I2S SDin (CC3220S-LAUNCHXL) = DOUT_J3 (CC3200AUDBOOST)
+ PinTypeI2S(PIN_53, PIN_MODE_2); // clkPin = I2S SCLK (CC3220S-LAUNCHXL) = BCLK_J3 (CC3200AUDBOOST)
+ PinTypeI2S(PIN_63, PIN_MODE_7); // fsxPin = I2S WC (CC3220S-LAUNCHXL) = FSYNC_J3 (CC3200AUDBOOST)
+
+ PRCMPeripheralClkEnable(peripheral, PRCM_RUN_MODE_CLK);
+}
+
+#define CODEC_I2C_SLAVE_ADDR ((0x30 >> 1))
+
+static uint8_t CodecRegRead(I2C_Handle i2cHandle, uint8_t regAddr)
+{
+ I2C_Transaction i2cTransaction;
+ uint8_t data;
+
+ i2cTransaction.slaveAddress = CODEC_I2C_SLAVE_ADDR;
+ i2cTransaction.writeBuf = ®Addr;
+ i2cTransaction.writeCount = 1;
+ i2cTransaction.readBuf = &data;
+ i2cTransaction.readCount = 1;
+ if (!I2C_transfer(i2cHandle, &i2cTransaction))
+ {
+ // I2C transfer failed
+ while (1);
+ }
+ return data;
+}
+
+static void CodecRegWrite(I2C_Handle i2cHandle, uint8_t regAddr, uint8_t regValue)
+{
+ uint8_t data[2];
+ I2C_Transaction i2cTransaction;
+
+ data[0] = regAddr;
+ data[1] = regValue;
+
+ i2cTransaction.slaveAddress = CODEC_I2C_SLAVE_ADDR;
+ i2cTransaction.writeBuf = &data[0];
+ i2cTransaction.writeCount = 2;
+ i2cTransaction.readBuf = NULL;
+ i2cTransaction.readCount = 0;
+ if (!I2C_transfer(i2cHandle, &i2cTransaction))
+ {
+ // I2C transfer failed
+ while (1);
+ }
+}
+
+static void CodecPageSelect(I2C_Handle i2cHandle, unsigned long pageAddress)
+{
+ CodecRegWrite(i2cHandle, 0, pageAddress);
+}
+
+static void CodecReset(I2C_Handle i2cHandle)
+{
+ // Select page 0.
+ CodecPageSelect(i2cHandle, 0);
+ // Soft RESET.
+ CodecRegWrite(i2cHandle, 1, 0x01);
+ // Wait for 27000 * 3 = 81000 clock cycles @ 80 MHz ~ 1 ms.
+ UtilsDelay(27000);
+}
+
+// volume: 0 -> 0 bB (Highest) to 116 -> -72.3 dB (Lowest)
+void AudioVolumeControl(I2C_Handle i2cHandle, signed char volume)
+{
+ // Select page 1
+ CodecPageSelect(i2cHandle, 1);
+ // Enable HPL output analog volume
+ CodecRegWrite(i2cHandle, 22, volume);
+ CodecRegWrite(i2cHandle, 23, volume);
+}
+
+void CodecMute(I2C_Handle i2cHandle)
+{
+ // Select page 0.
+ CodecPageSelect(i2cHandle, 0);
+ // Mute.
+ CodecRegWrite(i2cHandle, 64, 0x0C);
+}
+
+void CodecUnmute(I2C_Handle i2cHandle)
+{
+ // Select page 0.
+ CodecPageSelect(i2cHandle, 0);
+ // Unmute.
+ CodecRegWrite(i2cHandle, 64, 0x00);
+}
+
+// Codec configure:
+ // PGA (Programmable Gain Amplifier) = 0 dB.
+ // Headphone Output = enabled.
+ // Line outputs (to class D amplifier) = disabled.
+ // ADC gain = 0 dB.
+ // AGC (Automatic Gain Control) = disabled.
+ // ADC processing block = PRB_R1 (default).
+ // Microphone = disabled.
+ // DAC processing block = PRB_P1 (default).
+ // DRC (Dynamic Gain Compression) = disabled.
+
+void ConfigureAudioCodec(I2C_Handle i2cHandle, unsigned int samplingFrequency)
+{
+ // Check parameter.
+ if (samplingFrequency < 8000 || samplingFrequency > 48000 || samplingFrequency % 4000 != 0)
+ {
+ while(1);
+ // Wrong value for sampling frequency.
+ }
+ size_t sampleIndex = (samplingFrequency / 4000) - 2;
+ // values for DOSR, MDAC, NDAC, NADC and J in steps of 4 kHz starting from 8 kHz to 48 kHz.
+ // 8 12 16 20 24 28 32 36 40 44 48
+ int DOSR[] = {512, 512, 384, 304, 256, 208, 192, 160, 144, 128, 128};
+ int MDAC[] = { 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2};
+ int NDAC[] = { 1, 1, 2, 16, 8, 8, 8, 8, 8, 8, 8};
+ int NADC[] = { 2, 2, 3, 19, 16, 13, 12, 10, 9, 8, 8};
+ int J[] = { 4, 4, 6, 38, 32, 26, 24, 20, 18, 16, 16};
+
+ // Reset code for startup.
+ CodecReset(i2cHandle);
+
+ // Select page 0.
+ CodecPageSelect(i2cHandle, 0);
+
+ // Set I2S Mode and Word Length = 16 bits, BCLK and WCLK are inputs to the device.
+ CodecRegWrite(i2cHandle, 27, 0x00);
+ // Clock settings chip
+ CodecRegWrite(i2cHandle, 4, 0x03); // PLL CLock is CODEC_CLKIN
+ CodecRegWrite(i2cHandle, 5, 0x94); // PLL enabled, P = 1, R = 4
+ CodecRegWrite(i2cHandle, 6, J[sampleIndex]); // PLL J
+ CodecRegWrite(i2cHandle, 7, 0); // PLL D = 0
+ CodecRegWrite(i2cHandle, 8, 0); // PLL D = 0
+ // PLL_CLK = PLL_CLKIN * R * J.D / P = PLL_CLKIN * 4 * J = (Fs * 32) * 4 * J
+
+ // Clock settings DAC.
+ CodecRegWrite(i2cHandle, 11, 0x80 + NDAC[sampleIndex]); // NDAC is powered up
+ CodecRegWrite(i2cHandle, 12, 0x80 + MDAC[sampleIndex]); // MDAC is powered up
+ CodecRegWrite(i2cHandle, 13, DOSR[sampleIndex] / 256); // DOSR
+ CodecRegWrite(i2cHandle, 14, DOSR[sampleIndex] % 256);
+ // DAC_fs = CODEC_CLKIN / (NDAC * MDAC * DOSR)
+
+ // Clock settings ADC.
+ CodecRegWrite(i2cHandle, 18, 0x80 + NADC[sampleIndex]); // NADC is powered up, NADC = 2
+ CodecRegWrite(i2cHandle, 19, 0x80 + 2); // MADC is powered up, MADC = 2
+ CodecRegWrite(i2cHandle, 20, 128); // AOSR = 128
+ // ADC_fs = CODEC_CLKIN / (NADC * MADC * AOSR)
+
+ // Configure power supplies.
+ CodecPageSelect(i2cHandle, 1);
+ CodecRegWrite(i2cHandle, 1, 0x08); // AVdd and DVdd are connected
+ CodecRegWrite(i2cHandle, 2, 0x01); // LDO enabled AVDD LDO output = 1.72 V
+ CodecRegWrite(i2cHandle, 71, 0x32); // Aanalog input powerup = 6.4 ms
+ CodecRegWrite(i2cHandle, 123, 0x01); // Reference powered up in 40 ms
+
+ // Configure ADC channel.
+ // Route IN1L to Left MICPGA with 10K input impedance.
+ CodecRegWrite(i2cHandle, 52, 0x40);
+ // Route CM to Left MICPGA with 10K input impedance.
+ CodecRegWrite(i2cHandle, 54, 0x40);
+ // Route IN1R to Right MICPGA with 10K input impedance.
+ CodecRegWrite(i2cHandle, 55, 0x40);
+ // Route CM to Right MICPGA with 10K input impedance.
+ CodecRegWrite(i2cHandle, 57,0x40);
+ // Floating IN1L.
+ CodecRegWrite(i2cHandle, 58, 0xC0);
+
+ // Select Page 0.
+ CodecPageSelect(i2cHandle, 0);
+ // Power up LADC/RADC.
+ CodecRegWrite(i2cHandle, 81, 0xC0);
+ // Unmute LADC/RADC.
+ CodecRegWrite(i2cHandle, 82, 0x00);
+
+ // Configure DAC channel.
+ // Select Page 1.
+ CodecPageSelect(i2cHandle, 1);
+
+ // De-pop: soft stepping disabled, N = 5, Rpop = 6k. See SLAA408A page 11,12,13.
+ CodecRegWrite(i2cHandle, 20, 0x25);
+
+ // Route LDAC/RDAC to HPL/HPR.
+ CodecRegWrite(i2cHandle, 12, 0x08);
+ CodecRegWrite(i2cHandle, 13, 0x08);
+
+ // Power up HPL/HPR drivers.
+ CodecRegWrite(i2cHandle, 9, 0x30);
+
+ // Unmute HPL/HPR driver, 0dB Gain.
+ CodecRegWrite(i2cHandle, 16, 0x00);
+ CodecRegWrite(i2cHandle, 17, 0x00);
+
+ // Select Page 0.
+ CodecPageSelect(i2cHandle, 0);
+
+ // Unmute DAC, 0dB Gain.
+ CodecRegWrite(i2cHandle, 65, 0x00);
+ CodecRegWrite(i2cHandle, 66, 0x00);
+
+ // Select Page 1.
+ CodecPageSelect(i2cHandle, 1);
+
+ while (CodecRegRead(i2cHandle, 63) & 0x11000000 != 0x11000000)
+ {
+ UtilsDelay(27000); // delay 27000 * 3 = 81000 clock cycles @ 80 MHz ~ 1 ms.
+ }
+
+ // Select Page 0.
+ CodecPageSelect(i2cHandle, 0);
+
+ // Power up LDAC/RDAC.
+ CodecRegWrite(i2cHandle, 63, 0xd4);
+
+ // Unmute LDAC/RDAC.
+ CodecRegWrite(i2cHandle, 64, 0x00);
+}
diff --git a/dis10_lab2.1B/config.h b/dis10_lab2.1B/config.h
new file mode 100644
index 0000000..bfaa628
--- /dev/null
+++ b/dis10_lab2.1B/config.h
@@ -0,0 +1,41 @@
+/*
+ * Configure functions to use the TI TLV320AIC3254 codec on the
+ * CC3200AUDBOOST board with the CC3220S-LAUNCHXL board
+ * without using DMA.
+ *
+ * Copyright (C) 2018, Hogeschool Rotterdam, Harry Broeders
+ * All rights reserved.
+ *
+ * Based on Driver for TI TLV320AIC3110 codec
+ * Copyright (C) 2015-2017 Texas Instruments Incorporated - http://www.ti.com/
+ * All rights reserved.
+ */
+#ifndef __HR_CONFIG_H__
+#define __HR_CONFIG_H__
+
+#include
+
+// Configure an I2C connection using the TI I2C driver.
+extern I2C_Handle ConfigureI2C(uint_least8_t index, I2C_BitRate bitRate);
+
+// Configure an I2S connection using the TI driverlib API.
+extern void ConfigureI2S(unsigned long peripheral, unsigned long base, unsigned int samplingFrequency);
+
+// Functions to configure the codec using an I2C connection
+// volume: 0 -> 0 bB (Highest) to 116 -> -72.3 dB (Lowest)
+extern void AudioVolumeControl(I2C_Handle i2cHandle, signed char volume);
+extern void CodecMute(I2C_Handle i2cHandle);
+extern void CodecUnmute(I2C_Handle i2cHandle);
+// Codec configure:
+ // PGA (Programmable Gain Amplifier) = 0 dB.
+ // Headphone Output = enabled.
+ // Line outputs (to class D amplifier) = disabled.
+ // ADC gain = 0 dB.
+ // AGC (Automatic Gain Control) = disabled.
+ // ADC processing block = PRB_R1 (default).
+ // Microphone = disabled.
+ // DAC processing block = PRB_P1 (default).
+ // DRC (Dynamic Gain Compression) = disabled.
+extern void ConfigureAudioCodec(I2C_Handle i2cHandle, unsigned int samplingFrequency);
+
+#endif
diff --git a/dis10_lab2.1B/main_nortos.c b/dis10_lab2.1B/main_nortos.c
new file mode 100644
index 0000000..4cd0c68
--- /dev/null
+++ b/dis10_lab2.1B/main_nortos.c
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2018, Hogeschool Rotterdam, Harry Broeders
+ * All rights reserved.
+ */
+
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+
+#include "ti_drivers_config.h"
+#include "config.h"
+
+// You can select the sample rate here:
+#define SAMPLINGFREQUENCY 8000
+#if SAMPLINGFREQUENCY < 8000 || SAMPLINGFREQUENCY > 48000 || SAMPLINGFREQUENCY % 4000 != 0
+#error Sampling Frequency must be between 8 kHz and 48 kHz (included) and must be a multiple of 4 kHz.
+#endif
+
+#define N 15
+
+const int BL = 15;
+const int16_t B[15] = {
+ -2321, -3829, -3249, 0, 5415, 11486, 16244, 18043, 16244,
+ 11486, 5415, 0, -3249, -3829, -2321
+};
+
+int16_t buffer_R[N];
+
+int main(void)
+{
+ // Init CC3220S LAUNCHXL board.
+ Board_initGeneral();
+ // Prepare to use TI drivers without operating system.
+ NoRTOS_start();
+
+ printf("line-in_2_line_out: STEREO LINE IN ==> HP LINE OUT.\n");
+ printf("Sampling frequency = %d Hz.\n", SAMPLINGFREQUENCY);
+
+ // Configure an I2C connection which is used to configure the audio codec.
+ I2C_Handle i2cHandle = ConfigureI2C(CONFIG_I2C_0, I2C_400kHz);
+ // Configure the audio codec.
+ ConfigureAudioCodec(i2cHandle, SAMPLINGFREQUENCY);
+
+ // Configure an I2S connection which is use to send/receive samples to/from the codec.
+ ConfigureI2S(CONFIG_I2S_0, I2S_BASE, SAMPLINGFREQUENCY);
+ unsigned long n = 0;
+ unsigned long dataLeft, dataRight;
+ int k, i;
+ while (1)
+ {
+ long outR, v;
+ // The 16-bit samples are stored in 32-bit variables because the API also supports 24-bit samples.
+ I2SDataGet(I2S_BASE, I2S_DATA_LINE_1, &dataLeft);
+ //dataLeft = dataLeft ;//+ (buffer_L[n % N] / 2);
+ // You can process the 16-bit left sample here.
+ I2SDataPut(I2S_BASE, I2S_DATA_LINE_0,(int16_t) 0);
+ I2SDataGet(I2S_BASE, I2S_DATA_LINE_1, &dataRight);
+ buffer_R[0] = dataRight;
+ outR = 0;
+ for (k=0; k < BL; k++){
+ outR += B[k] * (long)buffer_R[k];
+ }
+ for (i = BL - 1; i >= 1; i--){
+ buffer_R[i] = buffer_R[i - 1];
+ }
+ // You can process the 16-bit right sample here.
+ I2SDataPut(I2S_BASE, I2S_DATA_LINE_0, (outR >> 16));
+ n++;
+ if(n == BL){
+ n = 0;
+ }
+ }
+ return 0;
+}
diff --git a/dis10_lab2.1B/targetConfigs/CC3220S.ccxml b/dis10_lab2.1B/targetConfigs/CC3220S.ccxml
new file mode 100644
index 0000000..e643caa
--- /dev/null
+++ b/dis10_lab2.1B/targetConfigs/CC3220S.ccxml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dis10_lab2.1B/targetConfigs/readme.txt b/dis10_lab2.1B/targetConfigs/readme.txt
new file mode 100644
index 0000000..af97b62
--- /dev/null
+++ b/dis10_lab2.1B/targetConfigs/readme.txt
@@ -0,0 +1,9 @@
+The 'targetConfigs' folder contains target-configuration (.ccxml) files, automatically generated based
+on the device and connection settings specified in your project on the Properties > General page.
+
+Please note that in automatic target-configuration management, changes to the project's device and/or
+connection settings will either modify an existing or generate a new target-configuration file. Thus,
+if you manually edit these auto-generated files, you may need to re-apply your changes. Alternatively,
+you may create your own target-configuration file for this project and manage it manually. You can
+always switch back to automatic target-configuration management by checking the "Manage the project's
+target-configuration automatically" checkbox on the project's Properties > General page.
\ No newline at end of file
diff --git a/dis10_lab2.2 b/dis10_lab2.2
deleted file mode 160000
index b395a3d..0000000
--- a/dis10_lab2.2
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit b395a3de77a5c6dac62567a179ba4cdefebccb01
diff --git a/dis10_lab2.2/.ccsproject b/dis10_lab2.2/.ccsproject
new file mode 100644
index 0000000..8ed2f71
--- /dev/null
+++ b/dis10_lab2.2/.ccsproject
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dis10_lab2.2/.cproject b/dis10_lab2.2/.cproject
new file mode 100644
index 0000000..01503bb
--- /dev/null
+++ b/dis10_lab2.2/.cproject
@@ -0,0 +1,372 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dis10_lab2.2/.gitignore b/dis10_lab2.2/.gitignore
new file mode 100644
index 0000000..7c1916f
--- /dev/null
+++ b/dis10_lab2.2/.gitignore
@@ -0,0 +1,2 @@
+/MCU+Image/
+/Debug/
diff --git a/dis10_lab2.2/.launches/dis10_4.2_2.1.launch b/dis10_lab2.2/.launches/dis10_4.2_2.1.launch
new file mode 100644
index 0000000..cecaeb9
--- /dev/null
+++ b/dis10_lab2.2/.launches/dis10_4.2_2.1.launch
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dis10_lab2.2/.launches/dis10_4.2_2.2.launch b/dis10_lab2.2/.launches/dis10_4.2_2.2.launch
new file mode 100644
index 0000000..81082fd
--- /dev/null
+++ b/dis10_lab2.2/.launches/dis10_4.2_2.2.launch
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dis10_lab2.2/.launches/dis10_4.3_3.2.launch b/dis10_lab2.2/.launches/dis10_4.3_3.2.launch
new file mode 100644
index 0000000..63248ea
--- /dev/null
+++ b/dis10_lab2.2/.launches/dis10_4.3_3.2.launch
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dis10_lab2.2/.launches/dis10_4.3_3.3.launch b/dis10_lab2.2/.launches/dis10_4.3_3.3.launch
new file mode 100644
index 0000000..671e413
--- /dev/null
+++ b/dis10_lab2.2/.launches/dis10_4.3_3.3.launch
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dis10_lab2.2/.launches/dis10_lab2.2.launch b/dis10_lab2.2/.launches/dis10_lab2.2.launch
new file mode 100644
index 0000000..4e9c9ae
--- /dev/null
+++ b/dis10_lab2.2/.launches/dis10_lab2.2.launch
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dis10_lab2.2/.launches/line_in_2_line_out.launch b/dis10_lab2.2/.launches/line_in_2_line_out.launch
new file mode 100644
index 0000000..e08bac4
--- /dev/null
+++ b/dis10_lab2.2/.launches/line_in_2_line_out.launch
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dis10_lab2.2/.project b/dis10_lab2.2/.project
new file mode 100644
index 0000000..43031a1
--- /dev/null
+++ b/dis10_lab2.2/.project
@@ -0,0 +1,34 @@
+
+
+ dis10_lab2.2
+
+
+
+
+
+ org.eclipse.cdt.managedbuilder.core.genmakebuilder
+
+
+
+
+ org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
+ full,incremental,
+
+
+
+
+
+ com.ti.ccstudio.core.ccsNature
+ org.eclipse.cdt.core.cnature
+ org.eclipse.cdt.managedbuilder.core.managedBuildNature
+ org.eclipse.cdt.core.ccnature
+ org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
+
+
+
+ Board.html
+ 1
+ COM_TI_SIMPLELINK_CC32XX_SDK_INSTALL_DIR/source/ti/boards/CC3220S_LAUNCHXL/Board.html
+
+
+
diff --git a/dis10_lab2.2/.settings/org.eclipse.cdt.codan.core.prefs b/dis10_lab2.2/.settings/org.eclipse.cdt.codan.core.prefs
new file mode 100644
index 0000000..98b6350
--- /dev/null
+++ b/dis10_lab2.2/.settings/org.eclipse.cdt.codan.core.prefs
@@ -0,0 +1,3 @@
+eclipse.preferences.version=1
+inEditor=false
+onBuild=false
diff --git a/dis10_lab2.2/.settings/org.eclipse.cdt.debug.core.prefs b/dis10_lab2.2/.settings/org.eclipse.cdt.debug.core.prefs
new file mode 100644
index 0000000..58d4fb2
--- /dev/null
+++ b/dis10_lab2.2/.settings/org.eclipse.cdt.debug.core.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+org.eclipse.cdt.debug.core.toggleBreakpointModel=com.ti.ccstudio.debug.CCSBreakpointMarker
diff --git a/dis10_lab2.2/.settings/org.eclipse.core.resources.prefs b/dis10_lab2.2/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..093dbb9
--- /dev/null
+++ b/dis10_lab2.2/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,6 @@
+eclipse.preferences.version=1
+encoding//Debug/makefile=UTF-8
+encoding//Debug/objects.mk=UTF-8
+encoding//Debug/sources.mk=UTF-8
+encoding//Debug/subdir_rules.mk=UTF-8
+encoding//Debug/subdir_vars.mk=UTF-8
diff --git a/dis10_lab2.2/Debug.tar b/dis10_lab2.2/Debug.tar
new file mode 100644
index 0000000..35bb50c
Binary files /dev/null and b/dis10_lab2.2/Debug.tar differ
diff --git a/dis10_lab2.2/audio.syscfg b/dis10_lab2.2/audio.syscfg
new file mode 100644
index 0000000..1ce1557
--- /dev/null
+++ b/dis10_lab2.2/audio.syscfg
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2018-2021, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of Texas Instruments Incorporated nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+// @cliArgs --board /ti/boards/CC3220S_LAUNCHXL --rtos nortos
+
+/*
+ * gpiointerrupt.syscfg
+ */
+/* ======== Boosterpacks ========= BroJZ 20220415*/
+const CC3200AUDBOOST = scripting.addHardware("/ti/boards/boosterpacks/CC3200AUDBOOST");
+
+/* ======== TIRTOS7 ======== */
+if (system.getRTOS() === "tirtos7") {
+ const tirtos7_release_syscfg_js = system.getScript("tirtos7_release.syscfg.js");
+}
+
+/**
+ * Import the modules used in this configuration.
+ */
+const I2C = scripting.addModule("/ti/drivers/I2C");
+const I2C1 = I2C.addInstance();
+const I2S = scripting.addModule("/ti/drivers/I2S");
+const I2S1 = I2S.addInstance();
+const RTOS = scripting.addModule("/ti/drivers/RTOS");
+
+/**
+ * Write custom configuration values to the imported modules.
+ */
+I2C1.$name = "CONFIG_I2C_0";
+I2C1.$hardware = system.deviceData.board.components.LP_I2C;
+
+I2S1.$name = "CONFIG_I2S_0";
+I2S1.interruptPriority = "2";
+I2S1.$hardware = CC3200AUDBOOST.components.CC3200AUDBOOST_I2S;
+
+const Power = scripting.addModule("/ti/drivers/Power", {}, false);
+Power.parkPins.$name = "ti_drivers_power_PowerCC32XXPins0";
+
+RTOS.name = "NoRTOS";
+
+/**
+ * Pinmux solution for unlocked pins/peripherals. This ensures that minor changes to the automatic solver in a future
+ * version of the tool will not impact the pinmux you originally saw. These lines can be completely deleted in order to
+ * re-solve from scratch.
+ */
+I2C1.i2c.$suggestSolution = "I2C0";
+I2C1.i2c.sdaPin.$suggestSolution = "boosterpack.10";
+I2C1.i2c.sclPin.$suggestSolution = "boosterpack.9";
+I2S1.i2s.$suggestSolution = "McASP0";
+I2S1.i2s.SD0Pin.$suggestSolution = "boosterpack.29";
+I2S1.i2s.SD1Pin.$suggestSolution = "boosterpack.30";
+I2S1.i2s.SCKPin.$suggestSolution = "boosterpack.28";
+I2S1.i2s.WSPin.$suggestSolution = "boosterpack.27";
+I2S1.i2s.dmaRxChannel.$suggestSolution = "UDMA_CH18";
+I2S1.i2s.dmaTxChannel.$suggestSolution = "UDMA_CH19";
diff --git a/dis10_lab2.2/berekeningen klokinstellingen codec.xlsx b/dis10_lab2.2/berekeningen klokinstellingen codec.xlsx
new file mode 100644
index 0000000..304dcbd
Binary files /dev/null and b/dis10_lab2.2/berekeningen klokinstellingen codec.xlsx differ
diff --git a/dis10_lab2.2/cc32xxs_nortos.cmd b/dis10_lab2.2/cc32xxs_nortos.cmd
new file mode 100644
index 0000000..4e6d27a
--- /dev/null
+++ b/dis10_lab2.2/cc32xxs_nortos.cmd
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2018-2020, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of Texas Instruments Incorporated nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+--stack_size=0x1000
+--heap_size=0x8000
+--entry_point=resetISR
+--diag_suppress=10063 /* suppress warning about non _c_int00 entry point */
+
+/*
+ * The starting address of the application. Normally the interrupt vectors
+ * must be located at the beginning of the application.
+ */
+#define SRAM_BASE 0x20004000
+#define SRAM2_BASE 0x20000000
+
+MEMORY
+{
+ SRAM (RWX) : origin = 0x20004000, length = 0x00040000 - 0x4000
+ SRAM2 (RWX) : origin = 0x20000000, length = 0x4000
+ /* Explicitly placed off target for the storage of logging data.
+ * The data placed here is NOT loaded onto the target device.
+ * This is part of 1 GB of external memory from 0x60000000 - 0x9FFFFFFF.
+ * ARM memory map can be found here:
+ * https://developer.arm.com/documentation/ddi0337/e/memory-map/about-the-memory-map
+ */
+ LOG_DATA (R) : origin = 0x90000000, length = 0x40000
+}
+
+/* Section allocation in memory */
+
+SECTIONS
+{
+ .text : > SRAM
+ .TI.ramfunc : > SRAM
+ .const : > SRAM
+ .rodata : > SRAM
+ .cinit : > SRAM
+ .pinit : > SRAM
+ .init_array : > SRAM
+
+ .data : > SRAM
+ .bss : > SRAM
+ .sysmem : > SRAM
+ .stack : > SRAM2(HIGH)
+
+ .resetVecs : > SRAM_BASE
+ .ramVecs : > SRAM2_BASE, type=NOLOAD
+
+ .log_data : > LOG_DATA, type = COPY
+}
diff --git a/dis10_lab2.2/config.c b/dis10_lab2.2/config.c
new file mode 100644
index 0000000..af9798e
--- /dev/null
+++ b/dis10_lab2.2/config.c
@@ -0,0 +1,289 @@
+/*
+ * Configure functions to use the TI TLV320AIC3254 codec on the
+ * CC3200AUDBOOST board with the CC3220S-LAUNCHXL board
+ * without using DMA.
+ *
+ * Copyright (C) 2018, Hogeschool Rotterdam, Harry Broeders
+ * All rights reserved.
+ *
+ * Based on Driver for TI TLV320AIC3110 CODEC
+ * Copyright (C) 2015-2017 Texas Instruments Incorporated - http://www.ti.com/
+ * All rights reserved.
+ */
+
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+
+#include "config.h"
+
+// Configure an I2C connection using the TI I2C driver.
+
+I2C_Handle ConfigureI2C(uint_least8_t index, I2C_BitRate bitRate)
+{
+ I2C_Handle i2cHandle;
+ I2C_Params i2cParams;
+ I2C_init();
+ I2C_Params_init(&i2cParams);
+ i2cParams.bitRate = bitRate;
+ i2cHandle = I2C_open(index, &i2cParams);
+ if (i2cHandle == NULL) {
+ // Error initializing I2C.
+ while (1);
+ }
+ return i2cHandle;
+}
+
+// Configure an I2S connection which is use to send/receive samples to/from the codec.
+
+void ConfigureI2S(unsigned long peripheral, unsigned long base, unsigned int samplingFrequency)
+{
+ // Register power dependency. Keeps the I2S clock running in SLP and DSLP modes.
+ int_fast16_t ret = Power_setDependency(PowerCC32XX_PERIPH_I2S);
+ if (ret != Power_SOK) {
+ // Error setting power dependency.
+ while (1);
+ }
+
+ // There is no TI I2S driver (without DMA) available so the TI driverlib API is used.
+ PRCMPeripheralReset(peripheral);
+ I2SEnable(base, I2S_MODE_TX_RX_SYNC);
+
+ unsigned int bitClock = samplingFrequency * 16 * 2;
+ PRCMI2SClockFreqSet(bitClock);
+ I2SConfigSetExpClk(base, bitClock, bitClock, I2S_MODE_MASTER | I2S_SLOT_SIZE_16 | I2S_PORT_CPU);
+
+ I2SSerializerConfig(base, I2S_DATA_LINE_0, I2S_SER_MODE_TX, I2S_INACT_LOW_LEVEL);
+ I2SSerializerConfig(base, I2S_DATA_LINE_1, I2S_SER_MODE_RX, I2S_INACT_LOW_LEVEL);
+
+ // Configure I2S pins in pin mux
+ PinTypeI2S(PIN_64, PIN_MODE_7); // xr0Pin = I2S SDout (CC3220S-LAUNCHXL) = DIN_J3 (CC3200AUDBOOST)
+ PinTypeI2S(PIN_50, PIN_MODE_6); // xr1Pin = I2S SDin (CC3220S-LAUNCHXL) = DOUT_J3 (CC3200AUDBOOST)
+ PinTypeI2S(PIN_53, PIN_MODE_2); // clkPin = I2S SCLK (CC3220S-LAUNCHXL) = BCLK_J3 (CC3200AUDBOOST)
+ PinTypeI2S(PIN_63, PIN_MODE_7); // fsxPin = I2S WC (CC3220S-LAUNCHXL) = FSYNC_J3 (CC3200AUDBOOST)
+
+ PRCMPeripheralClkEnable(peripheral, PRCM_RUN_MODE_CLK);
+}
+
+#define CODEC_I2C_SLAVE_ADDR ((0x30 >> 1))
+
+static uint8_t CodecRegRead(I2C_Handle i2cHandle, uint8_t regAddr)
+{
+ I2C_Transaction i2cTransaction;
+ uint8_t data;
+
+ i2cTransaction.slaveAddress = CODEC_I2C_SLAVE_ADDR;
+ i2cTransaction.writeBuf = ®Addr;
+ i2cTransaction.writeCount = 1;
+ i2cTransaction.readBuf = &data;
+ i2cTransaction.readCount = 1;
+ if (!I2C_transfer(i2cHandle, &i2cTransaction))
+ {
+ // I2C transfer failed
+ while (1);
+ }
+ return data;
+}
+
+static void CodecRegWrite(I2C_Handle i2cHandle, uint8_t regAddr, uint8_t regValue)
+{
+ uint8_t data[2];
+ I2C_Transaction i2cTransaction;
+
+ data[0] = regAddr;
+ data[1] = regValue;
+
+ i2cTransaction.slaveAddress = CODEC_I2C_SLAVE_ADDR;
+ i2cTransaction.writeBuf = &data[0];
+ i2cTransaction.writeCount = 2;
+ i2cTransaction.readBuf = NULL;
+ i2cTransaction.readCount = 0;
+ if (!I2C_transfer(i2cHandle, &i2cTransaction))
+ {
+ // I2C transfer failed
+ while (1);
+ }
+}
+
+static void CodecPageSelect(I2C_Handle i2cHandle, unsigned long pageAddress)
+{
+ CodecRegWrite(i2cHandle, 0, pageAddress);
+}
+
+static void CodecReset(I2C_Handle i2cHandle)
+{
+ // Select page 0.
+ CodecPageSelect(i2cHandle, 0);
+ // Soft RESET.
+ CodecRegWrite(i2cHandle, 1, 0x01);
+ // Wait for 27000 * 3 = 81000 clock cycles @ 80 MHz ~ 1 ms.
+ UtilsDelay(27000);
+}
+
+// volume: 0 -> 0 bB (Highest) to 116 -> -72.3 dB (Lowest)
+void AudioVolumeControl(I2C_Handle i2cHandle, signed char volume)
+{
+ // Select page 1
+ CodecPageSelect(i2cHandle, 1);
+ // Enable HPL output analog volume
+ CodecRegWrite(i2cHandle, 22, volume);
+ CodecRegWrite(i2cHandle, 23, volume);
+}
+
+void CodecMute(I2C_Handle i2cHandle)
+{
+ // Select page 0.
+ CodecPageSelect(i2cHandle, 0);
+ // Mute.
+ CodecRegWrite(i2cHandle, 64, 0x0C);
+}
+
+void CodecUnmute(I2C_Handle i2cHandle)
+{
+ // Select page 0.
+ CodecPageSelect(i2cHandle, 0);
+ // Unmute.
+ CodecRegWrite(i2cHandle, 64, 0x00);
+}
+
+// Codec configure:
+ // PGA (Programmable Gain Amplifier) = 0 dB.
+ // Headphone Output = enabled.
+ // Line outputs (to class D amplifier) = disabled.
+ // ADC gain = 0 dB.
+ // AGC (Automatic Gain Control) = disabled.
+ // ADC processing block = PRB_R1 (default).
+ // Microphone = disabled.
+ // DAC processing block = PRB_P1 (default).
+ // DRC (Dynamic Gain Compression) = disabled.
+
+void ConfigureAudioCodec(I2C_Handle i2cHandle, unsigned int samplingFrequency)
+{
+ // Check parameter.
+ if (samplingFrequency < 8000 || samplingFrequency > 48000 || samplingFrequency % 4000 != 0)
+ {
+ while(1);
+ // Wrong value for sampling frequency.
+ }
+ size_t sampleIndex = (samplingFrequency / 4000) - 2;
+ // values for DOSR, MDAC, NDAC, NADC and J in steps of 4 kHz starting from 8 kHz to 48 kHz.
+ // 8 12 16 20 24 28 32 36 40 44 48
+ int DOSR[] = {512, 512, 384, 304, 256, 208, 192, 160, 144, 128, 128};
+ int MDAC[] = { 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2};
+ int NDAC[] = { 1, 1, 2, 16, 8, 8, 8, 8, 8, 8, 8};
+ int NADC[] = { 2, 2, 3, 19, 16, 13, 12, 10, 9, 8, 8};
+ int J[] = { 4, 4, 6, 38, 32, 26, 24, 20, 18, 16, 16};
+
+ // Reset code for startup.
+ CodecReset(i2cHandle);
+
+ // Select page 0.
+ CodecPageSelect(i2cHandle, 0);
+
+ // Set I2S Mode and Word Length = 16 bits, BCLK and WCLK are inputs to the device.
+ CodecRegWrite(i2cHandle, 27, 0x00);
+ // Clock settings chip
+ CodecRegWrite(i2cHandle, 4, 0x03); // PLL CLock is CODEC_CLKIN
+ CodecRegWrite(i2cHandle, 5, 0x94); // PLL enabled, P = 1, R = 4
+ CodecRegWrite(i2cHandle, 6, J[sampleIndex]); // PLL J
+ CodecRegWrite(i2cHandle, 7, 0); // PLL D = 0
+ CodecRegWrite(i2cHandle, 8, 0); // PLL D = 0
+ // PLL_CLK = PLL_CLKIN * R * J.D / P = PLL_CLKIN * 4 * J = (Fs * 32) * 4 * J
+
+ // Clock settings DAC.
+ CodecRegWrite(i2cHandle, 11, 0x80 + NDAC[sampleIndex]); // NDAC is powered up
+ CodecRegWrite(i2cHandle, 12, 0x80 + MDAC[sampleIndex]); // MDAC is powered up
+ CodecRegWrite(i2cHandle, 13, DOSR[sampleIndex] / 256); // DOSR
+ CodecRegWrite(i2cHandle, 14, DOSR[sampleIndex] % 256);
+ // DAC_fs = CODEC_CLKIN / (NDAC * MDAC * DOSR)
+
+ // Clock settings ADC.
+ CodecRegWrite(i2cHandle, 18, 0x80 + NADC[sampleIndex]); // NADC is powered up, NADC = 2
+ CodecRegWrite(i2cHandle, 19, 0x80 + 2); // MADC is powered up, MADC = 2
+ CodecRegWrite(i2cHandle, 20, 128); // AOSR = 128
+ // ADC_fs = CODEC_CLKIN / (NADC * MADC * AOSR)
+
+ // Configure power supplies.
+ CodecPageSelect(i2cHandle, 1);
+ CodecRegWrite(i2cHandle, 1, 0x08); // AVdd and DVdd are connected
+ CodecRegWrite(i2cHandle, 2, 0x01); // LDO enabled AVDD LDO output = 1.72 V
+ CodecRegWrite(i2cHandle, 71, 0x32); // Aanalog input powerup = 6.4 ms
+ CodecRegWrite(i2cHandle, 123, 0x01); // Reference powered up in 40 ms
+
+ // Configure ADC channel.
+ // Route IN1L to Left MICPGA with 10K input impedance.
+ CodecRegWrite(i2cHandle, 52, 0x40);
+ // Route CM to Left MICPGA with 10K input impedance.
+ CodecRegWrite(i2cHandle, 54, 0x40);
+ // Route IN1R to Right MICPGA with 10K input impedance.
+ CodecRegWrite(i2cHandle, 55, 0x40);
+ // Route CM to Right MICPGA with 10K input impedance.
+ CodecRegWrite(i2cHandle, 57,0x40);
+ // Floating IN1L.
+ CodecRegWrite(i2cHandle, 58, 0xC0);
+
+ // Select Page 0.
+ CodecPageSelect(i2cHandle, 0);
+ // Power up LADC/RADC.
+ CodecRegWrite(i2cHandle, 81, 0xC0);
+ // Unmute LADC/RADC.
+ CodecRegWrite(i2cHandle, 82, 0x00);
+
+ // Configure DAC channel.
+ // Select Page 1.
+ CodecPageSelect(i2cHandle, 1);
+
+ // De-pop: soft stepping disabled, N = 5, Rpop = 6k. See SLAA408A page 11,12,13.
+ CodecRegWrite(i2cHandle, 20, 0x25);
+
+ // Route LDAC/RDAC to HPL/HPR.
+ CodecRegWrite(i2cHandle, 12, 0x08);
+ CodecRegWrite(i2cHandle, 13, 0x08);
+
+ // Power up HPL/HPR drivers.
+ CodecRegWrite(i2cHandle, 9, 0x30);
+
+ // Unmute HPL/HPR driver, 0dB Gain.
+ CodecRegWrite(i2cHandle, 16, 0x00);
+ CodecRegWrite(i2cHandle, 17, 0x00);
+
+ // Select Page 0.
+ CodecPageSelect(i2cHandle, 0);
+
+ // Unmute DAC, 0dB Gain.
+ CodecRegWrite(i2cHandle, 65, 0x00);
+ CodecRegWrite(i2cHandle, 66, 0x00);
+
+ // Select Page 1.
+ CodecPageSelect(i2cHandle, 1);
+
+ while (CodecRegRead(i2cHandle, 63) & 0x11000000 != 0x11000000)
+ {
+ UtilsDelay(27000); // delay 27000 * 3 = 81000 clock cycles @ 80 MHz ~ 1 ms.
+ }
+
+ // Select Page 0.
+ CodecPageSelect(i2cHandle, 0);
+
+ // Power up LDAC/RDAC.
+ CodecRegWrite(i2cHandle, 63, 0xd4);
+
+ // Unmute LDAC/RDAC.
+ CodecRegWrite(i2cHandle, 64, 0x00);
+}
diff --git a/dis10_lab2.2/config.h b/dis10_lab2.2/config.h
new file mode 100644
index 0000000..bfaa628
--- /dev/null
+++ b/dis10_lab2.2/config.h
@@ -0,0 +1,41 @@
+/*
+ * Configure functions to use the TI TLV320AIC3254 codec on the
+ * CC3200AUDBOOST board with the CC3220S-LAUNCHXL board
+ * without using DMA.
+ *
+ * Copyright (C) 2018, Hogeschool Rotterdam, Harry Broeders
+ * All rights reserved.
+ *
+ * Based on Driver for TI TLV320AIC3110 codec
+ * Copyright (C) 2015-2017 Texas Instruments Incorporated - http://www.ti.com/
+ * All rights reserved.
+ */
+#ifndef __HR_CONFIG_H__
+#define __HR_CONFIG_H__
+
+#include
+
+// Configure an I2C connection using the TI I2C driver.
+extern I2C_Handle ConfigureI2C(uint_least8_t index, I2C_BitRate bitRate);
+
+// Configure an I2S connection using the TI driverlib API.
+extern void ConfigureI2S(unsigned long peripheral, unsigned long base, unsigned int samplingFrequency);
+
+// Functions to configure the codec using an I2C connection
+// volume: 0 -> 0 bB (Highest) to 116 -> -72.3 dB (Lowest)
+extern void AudioVolumeControl(I2C_Handle i2cHandle, signed char volume);
+extern void CodecMute(I2C_Handle i2cHandle);
+extern void CodecUnmute(I2C_Handle i2cHandle);
+// Codec configure:
+ // PGA (Programmable Gain Amplifier) = 0 dB.
+ // Headphone Output = enabled.
+ // Line outputs (to class D amplifier) = disabled.
+ // ADC gain = 0 dB.
+ // AGC (Automatic Gain Control) = disabled.
+ // ADC processing block = PRB_R1 (default).
+ // Microphone = disabled.
+ // DAC processing block = PRB_P1 (default).
+ // DRC (Dynamic Gain Compression) = disabled.
+extern void ConfigureAudioCodec(I2C_Handle i2cHandle, unsigned int samplingFrequency);
+
+#endif
diff --git a/dis10_lab2.2/main_nortos.c b/dis10_lab2.2/main_nortos.c
new file mode 100644
index 0000000..097f72a
--- /dev/null
+++ b/dis10_lab2.2/main_nortos.c
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2018, Hogeschool Rotterdam, Harry Broeders
+ * All rights reserved.
+ */
+
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+
+#include "ti_drivers_config.h"
+#include "config.h"
+
+// You can select the sample rate here:
+#define SAMPLINGFREQUENCY 8000
+#if SAMPLINGFREQUENCY < 8000 || SAMPLINGFREQUENCY > 48000 || SAMPLINGFREQUENCY % 4000 != 0
+#error Sampling Frequency must be between 8 kHz and 48 kHz (included) and must be a multiple of 4 kHz.
+#endif
+
+#define N 15
+
+const int BL = 15;
+const int16_t B[15] = {
+ -2321, -3829, -3249, 0, 5415, 11486, 16244, 18043, 16244,
+ 11486, 5415, 0, -3249, -3829, -2321
+};
+
+int16_t buffer_R[N];
+
+int main(void)
+{
+ // Init CC3220S LAUNCHXL board.
+ Board_initGeneral();
+ // Prepare to use TI drivers without operating system.
+ NoRTOS_start();
+
+ printf("line-in_2_line_out: STEREO LINE IN ==> HP LINE OUT.\n");
+ printf("Sampling frequency = %d Hz.\n", SAMPLINGFREQUENCY);
+
+ // Configure an I2C connection which is used to configure the audio codec.
+ I2C_Handle i2cHandle = ConfigureI2C(CONFIG_I2C_0, I2C_400kHz);
+ // Configure the audio codec.
+ ConfigureAudioCodec(i2cHandle, SAMPLINGFREQUENCY);
+
+ // Configure an I2S connection which is use to send/receive samples to/from the codec.
+ ConfigureI2S(CONFIG_I2S_0, I2S_BASE, SAMPLINGFREQUENCY);
+ unsigned long n = 0;
+ unsigned long dataLeft, dataRight;
+ int k;
+ while (1)
+ {
+ long outR, v;
+ // The 16-bit samples are stored in 32-bit variables because the API also supports 24-bit samples.
+ I2SDataGet(I2S_BASE, I2S_DATA_LINE_1, &dataLeft);
+ //dataLeft = dataLeft ;//+ (buffer_L[n % N] / 2);
+ // You can process the 16-bit left sample here.
+ I2SDataPut(I2S_BASE, I2S_DATA_LINE_0,(int16_t) 0);
+ I2SDataGet(I2S_BASE, I2S_DATA_LINE_1, &dataRight);
+ buffer_R[n] = dataRight;
+ outR = 0;
+ for (k=0; k < BL; k++)
+ {
+ v = n-k;
+ if(v < 0){
+ outR += B[k] * (long)buffer_R[v + BL];
+ }else{
+ outR += B[k] * (long)buffer_R[v];
+ }
+ }
+ I2SDataPut(I2S_BASE, I2S_DATA_LINE_0, (outR >> 16));
+ n++;
+ if(n >= BL){
+ n = 0;
+ }
+ }
+ return 0;
+}
diff --git a/dis10_lab2.2/targetConfigs/CC3220S.ccxml b/dis10_lab2.2/targetConfigs/CC3220S.ccxml
new file mode 100644
index 0000000..e643caa
--- /dev/null
+++ b/dis10_lab2.2/targetConfigs/CC3220S.ccxml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dis10_lab2.2/targetConfigs/readme.txt b/dis10_lab2.2/targetConfigs/readme.txt
new file mode 100644
index 0000000..af97b62
--- /dev/null
+++ b/dis10_lab2.2/targetConfigs/readme.txt
@@ -0,0 +1,9 @@
+The 'targetConfigs' folder contains target-configuration (.ccxml) files, automatically generated based
+on the device and connection settings specified in your project on the Properties > General page.
+
+Please note that in automatic target-configuration management, changes to the project's device and/or
+connection settings will either modify an existing or generate a new target-configuration file. Thus,
+if you manually edit these auto-generated files, you may need to re-apply your changes. Alternatively,
+you may create your own target-configuration file for this project and manage it manually. You can
+always switch back to automatic target-configuration management by checking the "Manage the project's
+target-configuration automatically" checkbox on the project's Properties > General page.
\ No newline at end of file
diff --git a/dis10_lab2.3 b/dis10_lab2.3
deleted file mode 160000
index 5222e5f..0000000
--- a/dis10_lab2.3
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 5222e5f1f146d27a94f5b22abeee0be0bc639d3b
diff --git a/dis10_lab2.3/.ccsproject b/dis10_lab2.3/.ccsproject
new file mode 100644
index 0000000..8ed2f71
--- /dev/null
+++ b/dis10_lab2.3/.ccsproject
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dis10_lab2.3/.cproject b/dis10_lab2.3/.cproject
new file mode 100644
index 0000000..9013c77
--- /dev/null
+++ b/dis10_lab2.3/.cproject
@@ -0,0 +1,249 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dis10_lab2.3/.gitignore b/dis10_lab2.3/.gitignore
new file mode 100644
index 0000000..7c1916f
--- /dev/null
+++ b/dis10_lab2.3/.gitignore
@@ -0,0 +1,2 @@
+/MCU+Image/
+/Debug/
diff --git a/dis10_lab2.3/.launches/dis10_4.2_2.3.launch b/dis10_lab2.3/.launches/dis10_4.2_2.3.launch
new file mode 100644
index 0000000..155a950
--- /dev/null
+++ b/dis10_lab2.3/.launches/dis10_4.2_2.3.launch
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dis10_lab2.3/.launches/dis10_lab2.3.launch b/dis10_lab2.3/.launches/dis10_lab2.3.launch
new file mode 100644
index 0000000..55e3668
--- /dev/null
+++ b/dis10_lab2.3/.launches/dis10_lab2.3.launch
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dis10_lab2.3/.launches/line_in_2_line_out.launch b/dis10_lab2.3/.launches/line_in_2_line_out.launch
new file mode 100644
index 0000000..e08bac4
--- /dev/null
+++ b/dis10_lab2.3/.launches/line_in_2_line_out.launch
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dis10_lab2.3/.project b/dis10_lab2.3/.project
new file mode 100644
index 0000000..746e662
--- /dev/null
+++ b/dis10_lab2.3/.project
@@ -0,0 +1,34 @@
+
+
+ dis10_lab2.3
+
+
+
+
+
+ org.eclipse.cdt.managedbuilder.core.genmakebuilder
+
+
+
+
+ org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
+ full,incremental,
+
+
+
+
+
+ com.ti.ccstudio.core.ccsNature
+ org.eclipse.cdt.core.cnature
+ org.eclipse.cdt.managedbuilder.core.managedBuildNature
+ org.eclipse.cdt.core.ccnature
+ org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
+
+
+
+ Board.html
+ 1
+ COM_TI_SIMPLELINK_CC32XX_SDK_INSTALL_DIR/source/ti/boards/CC3220S_LAUNCHXL/Board.html
+
+
+
diff --git a/dis10_lab2.3/.settings/org.eclipse.cdt.codan.core.prefs b/dis10_lab2.3/.settings/org.eclipse.cdt.codan.core.prefs
new file mode 100644
index 0000000..98b6350
--- /dev/null
+++ b/dis10_lab2.3/.settings/org.eclipse.cdt.codan.core.prefs
@@ -0,0 +1,3 @@
+eclipse.preferences.version=1
+inEditor=false
+onBuild=false
diff --git a/dis10_lab2.3/.settings/org.eclipse.cdt.debug.core.prefs b/dis10_lab2.3/.settings/org.eclipse.cdt.debug.core.prefs
new file mode 100644
index 0000000..58d4fb2
--- /dev/null
+++ b/dis10_lab2.3/.settings/org.eclipse.cdt.debug.core.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+org.eclipse.cdt.debug.core.toggleBreakpointModel=com.ti.ccstudio.debug.CCSBreakpointMarker
diff --git a/dis10_lab2.3/.settings/org.eclipse.core.resources.prefs b/dis10_lab2.3/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..7c051cc
--- /dev/null
+++ b/dis10_lab2.3/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,6 @@
+eclipse.preferences.version=1
+encoding//Debug/makefile=UTF-8
+encoding//Debug/objects.mk=UTF-8
+encoding//Debug/sources.mk=UTF-8
+encoding//Debug/subdir_rules.mk=UTF-8
+encoding//Debug/subdir_vars.mk=UTF-8
diff --git a/dis10_lab2.3/anderanderezooi.h b/dis10_lab2.3/anderanderezooi.h
new file mode 100644
index 0000000..f2c7f3a
--- /dev/null
+++ b/dis10_lab2.3/anderanderezooi.h
@@ -0,0 +1,37 @@
+/*
+ * Filter Coefficients (C Source) generated by the Filter Design and Analysis Tool
+ * Generated by MATLAB(R) 9.13 and DSP System Toolbox 9.15.
+ * Generated on: 25-May-2023 12:30:35
+ */
+
+/*
+ * Discrete-Time FIR Filter (real)
+ * -------------------------------
+ * Filter Structure : Direct-Form FIR
+ * Filter Length : 33
+ * Stable : Yes
+ * Linear Phase : Yes (Type 1)
+ * Arithmetic : fixed
+ * Numerator : s16,15 -> [-1 1)
+ * Input : s16,15 -> [-1 1)
+ * Filter Internals : Full Precision
+ * Output : s33,30 -> [-4 4) (auto determined)
+ * Product : s31,30 -> [-1 1) (auto determined)
+ * Accumulator : s33,30 -> [-4 4) (auto determined)
+ * Round Mode : No rounding
+ * Overflow Mode : No overflow
+ */
+
+/* General type conversion for MATLAB generated C-code */
+//#include "tmwtypes.h"
+/*
+ * Expected path to tmwtypes.h
+ * C:\Program Files\MATLAB\R2022b\extern\include\tmwtypes.h
+ */
+const int BL = 33;
+const int16_T B[33] = {
+ 47, -54, 19, 293, 744, 1292, 1820, 2188, 2274,
+ 1994, 1329, 337, -856, -2075, -3128, -3840, 27997, -3840,
+ -3128, -2075, -856, 337, 1329, 1994, 2274, 2188, 1820,
+ 1292, 744, 293, 19, -54, 47
+};
diff --git a/dis10_lab2.3/audio.syscfg b/dis10_lab2.3/audio.syscfg
new file mode 100644
index 0000000..1ce1557
--- /dev/null
+++ b/dis10_lab2.3/audio.syscfg
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2018-2021, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of Texas Instruments Incorporated nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+// @cliArgs --board /ti/boards/CC3220S_LAUNCHXL --rtos nortos
+
+/*
+ * gpiointerrupt.syscfg
+ */
+/* ======== Boosterpacks ========= BroJZ 20220415*/
+const CC3200AUDBOOST = scripting.addHardware("/ti/boards/boosterpacks/CC3200AUDBOOST");
+
+/* ======== TIRTOS7 ======== */
+if (system.getRTOS() === "tirtos7") {
+ const tirtos7_release_syscfg_js = system.getScript("tirtos7_release.syscfg.js");
+}
+
+/**
+ * Import the modules used in this configuration.
+ */
+const I2C = scripting.addModule("/ti/drivers/I2C");
+const I2C1 = I2C.addInstance();
+const I2S = scripting.addModule("/ti/drivers/I2S");
+const I2S1 = I2S.addInstance();
+const RTOS = scripting.addModule("/ti/drivers/RTOS");
+
+/**
+ * Write custom configuration values to the imported modules.
+ */
+I2C1.$name = "CONFIG_I2C_0";
+I2C1.$hardware = system.deviceData.board.components.LP_I2C;
+
+I2S1.$name = "CONFIG_I2S_0";
+I2S1.interruptPriority = "2";
+I2S1.$hardware = CC3200AUDBOOST.components.CC3200AUDBOOST_I2S;
+
+const Power = scripting.addModule("/ti/drivers/Power", {}, false);
+Power.parkPins.$name = "ti_drivers_power_PowerCC32XXPins0";
+
+RTOS.name = "NoRTOS";
+
+/**
+ * Pinmux solution for unlocked pins/peripherals. This ensures that minor changes to the automatic solver in a future
+ * version of the tool will not impact the pinmux you originally saw. These lines can be completely deleted in order to
+ * re-solve from scratch.
+ */
+I2C1.i2c.$suggestSolution = "I2C0";
+I2C1.i2c.sdaPin.$suggestSolution = "boosterpack.10";
+I2C1.i2c.sclPin.$suggestSolution = "boosterpack.9";
+I2S1.i2s.$suggestSolution = "McASP0";
+I2S1.i2s.SD0Pin.$suggestSolution = "boosterpack.29";
+I2S1.i2s.SD1Pin.$suggestSolution = "boosterpack.30";
+I2S1.i2s.SCKPin.$suggestSolution = "boosterpack.28";
+I2S1.i2s.WSPin.$suggestSolution = "boosterpack.27";
+I2S1.i2s.dmaRxChannel.$suggestSolution = "UDMA_CH18";
+I2S1.i2s.dmaTxChannel.$suggestSolution = "UDMA_CH19";
diff --git a/dis10_lab2.3/berekeningen klokinstellingen codec.xlsx b/dis10_lab2.3/berekeningen klokinstellingen codec.xlsx
new file mode 100644
index 0000000..304dcbd
Binary files /dev/null and b/dis10_lab2.3/berekeningen klokinstellingen codec.xlsx differ
diff --git a/dis10_lab2.3/cc32xxs_nortos.cmd b/dis10_lab2.3/cc32xxs_nortos.cmd
new file mode 100644
index 0000000..4e6d27a
--- /dev/null
+++ b/dis10_lab2.3/cc32xxs_nortos.cmd
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2018-2020, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of Texas Instruments Incorporated nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+--stack_size=0x1000
+--heap_size=0x8000
+--entry_point=resetISR
+--diag_suppress=10063 /* suppress warning about non _c_int00 entry point */
+
+/*
+ * The starting address of the application. Normally the interrupt vectors
+ * must be located at the beginning of the application.
+ */
+#define SRAM_BASE 0x20004000
+#define SRAM2_BASE 0x20000000
+
+MEMORY
+{
+ SRAM (RWX) : origin = 0x20004000, length = 0x00040000 - 0x4000
+ SRAM2 (RWX) : origin = 0x20000000, length = 0x4000
+ /* Explicitly placed off target for the storage of logging data.
+ * The data placed here is NOT loaded onto the target device.
+ * This is part of 1 GB of external memory from 0x60000000 - 0x9FFFFFFF.
+ * ARM memory map can be found here:
+ * https://developer.arm.com/documentation/ddi0337/e/memory-map/about-the-memory-map
+ */
+ LOG_DATA (R) : origin = 0x90000000, length = 0x40000
+}
+
+/* Section allocation in memory */
+
+SECTIONS
+{
+ .text : > SRAM
+ .TI.ramfunc : > SRAM
+ .const : > SRAM
+ .rodata : > SRAM
+ .cinit : > SRAM
+ .pinit : > SRAM
+ .init_array : > SRAM
+
+ .data : > SRAM
+ .bss : > SRAM
+ .sysmem : > SRAM
+ .stack : > SRAM2(HIGH)
+
+ .resetVecs : > SRAM_BASE
+ .ramVecs : > SRAM2_BASE, type=NOLOAD
+
+ .log_data : > LOG_DATA, type = COPY
+}
diff --git a/dis10_lab2.3/config.c b/dis10_lab2.3/config.c
new file mode 100644
index 0000000..af9798e
--- /dev/null
+++ b/dis10_lab2.3/config.c
@@ -0,0 +1,289 @@
+/*
+ * Configure functions to use the TI TLV320AIC3254 codec on the
+ * CC3200AUDBOOST board with the CC3220S-LAUNCHXL board
+ * without using DMA.
+ *
+ * Copyright (C) 2018, Hogeschool Rotterdam, Harry Broeders
+ * All rights reserved.
+ *
+ * Based on Driver for TI TLV320AIC3110 CODEC
+ * Copyright (C) 2015-2017 Texas Instruments Incorporated - http://www.ti.com/
+ * All rights reserved.
+ */
+
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+
+#include "config.h"
+
+// Configure an I2C connection using the TI I2C driver.
+
+I2C_Handle ConfigureI2C(uint_least8_t index, I2C_BitRate bitRate)
+{
+ I2C_Handle i2cHandle;
+ I2C_Params i2cParams;
+ I2C_init();
+ I2C_Params_init(&i2cParams);
+ i2cParams.bitRate = bitRate;
+ i2cHandle = I2C_open(index, &i2cParams);
+ if (i2cHandle == NULL) {
+ // Error initializing I2C.
+ while (1);
+ }
+ return i2cHandle;
+}
+
+// Configure an I2S connection which is use to send/receive samples to/from the codec.
+
+void ConfigureI2S(unsigned long peripheral, unsigned long base, unsigned int samplingFrequency)
+{
+ // Register power dependency. Keeps the I2S clock running in SLP and DSLP modes.
+ int_fast16_t ret = Power_setDependency(PowerCC32XX_PERIPH_I2S);
+ if (ret != Power_SOK) {
+ // Error setting power dependency.
+ while (1);
+ }
+
+ // There is no TI I2S driver (without DMA) available so the TI driverlib API is used.
+ PRCMPeripheralReset(peripheral);
+ I2SEnable(base, I2S_MODE_TX_RX_SYNC);
+
+ unsigned int bitClock = samplingFrequency * 16 * 2;
+ PRCMI2SClockFreqSet(bitClock);
+ I2SConfigSetExpClk(base, bitClock, bitClock, I2S_MODE_MASTER | I2S_SLOT_SIZE_16 | I2S_PORT_CPU);
+
+ I2SSerializerConfig(base, I2S_DATA_LINE_0, I2S_SER_MODE_TX, I2S_INACT_LOW_LEVEL);
+ I2SSerializerConfig(base, I2S_DATA_LINE_1, I2S_SER_MODE_RX, I2S_INACT_LOW_LEVEL);
+
+ // Configure I2S pins in pin mux
+ PinTypeI2S(PIN_64, PIN_MODE_7); // xr0Pin = I2S SDout (CC3220S-LAUNCHXL) = DIN_J3 (CC3200AUDBOOST)
+ PinTypeI2S(PIN_50, PIN_MODE_6); // xr1Pin = I2S SDin (CC3220S-LAUNCHXL) = DOUT_J3 (CC3200AUDBOOST)
+ PinTypeI2S(PIN_53, PIN_MODE_2); // clkPin = I2S SCLK (CC3220S-LAUNCHXL) = BCLK_J3 (CC3200AUDBOOST)
+ PinTypeI2S(PIN_63, PIN_MODE_7); // fsxPin = I2S WC (CC3220S-LAUNCHXL) = FSYNC_J3 (CC3200AUDBOOST)
+
+ PRCMPeripheralClkEnable(peripheral, PRCM_RUN_MODE_CLK);
+}
+
+#define CODEC_I2C_SLAVE_ADDR ((0x30 >> 1))
+
+static uint8_t CodecRegRead(I2C_Handle i2cHandle, uint8_t regAddr)
+{
+ I2C_Transaction i2cTransaction;
+ uint8_t data;
+
+ i2cTransaction.slaveAddress = CODEC_I2C_SLAVE_ADDR;
+ i2cTransaction.writeBuf = ®Addr;
+ i2cTransaction.writeCount = 1;
+ i2cTransaction.readBuf = &data;
+ i2cTransaction.readCount = 1;
+ if (!I2C_transfer(i2cHandle, &i2cTransaction))
+ {
+ // I2C transfer failed
+ while (1);
+ }
+ return data;
+}
+
+static void CodecRegWrite(I2C_Handle i2cHandle, uint8_t regAddr, uint8_t regValue)
+{
+ uint8_t data[2];
+ I2C_Transaction i2cTransaction;
+
+ data[0] = regAddr;
+ data[1] = regValue;
+
+ i2cTransaction.slaveAddress = CODEC_I2C_SLAVE_ADDR;
+ i2cTransaction.writeBuf = &data[0];
+ i2cTransaction.writeCount = 2;
+ i2cTransaction.readBuf = NULL;
+ i2cTransaction.readCount = 0;
+ if (!I2C_transfer(i2cHandle, &i2cTransaction))
+ {
+ // I2C transfer failed
+ while (1);
+ }
+}
+
+static void CodecPageSelect(I2C_Handle i2cHandle, unsigned long pageAddress)
+{
+ CodecRegWrite(i2cHandle, 0, pageAddress);
+}
+
+static void CodecReset(I2C_Handle i2cHandle)
+{
+ // Select page 0.
+ CodecPageSelect(i2cHandle, 0);
+ // Soft RESET.
+ CodecRegWrite(i2cHandle, 1, 0x01);
+ // Wait for 27000 * 3 = 81000 clock cycles @ 80 MHz ~ 1 ms.
+ UtilsDelay(27000);
+}
+
+// volume: 0 -> 0 bB (Highest) to 116 -> -72.3 dB (Lowest)
+void AudioVolumeControl(I2C_Handle i2cHandle, signed char volume)
+{
+ // Select page 1
+ CodecPageSelect(i2cHandle, 1);
+ // Enable HPL output analog volume
+ CodecRegWrite(i2cHandle, 22, volume);
+ CodecRegWrite(i2cHandle, 23, volume);
+}
+
+void CodecMute(I2C_Handle i2cHandle)
+{
+ // Select page 0.
+ CodecPageSelect(i2cHandle, 0);
+ // Mute.
+ CodecRegWrite(i2cHandle, 64, 0x0C);
+}
+
+void CodecUnmute(I2C_Handle i2cHandle)
+{
+ // Select page 0.
+ CodecPageSelect(i2cHandle, 0);
+ // Unmute.
+ CodecRegWrite(i2cHandle, 64, 0x00);
+}
+
+// Codec configure:
+ // PGA (Programmable Gain Amplifier) = 0 dB.
+ // Headphone Output = enabled.
+ // Line outputs (to class D amplifier) = disabled.
+ // ADC gain = 0 dB.
+ // AGC (Automatic Gain Control) = disabled.
+ // ADC processing block = PRB_R1 (default).
+ // Microphone = disabled.
+ // DAC processing block = PRB_P1 (default).
+ // DRC (Dynamic Gain Compression) = disabled.
+
+void ConfigureAudioCodec(I2C_Handle i2cHandle, unsigned int samplingFrequency)
+{
+ // Check parameter.
+ if (samplingFrequency < 8000 || samplingFrequency > 48000 || samplingFrequency % 4000 != 0)
+ {
+ while(1);
+ // Wrong value for sampling frequency.
+ }
+ size_t sampleIndex = (samplingFrequency / 4000) - 2;
+ // values for DOSR, MDAC, NDAC, NADC and J in steps of 4 kHz starting from 8 kHz to 48 kHz.
+ // 8 12 16 20 24 28 32 36 40 44 48
+ int DOSR[] = {512, 512, 384, 304, 256, 208, 192, 160, 144, 128, 128};
+ int MDAC[] = { 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2};
+ int NDAC[] = { 1, 1, 2, 16, 8, 8, 8, 8, 8, 8, 8};
+ int NADC[] = { 2, 2, 3, 19, 16, 13, 12, 10, 9, 8, 8};
+ int J[] = { 4, 4, 6, 38, 32, 26, 24, 20, 18, 16, 16};
+
+ // Reset code for startup.
+ CodecReset(i2cHandle);
+
+ // Select page 0.
+ CodecPageSelect(i2cHandle, 0);
+
+ // Set I2S Mode and Word Length = 16 bits, BCLK and WCLK are inputs to the device.
+ CodecRegWrite(i2cHandle, 27, 0x00);
+ // Clock settings chip
+ CodecRegWrite(i2cHandle, 4, 0x03); // PLL CLock is CODEC_CLKIN
+ CodecRegWrite(i2cHandle, 5, 0x94); // PLL enabled, P = 1, R = 4
+ CodecRegWrite(i2cHandle, 6, J[sampleIndex]); // PLL J
+ CodecRegWrite(i2cHandle, 7, 0); // PLL D = 0
+ CodecRegWrite(i2cHandle, 8, 0); // PLL D = 0
+ // PLL_CLK = PLL_CLKIN * R * J.D / P = PLL_CLKIN * 4 * J = (Fs * 32) * 4 * J
+
+ // Clock settings DAC.
+ CodecRegWrite(i2cHandle, 11, 0x80 + NDAC[sampleIndex]); // NDAC is powered up
+ CodecRegWrite(i2cHandle, 12, 0x80 + MDAC[sampleIndex]); // MDAC is powered up
+ CodecRegWrite(i2cHandle, 13, DOSR[sampleIndex] / 256); // DOSR
+ CodecRegWrite(i2cHandle, 14, DOSR[sampleIndex] % 256);
+ // DAC_fs = CODEC_CLKIN / (NDAC * MDAC * DOSR)
+
+ // Clock settings ADC.
+ CodecRegWrite(i2cHandle, 18, 0x80 + NADC[sampleIndex]); // NADC is powered up, NADC = 2
+ CodecRegWrite(i2cHandle, 19, 0x80 + 2); // MADC is powered up, MADC = 2
+ CodecRegWrite(i2cHandle, 20, 128); // AOSR = 128
+ // ADC_fs = CODEC_CLKIN / (NADC * MADC * AOSR)
+
+ // Configure power supplies.
+ CodecPageSelect(i2cHandle, 1);
+ CodecRegWrite(i2cHandle, 1, 0x08); // AVdd and DVdd are connected
+ CodecRegWrite(i2cHandle, 2, 0x01); // LDO enabled AVDD LDO output = 1.72 V
+ CodecRegWrite(i2cHandle, 71, 0x32); // Aanalog input powerup = 6.4 ms
+ CodecRegWrite(i2cHandle, 123, 0x01); // Reference powered up in 40 ms
+
+ // Configure ADC channel.
+ // Route IN1L to Left MICPGA with 10K input impedance.
+ CodecRegWrite(i2cHandle, 52, 0x40);
+ // Route CM to Left MICPGA with 10K input impedance.
+ CodecRegWrite(i2cHandle, 54, 0x40);
+ // Route IN1R to Right MICPGA with 10K input impedance.
+ CodecRegWrite(i2cHandle, 55, 0x40);
+ // Route CM to Right MICPGA with 10K input impedance.
+ CodecRegWrite(i2cHandle, 57,0x40);
+ // Floating IN1L.
+ CodecRegWrite(i2cHandle, 58, 0xC0);
+
+ // Select Page 0.
+ CodecPageSelect(i2cHandle, 0);
+ // Power up LADC/RADC.
+ CodecRegWrite(i2cHandle, 81, 0xC0);
+ // Unmute LADC/RADC.
+ CodecRegWrite(i2cHandle, 82, 0x00);
+
+ // Configure DAC channel.
+ // Select Page 1.
+ CodecPageSelect(i2cHandle, 1);
+
+ // De-pop: soft stepping disabled, N = 5, Rpop = 6k. See SLAA408A page 11,12,13.
+ CodecRegWrite(i2cHandle, 20, 0x25);
+
+ // Route LDAC/RDAC to HPL/HPR.
+ CodecRegWrite(i2cHandle, 12, 0x08);
+ CodecRegWrite(i2cHandle, 13, 0x08);
+
+ // Power up HPL/HPR drivers.
+ CodecRegWrite(i2cHandle, 9, 0x30);
+
+ // Unmute HPL/HPR driver, 0dB Gain.
+ CodecRegWrite(i2cHandle, 16, 0x00);
+ CodecRegWrite(i2cHandle, 17, 0x00);
+
+ // Select Page 0.
+ CodecPageSelect(i2cHandle, 0);
+
+ // Unmute DAC, 0dB Gain.
+ CodecRegWrite(i2cHandle, 65, 0x00);
+ CodecRegWrite(i2cHandle, 66, 0x00);
+
+ // Select Page 1.
+ CodecPageSelect(i2cHandle, 1);
+
+ while (CodecRegRead(i2cHandle, 63) & 0x11000000 != 0x11000000)
+ {
+ UtilsDelay(27000); // delay 27000 * 3 = 81000 clock cycles @ 80 MHz ~ 1 ms.
+ }
+
+ // Select Page 0.
+ CodecPageSelect(i2cHandle, 0);
+
+ // Power up LDAC/RDAC.
+ CodecRegWrite(i2cHandle, 63, 0xd4);
+
+ // Unmute LDAC/RDAC.
+ CodecRegWrite(i2cHandle, 64, 0x00);
+}
diff --git a/dis10_lab2.3/config.h b/dis10_lab2.3/config.h
new file mode 100644
index 0000000..bfaa628
--- /dev/null
+++ b/dis10_lab2.3/config.h
@@ -0,0 +1,41 @@
+/*
+ * Configure functions to use the TI TLV320AIC3254 codec on the
+ * CC3200AUDBOOST board with the CC3220S-LAUNCHXL board
+ * without using DMA.
+ *
+ * Copyright (C) 2018, Hogeschool Rotterdam, Harry Broeders
+ * All rights reserved.
+ *
+ * Based on Driver for TI TLV320AIC3110 codec
+ * Copyright (C) 2015-2017 Texas Instruments Incorporated - http://www.ti.com/
+ * All rights reserved.
+ */
+#ifndef __HR_CONFIG_H__
+#define __HR_CONFIG_H__
+
+#include
+
+// Configure an I2C connection using the TI I2C driver.
+extern I2C_Handle ConfigureI2C(uint_least8_t index, I2C_BitRate bitRate);
+
+// Configure an I2S connection using the TI driverlib API.
+extern void ConfigureI2S(unsigned long peripheral, unsigned long base, unsigned int samplingFrequency);
+
+// Functions to configure the codec using an I2C connection
+// volume: 0 -> 0 bB (Highest) to 116 -> -72.3 dB (Lowest)
+extern void AudioVolumeControl(I2C_Handle i2cHandle, signed char volume);
+extern void CodecMute(I2C_Handle i2cHandle);
+extern void CodecUnmute(I2C_Handle i2cHandle);
+// Codec configure:
+ // PGA (Programmable Gain Amplifier) = 0 dB.
+ // Headphone Output = enabled.
+ // Line outputs (to class D amplifier) = disabled.
+ // ADC gain = 0 dB.
+ // AGC (Automatic Gain Control) = disabled.
+ // ADC processing block = PRB_R1 (default).
+ // Microphone = disabled.
+ // DAC processing block = PRB_P1 (default).
+ // DRC (Dynamic Gain Compression) = disabled.
+extern void ConfigureAudioCodec(I2C_Handle i2cHandle, unsigned int samplingFrequency);
+
+#endif
diff --git a/dis10_lab2.3/main_nortos.c b/dis10_lab2.3/main_nortos.c
new file mode 100644
index 0000000..3ff3005
--- /dev/null
+++ b/dis10_lab2.3/main_nortos.c
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2018, Hogeschool Rotterdam, Harry Broeders
+ * All rights reserved.
+ */
+
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+
+#include "ti_drivers_config.h"
+#include "config.h"
+
+// You can select the sample rate here:
+#define SAMPLINGFREQUENCY 32000
+
+#include "/home/mreenen/.local/MATLAB/R2022a/extern/include/tmwtypes.h"
+#include "anderanderezooi.h"
+#define N BL
+
+//#define N 32
+//const int BL = 32;
+//const int16_t B[32] = {
+// 1116, 1269, 1420, 1568, 1712, 1849, 1979, 2101, 2212,
+// 2312, 2400, 2474, 2535, 2581, 2612, 2628, 2628, 2612,
+// 2581, 2535, 2474, 2400, 2312, 2212, 2101, 1979, 1849,
+// 1712, 1568, 1420, 1269, 1116
+//};
+
+//#define N 33
+//const int BL = 33;
+//const int16_t B[33] = {
+// 47, -54, 19, 293, 744, 1292, 1820, 2188, 2274,
+// 1994, 1329, 337, -856, -2075, -3128, -3840, 27997, -3840,
+// -3128, -2075, -856, 337, 1329, 1994, 2274, 2188, 1820,
+// 1292, 744, 293, 19, -54, 47
+//};
+
+int16_t buffer_R[N];
+#if SAMPLINGFREQUENCY < 8000 || SAMPLINGFREQUENCY > 48000 || SAMPLINGFREQUENCY % 4000 != 0
+#error Sampling Frequency must be between 8 kHz and 48 kHz (included) and must be a multiple of 4 kHz.
+#endif
+
+int main(void)
+{
+ // Init CC3220S LAUNCHXL board.
+ Board_initGeneral();
+ // Prepare to use TI drivers without operating system.
+ NoRTOS_start();
+
+ printf("line-in_2_line_out: STEREO LINE IN ==> HP LINE OUT.\n");
+ printf("Sampling frequency = %d Hz.\n", SAMPLINGFREQUENCY);
+
+ // Configure an I2C connection which is used to configure the audio codec.
+ I2C_Handle i2cHandle = ConfigureI2C(CONFIG_I2C_0, I2C_400kHz);
+ // Configure the audio codec.
+ ConfigureAudioCodec(i2cHandle, SAMPLINGFREQUENCY);
+
+ // Configure an I2S connection which is use to send/receive samples to/from the codec.
+ ConfigureI2S(CONFIG_I2S_0, I2S_BASE, SAMPLINGFREQUENCY);
+ unsigned long n = 0;
+ unsigned long dataLeft, dataRight;
+ int k;
+ int i;
+ while (1)
+ {
+ long outR, v;
+ I2SDataGet(I2S_BASE, I2S_DATA_LINE_1, &dataLeft);
+ I2SDataPut(I2S_BASE, I2S_DATA_LINE_0,(int16_t) 0);
+ I2SDataGet(I2S_BASE, I2S_DATA_LINE_1, &dataRight);
+ buffer_R[n] = dataRight;
+ outR = 0;
+ for (k=0; k < BL; k++)
+ {
+ v = n - k;
+ if(v < 0){
+ outR += (B[k] * (long)buffer_R[(v + BL)]);
+ }else{
+ outR += (B[k] * (long)buffer_R[(v)]);
+ }
+ }
+ I2SDataPut(I2S_BASE, I2S_DATA_LINE_0, (outR >> 15));
+
+ n++;
+ if(n == BL) n = 0;
+ }
+ return 0;
+}
diff --git a/dis10_lab2.3/responce.png b/dis10_lab2.3/responce.png
new file mode 100644
index 0000000..afc85cb
Binary files /dev/null and b/dis10_lab2.3/responce.png differ
diff --git a/dis10_lab2.3/targetConfigs/CC3220S.ccxml b/dis10_lab2.3/targetConfigs/CC3220S.ccxml
new file mode 100644
index 0000000..e643caa
--- /dev/null
+++ b/dis10_lab2.3/targetConfigs/CC3220S.ccxml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dis10_lab2.3/targetConfigs/readme.txt b/dis10_lab2.3/targetConfigs/readme.txt
new file mode 100644
index 0000000..af97b62
--- /dev/null
+++ b/dis10_lab2.3/targetConfigs/readme.txt
@@ -0,0 +1,9 @@
+The 'targetConfigs' folder contains target-configuration (.ccxml) files, automatically generated based
+on the device and connection settings specified in your project on the Properties > General page.
+
+Please note that in automatic target-configuration management, changes to the project's device and/or
+connection settings will either modify an existing or generate a new target-configuration file. Thus,
+if you manually edit these auto-generated files, you may need to re-apply your changes. Alternatively,
+you may create your own target-configuration file for this project and manage it manually. You can
+always switch back to automatic target-configuration management by checking the "Manage the project's
+target-configuration automatically" checkbox on the project's Properties > General page.
\ No newline at end of file