Help can only be given when you answer the questions asked of you.
I need this string 0x010000001
byte dataArray[] = {0x01, 0x00, 0x00, 0x01,}; // elements 0,1,2,3 in that order
digitalWrite (ssPin, LOW);
SPI.transfer[dataArray[0]);
SPI.transfer[dataArray[1]);
SPI.transfer[dataArray[2]);
SPI.transfer[dataArray[3]);
digitalWrite (ssPin, HIGH);
Hi Crossroads,
Thank For your help!
May I know if I would like to write 2 different 32bits can I do this?
void loop()
{
byte dataArray[] = {0x01, 0x00, 0x00, 0x01}; // elements 0,1,2,3 in that order
byte dataArray1[]= {0x00, 0x03, 0x00, 0x11};
digitalWrite(53, HIGH); //output SEN high
SPI.transfer(dataArray[0]);
SPI.transfer(dataArray[1]);
SPI.transfer(dataArray[2]);
SPI.transfer(dataArray[3]);
digitalWrite(53,LOW); // Set SEN LOW once 32bits is sent
digitalWrite(53, HIGH); //output SEN high
SPI.transfer(dataArray1[0]);
SPI.transfer(dataArray1[1]);
SPI.transfer(dataArray1[2]);
SPI.transfer(dataArray1[3]);
digitalWrite(53,LOW); // Set SEN LOW once 32bits is sent
}
Thank You.
Your SEN high/lows are swapped from conventional usage, otherwise looks ok.
Unless your particular hardware needs them that way.
Yup my hardware needs them this way.
Would I be able to increase the number of different 32bits address as well?
Thank You.
Sure. Make more arrays. Or: make 1 big array, every 4 bytes is a new address.
Change your loop:
for (x=0; x<47; x=x+4){ // 12 four-byte addresses
digitalWrite(53, HIGH); //output SEN high
SPI.transfer(dataArray[x]); // 0,4,8,12,16 ...
SPI.transfer(dataArray[x+1]); // 1,5,8,13,17 ...
SPI.transfer(dataArray[x+2]); // 2,6,9,14,18 ...
SPI.transfer(dataArray[x+3]); // 3,7,10,15,19 ...
digitalWrite(53,LOW); // Set SEN LOW once 32bits is sent
}
May I know if we can control the amplitude?
And my waveform is not as square is there a problem?
Thank you
Is it possible to change or invert the default signal which is now high on my MOSI.
Image as attached.
Thanks!
Not square is either a scope problem (too low a bandwidth for high speed edges), or too much load on the line. Your scope trace looks okay to me.
MOSI being high - look at SPI
There different Modes - perhaps one of the other modes will leave MOSI in your desired state.
I am never concerned about it, as MOSI is usually Serial In to something else and it's state is only important at the appropriate SCK clock edge.
Thanks!
What I understand is that the modes are to determine rising or falling edge and the base of the clock.
There is no indication of the MOSI base.
Then it should not be important.
Why do you need it low?
I am not sure if will affect my chip as in the data sheet it shows an low initial.
Anyway, it should not affect the readability of the SPI right as long as the address and enable are in sync with the clock?
Correct.
