mCube Accelerometer error

Hi All,

I have received this code from one of the FAE’s from this company (mcube) and when I ran this code, it complies and there is no issues even when I even upload this to the arduino Mega 2560. When I start the Serial monitor I don’t see the Accelerometer numbers getting displayed on the screen, I see bunch of (-1,-1,-1). He originally wrote this SPI code since I wanted to install 10 of these Accelerometer to my arduino mega 2560 board at the same time (the code only contains 2 devices but that could easily get modified to 10 sensors). I looked at the SPI signal through my digital oscilloscope and it seems that they are sending a command but there is nothing getting displayed on the serial command of my computer. they even checked my arduino (converted the i/o voltage to 3. something volts)and my PCB and said it worked on there side. Can anyone come up with a better example code for 10 mcube sensors? I have attached the files and the data sheet of the part below. Any help in this matter will be deeply appreciated.

Thank you.

MC3630.cpp (9.28 KB)

MC3630.h (7.43 KB)

test_spi.ino (672 Bytes)

Sorry the file is so large that it did not get uploaded, please see the link below:

Best Regards,

How do you have the device(s) wired?

johnwasser:
How do you have the device(s) wired?

Arduino to MC3630
MOSI (Master output slave input) pin 51 to SDA (DIN_SDA) pin 2
MISO (Master input slave output) pin 50 to SDO (DOUT_A1) pin 1
SCK (Clock) pin 52 to SCK (SCK_SCL) pin 12
SS (Chip select) pin 53 to SCS pin 10

aghaderi2006:
Arduino to MC3630
MOSI (Master output slave input) pin 51 to SDA (DIN_SDA) pin 2
MISO (Master input slave output) pin 50 to SDO (DOUT_A1) pin 1
SCK (Clock) pin 52 to SCK (SCK_SCL) pin 12
SS (Chip select) pin 53 to SCS pin 10

Are you wiring direct to that 2x2mm 12-pin package?!? What about power and ground? What about the recommended bypass capacitor?