TFMini Arduino DUE

Hello,
I am trying to use an DUE to read from the TFmini (Benewake) sensor. I am using the accompanying library and sample code provided by the sensor where I changed the Software Serial to be Serial1.

However, the code seems to hang when calling the tfmini.getDistance() function and a reading is never received. Has anyone else encountered this problem? I've posted my code below. Any advice would be much appreciated. I have hooked the lines to 18/19 directly as the DUE is a 3.3v controller.

//#include <SoftwareSerial.h>
#include "TFMini.h"

// Setup software serial port 
//SoftwareSerial mySerial(10, 11);      // Uno RX (TFMINI TX), Uno TX (TFMINI RX)
#define mySerial Serial1
TFMini tfmini;

void setup() {
  // Step 1: Initialize hardware serial port (serial debug port)
  Serial.begin(115200);
  // wait for serial port to connect. Needed for native USB port only
  while (!Serial);
     
  Serial.println ("Initializing...");
  

  // Step 2: Initialize the data rate for the SoftwareSerial port
  mySerial.begin(TFMINI_BAUDRATE);
  Serial.println(TFMINI_BAUDRATE);

  // Step 3: Initialize the TF Mini sensor
  tfmini.begin(&mySerial);    
}


void loop() {
  // Take one TF Mini distance measurement
  uint16_t dist = tfmini.getDistance();
  uint16_t strength = tfmini.getRecentSignalStrength();

  // Display the measurement
  Serial.print(dist);
  Serial.print(" cm      sigstr: ");
  Serial.println(strength);

  // Wait some short time before taking the next measurement
  delay(25);  
}

There are 5 hardware serial on a DUE, so I guess you will not use a software serial library to communicate with the sensor.

Use e.g. Serial1 (RX1/TX1) with (TFMINITX/TFMINIRX) and set the correct baud rate (TFMINI_BAUDRATE ?).

Correct. That's why I #define the software serial bit to instead be Serial1. I've verified that the Baudrates are both the same at 115200 in the .h and the provided code.

Have you looked at the TFMini Spec sheet?

  1. Electrical Characteristics.

WHen I used the TFMini with a Due I powered the mini w 5V and directly connected it to a serial port. The mini has a 3.3V regulator to output 3.3V signals.