cancel
Showing results for 
Search instead for 
Did you mean: 

We have manufactured a circuit for the STuW81300. We have conected it to an Arduino We are not able to discriminate if the problem comes from the circuit or from the code.

GLeon.3
Associate

Dear Friends. We have manufactured a circuit for the STuW81300. We have conected it to an Arduino Due. But, we are not able to code the STuW81300 and we are not able to discriminate if the problem comes from the circuit or from the code.

We want to reproduce the datasheet example. Pin 2 are linked to the HD_PW, Pin 3 to RF1 and Pin 4 to RF2 power.  

This is the arduino code... Do you see any problem? Thank you for your help. 

#include <SPI.h>     // Include Arduino SPI library

byte ST9[4]= {0x48, 0x00, 0x00, 0x00};

byte ST8[4]= {0x40, 0x00, 0x00, 0x00};

byte ST7[4]= {0x39, 0x00, 0x00, 0x00};

byte ST6[4]= {0x30, 0x00, 0x10, 0x00};

byte ST5[4]= {0x28, 0x00, 0x00, 0x00};

byte ST4[4]= {0x20, 0x03, 0x93, 0x15};  

byte ST3[4]= {0x18, 0x00, 0x80, 0x02};  

byte ST2[4]= {0x10, 0x00, 0x00, 0x0A};  

byte ST1[4]= {0x09, 0x40, 0x00, 0x01};  

byte ST0[4]= {0x03, 0xE0, 0x00, 0x4C};  

const int CS = 10;    // Chip Select pin for SPI

void setup() {

  

Serial.begin(9600);

SPI.begin();

//SPI.setClockDivider(SPI_CLOCK_DIV8);//divide the clock by 8 

//SPI.setDataMode(SPI_MODE0);

Serial.print("Start \t");

init_stuw81300 ();

Serial.print("Started \t");

}

void loop() {

 // put your main code here, to run repeatedly:

delay(40);

}

void init_stuw81300() {

digitalWrite(2,LOW);

digitalWrite(3,HIGH);

digitalWrite(4,LOW);

writeReg(ST9);

writeReg(ST8);

writeReg(ST7);

writeReg(ST6);

writeReg(ST5);

writeReg(ST4);

writeReg(ST3);

writeReg(ST2);

writeReg(ST1);

writeReg(ST0);

}

void writeReg(byte ST[4] ){

 digitalWrite(SS, LOW);

 for (int ii=0; ii<4; ii++){

 SPI.transfer (ST[ii]);

}

digitalWrite(SS, HIGH);

delay(40);

}

This discussion has been locked for participation. If you have a question, please start a new topic in order to ask your question
0 REPLIES 0