Benewake TF03 and Port Can

In the current version of copter there is no support for Benewake TF03 via CAN, it works only via serial port. But in the version that is in beta test, it will work, I need to test the beta version. I had to buy a TTL from Benewake itself to be able to return the port output to serial, I tried to use other CAN readers and it didn’t work.

Thanks for the reply! Turns out I should have just waited an extra day for the changes to move from rc1 into stable. I just tested the TF03 out on CAN and everything seems to be working well.

For reference, here’s what I did:

  • Switch the TF03 to CAN mode using any standard USB-UART converter that supports 5V Vcc and 3V3 logic as per the user manual
    • From Table 9 - Switching to CAN is the command CAN: 5A 05 45 02 A6
    • Note reverting the TF03 back to the original UART configuration requires the USB-CAN converter from Benewake so be warned!
  • Enable CAN on ArduCopter (4.1.4 or higher)
    • CAN_D1_PROTOCOL = 11 (Benewake)
    • CAN_P1_DRIVER = 1
  • Set the rangefinder to the TF03 via CAN
    • RNGFND1 = 34 (Benewake CAN)
1 Like

Great! I will also do the tests.

I should probably also note here that you need to send the “save” command (5A 04 11 6F) when switching over from UART to CAN. I’m currently working on getting multiple TF03 sensors working on the same Benewake CAN Bus so will report back once I’ve worked it out.

Are you getting good results using more than one sensor on the CAN bus?

I haven’t managed to get multiple sensors working yet unfortunately. I changed the addresses of each of the sensors but I can’t seem to get the addressing part to work properly yet (it will only work with 0 set in the receiving ID). I still have a couple of ideas to try out so will report back once I’ve been successful (or unsuccessful) with those.

Hi @AndersonRayner
Any luck with multiple TF03 on CAN bus ?

I did! You need at least ArduCopter 4.2 (4.1.x has an issue somewhere and I could never get it to work). The main tricks I ran into were

  • Switch the sensor to CAN mode and then check everything is working with the default address. Then change the addresses as required (you’ll need a CAN interface to do this). It is super easy to loose the sensors on the bus and debugging that becomes difficult.
    • Originally I tried to change the address via UART, then switch to CAN. I’m not sure what happened, but I completely lost my sensor as it didn’t go on the address I had asked it to go to.
  • I wrote some Arduino scripts to talk to and configure the TF03. It also gives you the addresses of where the data is coming from so you can find the address if you loose the sensor.
  • One point of note - the TX ID of the TF03 (the ID it sends the data on, default 0x03) is different to the RX ID of the TF03 (the address it accepts commands from, default 0x3003). When you loose RX ID, it’s super hard to get it back as there is no command you can just send to get the TF03 to give it to you.
    • In this case, I wrote a script to brute force (i.e. try all the addresses) a request for the sensor’s version, then if I heard a reply, I knew that was the RX address. There appears to be address that it will always respond to (so you’re unlikely to have to go all the way to 0xFFFF), so you can use that to set the correct address.