T249 i2c always returns -1 for current position

I am trying to control a T249 (firmware 1.06) from a Raspberry Pi 3B+ using Python3.
Using the example code: https://www.pololu.com/docs/0J71/12.7
I can move the servo to different positions, but get_current_position() always returns -1.
I have checked the i2c signals on a scope and they are clean, and it shows the same value always being returned.

Any help is appreciated, as I’m running out of ideas.
Thank you

Hello, corgitronics.

The example code you linked to does not use I2C; it is using TTL serial. Can you clarify what interface you are using and post your complete code? Could you post some captures of your scope traces, as well as a copy of your Tic settings file? You can save your Tic settings file by selecting the “Save setting file…” option within the “File” drop-down menu of the Tic Control Center while the Tic is connected. Also, could you post the output of calling “ticcmd --status” in a shell while the Tic is connected?

Brandon

I was going to post code and such, then realized that I had used the normal i2c port, smbus(1). Which works for controlling the board, but not for getting any data back from it. I switched to smbus(3) and over to those pins and now it can read-back just fine. Somehow after the first reading of the page I just skipped doing that.

So, why does it work on the alternate i2c port?
Does it have something to do with the board using clock stretching and the regular i2c port can’t handle that?
I’d be interested, as switching to smbus(3) will require respinning my board… but it’s still a prototype.
Thanks for your help on my other question about the serial issue.

As noted in the Tic user’s guide, the hardware I2C module on the Raspberry Pi has a bug. Our workaround is to use the i2c-gpio overlay instead, which implements I2C using general-purpose I/O pins and bit-banging.

If you want to avoid redoing your PCB, you should look at the Raspberry Pi Linux kernel overlay documentation, which documents the parameters of the i2c-gpio overlay, including parameters for selecting which pins to use. If you disable the hardware I2C, you can probably assign the GPIO I2C to use the same pins.

–David