PT8211 working.
this chip needs a big bypass capacitor else the signal
is very distorted.
the I2S data-sheet says we need to set CKP here but the
chip data-sheet says it's forced to 1. not sure what
to do really ;-0)
--- a/src/pic32.c Tue Mar 07 02:52:51 2017 +0000
+++ b/src/pic32.c Tue Mar 07 04:27:21 2017 +0000
@@ -127,7 +127,13 @@
SPI1BRG = I2S_BRG;
/* SPI 1 AUDIO MODE */
- SPI1CONbits.CKP = 1; /* CLOCK POLARITY */
+#if DACTYPE == CS4334
+ SPI1CONbits.CKP = 1; /* CLOCK POLARITY */
+#else
+ SPI1CONbits.CKP = 0; /* CLOCK POLARITY */
+ SPI1CONbits.FRMPOL = 1;
+ SPI1CON2bits.AUDMOD = 1; /* LEFT JUSTIFIED */
+#endif
SPI1CONbits.MSTEN = 1; /* MASTER MODE */
SPI1CON2bits.AUDEN = 1; /* AUDIO PROTOCOL ENABLED */
--- a/src/pic32.h Tue Mar 07 02:52:51 2017 +0000
+++ b/src/pic32.h Tue Mar 07 04:27:21 2017 +0000
@@ -22,6 +22,14 @@
#define FCY (48000000UL)
+/*
+ * DAC TYPE
+ */
+#define CS4334 (1) /* I2S MODE */
+#define PT8211 (2) /* LEFT-JUSTIFIED MODE */
+
+#define DACTYPE (PT8211)
+
#if 0
/*
* SAMPLE RATE = 44100