tdk-invn-oss / ultrasonic.arduino.ICUX0201

Arduino Driver for TDK InvenSense consumer ultrasonic sensor family ICUX0201
https://invensense.tdk.com/smartsonic
BSD 3-Clause "New" or "Revised" License
2 stars 1 forks source link

Measurements and SPI transmissions stop after some time with 4 sensors #9

Open vmanoj1996 opened 4 days ago

vmanoj1996 commented 4 days ago

I have made some minor modifications to the library to handle 4 sensors. https://github.com/vmanoj1996/ultrasonic.arduino.ICUX0201

Here is my brief workflow:

  1. Initialize the sensors. first one in tx, rx mode and the rest are only receiving.
  2. Trigger
  3. Wait for data ready. Once data is ready, read it and trigger again.

For 2 sensors, it works robustly. But when I have 4 sensors connected, the sensor stops after some time sporadically.

Lowering the SPI clock speed from 12MHz to 6MHz seems to help. Additionally, length of ribbon cables going to the sensor seems to have an effect on this.

Are there some cabling or clock speed guidelines for using ICU30201 sensor.

For some reason, it works robustly with ICU Evaluation utility.

I used teensy 4.0.

Is there a possibility of signals (clock or data) getting corrupted as stated in this page, https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/643087/tm4c1294kcpdt-spi-terminations-for-multiple-slave

I have a 25MHz logic analyzer and can get one oscilloscope to debug further. But not sure what to look for. Any guidelines would help.

vmanoj1996 commented 4 days ago

The code is here code.txt

rprzybyla-invn commented 3 days ago

Hi Manoj, Good question. Yes, I think ringing on the clock line is a possible culprit. This can definitely be a problem as the flex cables get longer. The resource you found seems to be describing a similar problem we have faced in the past. I am not sure about the arduino hardware, but you may also be able to configure the rise/fall time of the SCLK to improve the performance - this might explain the difference between Arduino and our devkit.

Here is a selection of alternate flex cables, if you don't need the full length it might be a good workaround for you to use shorter flexes: https://www.newark.com/w/c/cable-wire-cable-assemblies/cable-assemblies/ffc-fpc-flat-flex-jumper-cables?no-of-cores=12conductor&pitch-spacing=0.5mm&contact-orientation=same-sided-contacts&sort=adf_f1001602_bv

vmanoj1996 commented 3 days ago

Got it. Thanks for the insight. This is what I was looking for.

Additionally, are there any other things that I can try. Will adding any resistors on the clock line help? I read it in a few forums like the above one.

vmanoj1996 commented 3 days ago

Just curious, are there any SPI buffers on the Smart Sonic EVK board.