Hello,
I'm trying to interface SPI1 with the MAX6952 and I am having a hell of a time trying to figure out what is going wrong. This is a MAX6952 PDIP with a Teensy4.1. Since the MAX can operate at 3.3V, that is the voltage being used so I can interface directly with the Teensy.
I have the following pin connections:
Teensy -> MAX 6952
1 (MISO1) -> 22 (DOUT)
2 (GPIO PIN 2) -> 23 (CS) * This pin has a 10K pull up.
26 (MISI1) -> 20 (DIN)
27 (SCK1) -> 21 (CLK)
The code I have is the following:
The problem I am seeing for the above code, I am seeing this output:
I'm not concerned yet about the input line, but the output never is the data I am trying to transfer. I'm also not sure why the CS line is going high except between the two transactions (and the delay isn't 50ms either). Any thoughts to what I can look at or try? I'm running out of thoughts.
Thanks,
-Kevin
I'm trying to interface SPI1 with the MAX6952 and I am having a hell of a time trying to figure out what is going wrong. This is a MAX6952 PDIP with a Teensy4.1. Since the MAX can operate at 3.3V, that is the voltage being used so I can interface directly with the Teensy.
I have the following pin connections:
Teensy -> MAX 6952
1 (MISO1) -> 22 (DOUT)
2 (GPIO PIN 2) -> 23 (CS) * This pin has a 10K pull up.
26 (MISI1) -> 20 (DIN)
27 (SCK1) -> 21 (CLK)
The code I have is the following:
Code:
/* Arduino Libaries */
#include <Arduino.h>
#include <SPI.h>
#include <Audio.h>
/* Local includes */
#include "include/System.h"
/*******************************************************************************
* Module/GLobal Variable Definitions *
*******************************************************************************/
AudioInputAnalog adc1(A2); //xy=310,312
AudioMixer4 mixer1; //xy=455,333
AudioOutputI2S i2s_1; //xy=634,404
AudioAnalyzeFFT256 fft256_1; //xy=636,362
AudioConnection patchCord1(adc1, 0, mixer1, 1);
AudioConnection patchCord3(mixer1, fft256_1);
AudioConnection patchCord4(mixer1, 0, i2s_1, 0);
AudioConnection patchCord5(mixer1, 0, i2s_1, 1);
int incomingByte = 0; // for incoming serial data
/*******************************************************************************
* Source Code *
*******************************************************************************/
/*******************************************************************************
* Function: setup
* Description: Setup function for the LCU application
* Inputs: None
* Outputs: None
* Notes:
*******************************************************************************/
void setup(void)
{
/* Serial interface */
while (!Serial && millis() < 5000)
{
/* wait up to 5 seconds for Arduino Serial Monitor */
}
//system_StartupSequence(); /* See if this is failing because the i2s is being used. You may need to ignore those pins as well */
//AudioMemory(30);
//mixer1.gain(0, 1.0);
pinMode(2, OUTPUT);
}
void loop(void)
{
/*
if (fft256_1.available()) {
for (int i=0; i < 20; i++) { // print the first 20 bins
//Serial.print(fft256_1.read(i) * 100, 5);
//Serial.print(" ");
}
//Serial.println();
}
*/
SPI1.begin();
while(1)
{
SPI1.beginTransaction(SPISettings(2000000, MSBFIRST, SPI_MODE0));
digitalWrite(PIN_02, LOW);
SPI1.transfer(0x04);
SPI1.transfer(1);
digitalWrite(PIN_02, HIGH);
SPI1.endTransaction();
delay(50);
SPI1.beginTransaction(SPISettings(2000000, MSBFIRST, SPI_MODE0));
digitalWrite(PIN_02, LOW);
SPI1.transfer(0x00);
SPI1.transfer(0x5B);
digitalWrite(PIN_02, HIGH);
SPI1.endTransaction();
}
}
The problem I am seeing for the above code, I am seeing this output:
I'm not concerned yet about the input line, but the output never is the data I am trying to transfer. I'm also not sure why the CS line is going high except between the two transactions (and the delay isn't 50ms either). Any thoughts to what I can look at or try? I'm running out of thoughts.
Thanks,
-Kevin