Do you have a different sensor you can test in its place?
Does the regular blink sketch work as expected?
Have you tried swapping to the other qwiic port?
Is anything else on the i2c bus?
I only purchased 1 sensor. The regular blink sketch and other I2C sketches all work fine. I have tried bot QWIIC connectors and there is nothing else connected to the board.
I’ve got the same issue. I’ve tried it with nothing else on the bus and have swapped a second one in it’s place to no avail. I also tried rolling back to earlier versions of the qwiic ultrasonic and toolkit libraries but nothing has helped. It freezes until you unplug it and plug it back in. Then it outputs zeros and when you plug it back in it freezes again.
Thanks all for your patience while I figure this out. I found the hiccup but I’m not sure of the solution.
TLDR : A request for data from the Ultrasonic sensor by particular processors freezes the I2C bus but the solution is not yet clear. Feedback is welcome.
After the initial I2C ping that occurs within the begin function at the top of the basic example, the next I2C transaction is during the triggerAndRead function call. Here the processor sends a command (I2C address + Write Bit + Command): 0x2F + 0 + 0x01, and then a request for data (I2C address + Read Bit): 0x2F + 1. Below is a screen shot of two different processors during the “reading” portion of the transaction. The first is the ESP32 where this transaction is completed successfully - notice the arrow following the rising clock as data is sent from the sensor (ironically the sensor is face down on my desk when I got this screen shot so zero is the correct value).
Above, the clock never rises and never recovers as the sensor never gives data and never times out, and no value is returned. The initial set value of the variable distance is “0”, and is not overwritten (pass by reference) and so the Serial Terminal prints out “0”. You can check the error value of the triggerAndRead function which is -1, indicating a general failure. When you reset the Teensy using the “Boot” button the bus is still frozen in this manner and so the begin function fails to connect to the sensor. You have to do a hard reset of the processor by unplugging it so that the I2C bus is reset.
Are other processors more forgiving or is the Teensy more sensitive? Is the Ultrasonic not able to take over the data line? I still have a list of things to test but I hope to have a solution soon.