I would try a combination of the two clock options:
this is one where the BCLK is generated by the AD1938 while the WCLK is generated by the BBB:
diff --git a/core/Spi_Codec.cpp b/core/Spi_Codec.cpp
index c1a27ceb..c0fc25ad 100644
--- a/core/Spi_Codec.cpp
+++ b/core/Spi_Codec.cpp
@@ -154,8 +154,8 @@ int Spi_Codec::initCodec(){
writeRegister(REG_ADC_CONTROL_1, 0x23);
if(_isBeast)
{
- // wclock format = 50/50, 16 channels, normal bclock, inverted wclock, bclock / wclock in master mode
- writeRegister(REG_ADC_CONTROL_2, 0x7C);
+ // wclock format = 50/50, 16 channels, normal bclock, inverted wclock, bclock in master mode / wclock in slave mode
+ writeRegister(REG_ADC_CONTROL_2, 0x74); // was 0x6C
} else {
// wclock format = 50/50, 8 channels, normal bclock, inverted wclock, bclock / wclock in master mode
writeRegister(REG_ADC_CONTROL_2, 0x6C);
@@ -402,7 +402,7 @@ McaspConfig& Spi_Codec::getMcaspConfig() {
mcaspConfig.params.ahclkIsInternal = true; // ignored in practice
mcaspConfig.params.ahclkFreq = 12000000; // ignored in practice
mcaspConfig.params.aclkIsInternal = false;
- mcaspConfig.params.wclkIsInternal = false;
+ mcaspConfig.params.wclkIsInternal = true;
mcaspConfig.params.wclkIsWord = true;
mcaspConfig.params.wclkFalling = false;
mcaspConfig.params.externalSamplesRisingEdge = true;
and this is another variation where the BCLK is generated by the BBB while the WCLK is generated by the AD1938:
diff --git a/core/Spi_Codec.cpp b/core/Spi_Codec.cpp
index c1a27ceb..a0839d47 100644
--- a/core/Spi_Codec.cpp
+++ b/core/Spi_Codec.cpp
@@ -154,8 +154,8 @@ int Spi_Codec::initCodec(){
writeRegister(REG_ADC_CONTROL_1, 0x23);
if(_isBeast)
{
- // wclock format = 50/50, 16 channels, normal bclock, inverted wclock, bclock / wclock in master mode
- writeRegister(REG_ADC_CONTROL_2, 0x7C);
+ // wclock format = 50/50, 16 channels, normal bclock, inverted wclock, bclock in slave mode / wclock in master mode
+ writeRegister(REG_ADC_CONTROL_2, 0x3C); // was 0x74
} else {
// wclock format = 50/50, 8 channels, normal bclock, inverted wclock, bclock / wclock in master mode
writeRegister(REG_ADC_CONTROL_2, 0x6C);
@@ -401,7 +401,7 @@ McaspConfig& Spi_Codec::getMcaspConfig() {
mcaspConfig.params.bitDelay = 1;
mcaspConfig.params.ahclkIsInternal = true; // ignored in practice
mcaspConfig.params.ahclkFreq = 12000000; // ignored in practice
- mcaspConfig.params.aclkIsInternal = false;
+ mcaspConfig.params.aclkIsInternal = true;
mcaspConfig.params.wclkIsInternal = false;
mcaspConfig.params.wclkIsWord = true;
mcaspConfig.params.wclkFalling = false;
I think the first of the two has some chance of working ...