AnsweredAssumed Answered

Adau1452: Safeload Write with Arduino through SPI

Question asked by op-electronics on Oct 2, 2016
Latest reply on Oct 12, 2016 by DaveThib

Hi there!

 

I built an ADAU1452  based  proto board, it works great but i'm experiencing problems while trying to send safeload writes through SPI with Arduino. The Arduino is the Nano 3.0 with a CD4050 non-inverting buffer for logic level conversion from 5V to 3.3V.

 

In more details i've found that certain times the safeload write fails while other times it is succesful. The SPI communication through USBi works great and i'm using same pcb headers both with Arduino to Adau than USBi to Adau.

 

This is what i'm doing:

 

- program the dsp through USBi, the program is made from a single Sine Tone block and 1 output.

- write the dsp program to eeprom

- upload the code to Arduino

 

Dsp program starts with Sine Tone block on

Arduino sketch should turns off the Sine Tone block and  then turns it on after 2 seconds, so it's just 2 safeload writes.

 

With the dsp running the program i often have to hit Nano reset button several times to reload the sketch before get a safeload write success.

 

The Arduino code is raw and crude beyond belief but it's just for testing purposes to understand how safeload works.

 

Program sampling  is 48Khz and i gave 100us delay between each safeload to stay well large.

 

I'm working on breadboard and i've checked every single wire:

 

#include <SPI.h>

void setup(){   

pinMode(10, OUTPUT);
digitalWrite(10, HIGH);
digitalWrite(10, LOW);   
delayMicroseconds(1);   
digitalWrite(10, HIGH);   
digitalWrite(10, LOW);   
delayMicroseconds(1);   
digitalWrite(10, HIGH);   
digitalWrite(10, LOW);   
delayMicroseconds(1);   
digitalWrite(10, HIGH);  
    
SPI.begin();SPI.beginTransaction(SPISettings(1000000, MSBFIRST, SPI_MODE3));
digitalWrite(10, LOW);
SPI.transfer(0x00);
SPI.transfer(0x00);
SPI.transfer(0x14);
SPI.transfer(0x00);
SPI.transfer(0x00);
SPI.transfer(0x00);
SPI.transfer(0x00);
digitalWrite(10, HIGH);
SPI.endTransaction();

SPI.beginTransaction(SPISettings(1000000, MSBFIRST, SPI_MODE3));
digitalWrite(10, LOW);
SPI.transfer(0x00);
SPI.transfer(0x00);
SPI.transfer(0x19);
SPI.transfer(0x00);
SPI.transfer(0x00);
SPI.transfer(0x00);
SPI.transfer(0x1B);
digitalWrite(10, HIGH);
SPI.endTransaction();

SPI.beginTransaction(SPISettings(1000000, MSBFIRST, SPI_MODE3));
digitalWrite(10, LOW);
SPI.transfer(0x00);
SPI.transfer(0x00);
SPI.transfer(0x1A);
SPI.transfer(0x00);
SPI.transfer(0x00);
SPI.transfer(0x00);
SPI.transfer(0x01);
digitalWrite(10, HIGH);
SPI.endTransaction();

delayMicroseconds(100);

delay(2000); 
SPI.beginTransaction(SPISettings(1000000, MSBFIRST, SPI_MODE3));
digitalWrite(10, LOW);
SPI.transfer(0x00);
SPI.transfer(0x00);
SPI.transfer(0x14);
SPI.transfer(0x00);
SPI.transfer(0x50);
SPI.transfer(0xF4);
SPI.transfer(0x4E);
digitalWrite(10, HIGH);
SPI.endTransaction();

SPI.beginTransaction(SPISettings(1000000, MSBFIRST, SPI_MODE3));
digitalWrite(10, LOW);
SPI.transfer(0x00);
SPI.transfer(0x00);
SPI.transfer(0x19);
SPI.transfer(0x00);
SPI.transfer(0x00);
SPI.transfer(0x00);
SPI.transfer(0x1B);
digitalWrite(10, HIGH);
SPI.endTransaction();

SPI.beginTransaction(SPISettings(1000000, MSBFIRST, SPI_MODE3));
digitalWrite(10, LOW);
SPI.transfer(0x00);
SPI.transfer(0x00);
SPI.transfer(0x1A);
SPI.transfer(0x00);
SPI.transfer(0x00);
SPI.transfer(0x00);
SPI.transfer(0x01);
digitalWrite(10, HIGH);SPI.endTransaction();

delayMicroseconds(100);

}

void loop(){}

 

 

    Hope you can help

 

Thank you!

 

Omar

Outcomes