Hello!
I try to use the "MC33996" of freescale but no success.
Here is the datasheet:
product page
datasheet
I make wiring as it is in first page.
then the code to turn all outputs ON:
#include <SPI.h>
const int csPin = 53;
void setup() {
Serial.begin(9600);
SPI.begin();
SPI.setBitOrder(MSBFIRST); //We know this from the Data Sheet
SPI.setClockDivider(SPI_CLOCK_DIV4);
}
void loop() {
delay(1000);
digitalWrite(csPin, LOW); //select slave
SPI.transfer(0x00); //command
SPI.transfer(0xFF); //first 8 outputs ON
SPI.transfer(0xFF); //last 8 outputs ON
digitalWrite(csPin, HIGH); //de-select slave
Serial.println("done");
}
Do you havw any suggestion how to make this work?
Thank you!
I presume this is connected to a Mega?
MOSI -> D51
MISO -> D50
SCK -> D52
Yes, like this, with arduino mega.
Is the code of transferring SPI 24 bit correct?
Hi athtest
Try changing the SPI mode. Default is 0, I think, so add this ...
SPI.setDataMode(SPI_MODE1);
Regards
Ray
It is mode 1. I missed that. Good eye, Ray!
Thanks for the responses.
Still i cannot make it work.
These are from logic analyzer:
initialize spi after SOPWR on
initialize spi after arduino output pin HIGH>LOW>HIGH for ic reset
I don't know why they are different.
From the datasheet
"SPI Integrity Check : Checking the integrity of the SPI communication is recommended upon initial power-up of the SOPWR pin. After initial system start-up or reset, the MCU writes one 48-bit pattern to the 33996.
The first 24 bits read by the MCU is the fault status of the outputs, while the second 24 bits is the first bit pattern sent. By the MCU receiving the same bit pattern it sent, bus integrity is confirmed."
I understand that i must get the first 24bit zeros, and the last 24bit the echo of my command. But i don't get this from the device.
and the wiring:
common power supply schematic
external 12v power supply - common GND
The reset is active low. So can i directly connect to arduino digital output pin or must i use pullup/pulldown resistor? i get confused. I tried all but no success.
Sorry for my english and questions, but i am new to arduino and try to do my second, more advanced(?) project.
Thank you.
athtest:
and the wiring:
common power supply schematic
external 12v power supply - common GND
If you have labeled your Schematic correctly, You have MOSI (Master Out/Slave In) on the Arduino connected to SO (Slave Out)?
And MISO (Master In/Slave Out) connected to SI (Slave In)?
This is backwards. It should be MOSI -> SI, MISO <- SO.
Chuck.
Check out my Kickstarter Project Memory Panes an expansion RAM Shield for Mega2560's. It adds 1MB of RAM for those projects where 8KB is not enough.
Thanks!!!
I must report it to freescale. Their schematic is wrong.
Thank you again!!!