Benewake TFmini-S: How to issue commands to change from UART to I2C?

Thank you Patrick.
Do you have any idea how to tell which device you have. I have an I2C only TFMini and I can’t find anything about it. I have no idea if its an S model or some other weird unknown device.

I do know what the TF mini Plus looks like. Just waiting on a working one to show up.

What I can tell, is the TFMini-s has V1.8 Revision on pc board , I am not aware of a command to inquire about model (or Rev.).

This appears to be a 1.6 board
image

It looks like a 1.5 modified
The 1.8 has a different configuration with a smaller microcontroller

Hello,

I have a similar problem.
Can you recommend a CAN to uart converter?

Beck,ive ordered this one last week, https://store.mrobotics.io/category-s/179.htm may be couple weeks before here and got a few projects on the go plus ill health is slowing things down but seems good bit of kit

So does a 1.5 board work…I suspect not but your the guru not me.

1 Like

My guess is that rev 1.8 corresponds to the dual mode (both Serial-I2C) and previous versions might be single mode and not compliant for I2C.

1 Like

Rickyg32 - here’s my board

Wow thats a huge difference.
Well mine is in a box in the shop. I have a TF Mini Plus on its way so will make the move to that device.
Thanks all for your input…hopefully the replacement works well and I can get on with it.

1 Like

ppoirier - If you swap positions with map or expand HUD it doesn’t overwrite, but as default it does. Is there a way to define position of user items in HUD screen? If not why not for developers :slight_smile:

What I really want is a way to get that into my VTX OSD, or a pixhawk compliant OSD that can. I’m currently using a Holybro MicroOSD V2 - the editing program is ArduCAM OSD Config but doesnt have a parameter for range finder.

@pilotltd, my PCB looks exactly the same which is the TFmini-S, same version number and layout.

@ppoirier, When I had the OLED and Lidar on the same I2C bus neither worked. When I had the Lidar only connected the I had erratic update frequency and incorrect range readings. I have no idea re pull-up resistors. My FC is a Holybro Pixhawk 4, it came with a I2C bus board that extends the bus by 4 connections. Would you suggest to terminate the last connector with pull-up resistors ? I have no other way to physically add them, I can only use one of the spare cable to solder them in basically.

Thanks
Jan

@pilotltd may I suggest you open a new discussion on Mission Planner tag and @Michael_Oborne will look at it.

@snoozer yes a simple “termination” connector/cable can do the job

My replacement TF Mini Plus arrived today. Plugged it into my pc opened the app, connected and boom data. So for sure the first one was faulty.
Dumb question @ppoirier
If these commands convert it to I2C mode.
5A 05 0A 01 6A
5A 04 11 6F
Does the device stay in UART mode till its rebooted.
Also how do you convert it back to UART
.

The first command select the I2C mode
The second saves the mode in non volatile memory

To revert to serial, you need to send the command on I2C mode, that can be done with an Arduino or from a Rasberrypi using the i2cdetect shell utility

@ppoirier, thanks for the suggestions. I have hooked up a scope to the I2C port 1st with the OLED display and I had a clean clock and data signal without any external pull-up resistors. The clock measured about 87kHz. Display works perfect.

Next I reconfigured the Pixhawk 4, removed the OLED and disabled the display in the config, set the address for the TFmini S to 16 (0x10 in hex) and used type 25. I get a reading of 10cm which is WAY off and it does not change. Also the GPS goes wild and the I2C clock goes down to 16kHz. I am beginning to wonder doe I have a faulty unit ? Again the scope shows clean edges but for some reason no go and slow bus.

Regards
Jan P.

PS: I wonder do I need to set extra parameters such as “Output Format”, there are the choices 9 byte cm (default), Pixhawk, and 9 byte mm.

So I did what I was told.
I plugged the TFmini Plus into the pc and ran the gui. Unit works like a charm.
I then sent the following commands.
5A 05 0A 01 6A
5A 04 11 6F
I set the address to 16 and the type to 25 as discussed above.
All I get is rangerfinder 1 not detected. I rebooted …same.
Here are my config settings.Everything appears to be correct…but no go and now of course I cant’ test the lidar as it’s in I2C mode.This is the same unit and the same supplier that Patrick uses. Very odd
Suggestions anyone.
RNGFND_GAIN,0.8
RNGFND1_ADDR,16
RNGFND1_FUNCTION,0
RNGFND1_GNDCLEAR,34
RNGFND1_MAX_CM,600
RNGFND1_MIN_CM,30
RNGFND1_OFFSET,0
RNGFND1_ORIENT,25
RNGFND1_PIN,-1
RNGFND1_POS_X,0
RNGFND1_POS_Y,0
RNGFND1_POS_Z,0
RNGFND1_PWRRNG,0
RNGFND1_RMETRIC,1
RNGFND1_SCALING,1
RNGFND1_STOP_PIN,-1
RNGFND1_TYPE,25

@ppoirier

@rickyg32, if you have a R-Pi or any other Linux box with I2C you could install i2c-tools and change back to UART:

To get it back from I2C to UART I issued the following on a Linux CLI:

To verify its on address 0x10:
i2cdetect -y 1

Set UART:
i2cset -y 1 0x10 0x5a 0x50 0x0a 0x00 0x69 i

Save Settings:
i2cset -y 1 0x10 0x5a 0x04 0x11 0x6f i

That worked for me when I tried the 1st time around with I2C and go back to UART. As you can see above I have no luck with I2C either on this and it is not a termination issue, something else must be configured on the TFmini S or maybe there are different firmware versions out there, some work and some don’t. Unfortunately neither Benewake nor my supplier 3DXR in the UK is responding to information requests. The Benewake Windows application is also not showing any responses when issuing commands. Very disappointing.

Regards
Jan P.

PS: The -y 1 part of the above depend on the bus number.

1 Like

Hi JP.
I don’t have a Raspberry Pi. But I suppose I could get one.
IS there any documentation around on how to connect it up and what sketch you need to do all this.

A R-Pi is an actual computer, you don’t have “sketches”, you issue commands on a command line. Somewhere further up is a reference to an Arduino type device, that’s a Microcontroller board which uses a sketch to make it work. You might have to google a bit about that, I have not details on that off hand.

Re r-Pi just google “r-pi pinout” and you get plenty. GPIO 4 and 6 are +5v and GND, 3 and 5 are SDA and SCL.

Rgrds
Jan