Hi everybody! I have a sensor ISM330DXCX and I want connect it to ESP32 (38 Pin) micro controller by SPI communication. I have cut two jumpers, connected CS pin of sensor to P5 of ESP32, SCX pin to P18, POCI to P23, PICO to P19. I tried different sketches but I got no success. Could somebody to explain me how to connect this sensor to ESP32 correct. Than you in advance!
I think your pins for 19 & 23 are reversed
I tried change pins 19 to 23. I got the same negative result. I see on ISM330DHCX pins SCL, SCX, OCS. What is a purpose of these pins. Which of them do I need to use as SPI communication SCK?
Did you test the ISM330DHCX separately?
Yes, of course. It was working using I2C communication. For SPI communication I have cut two jumpers (I2C and ADDR) on ISM330DHCX module but cannot get data from sensor using example4_spi sketch from SparkFun 6DoF ISM330DHCX library. I tried and other sketches, the module initializing is ok but data are corrupted. I the CS pin is working. Sometimes the data appears when I touch by my finger usb connector ground.
it sounds like a wiring cable problem if touching the device changes the behavior
Which of pin form SCL, SCX, OCS on ISM330DHCX do I need to use for SPI clock? Do I need to set specific SPI clock frequency in my sketch when I use this sensor with ESP32 micro controller?
You have many pins available but it’ll depend on your specific esp32 board/version…google for info about yours and match the relevant available pins
On ESP32 I have these pins for SPI: VSPI_MOSI, VSPI_MISO, VSPI_CLK, VSPI_CS0. I want to ask which pin of ISM330DHCX module do I need to use for connecting to VSPI_CLK? Which of pin of SCL, SCX or OCS on ISM330DHCX do I need to use for SPI clock?
Again, you just match them up; see the hookup guide for SPI pins (also below!)
SCL on the ISM330DHCX is the Serial Clock input pin, which corresponds to the VSPI_CLK on the ESP32.
VSPI_CLK on the ESP32 should be connected to the SCL pin on the ISM330DHCX.
The other pins should be connected as follows:
VSPI_MOSI (ESP32) to SDA (front label)/PICO (back) (ISM330DHCX)
VSPI_MISO (ESP32) should be connected to the POCI pin on the ISM330DHCX
VSPI_CS0 (ESP32) to CS (ISM330DHCX)
To clarify:
SCX on the ISM330DHCX is not used for SPI communication. It’s used for I2C communication when the device is in I2C mode.
OCS (Output Data Rate Configuration Selection) is not related to SPI communication. It’s used to select between different ODR (Output Data Rate) configurations.
Note the other operating modes are noted in the hookup guide as well
Thank you very much for the information. I will try to connect the accelerometer module according to your suggestion.
Please give the update after trying.
Thank you everyone here for the help. I have connected ISM330DHCX module to ESP32 using SPI. It is working , I get the data.