Connecting Feather M0 Express to MTi-G-28A53G35

Hi, I'm a student and I'm trying to do a project in which the Feather M0 Express and the MTi-G-28A53G35 are involved. My main problem is that Im trying to receive data from the sensor to the Feather but I'm not receiving anything and I can't find so much help on the internet because this sensor is more than 10 years old. I don't know if I'm wiring it in a correct way or not. If someone has worked with these two things before, I would be so grateful if they tell me how they did it. Even if it's not a Feather and it is an Arduino or something similar, any information would be really helpful.

Thank you in advance!

have you looked at mti-g_user_manual ?
upload a schematic showing how you connected the device
upload your test code (using code tages </>)

Yes, I have it but I couldn't get much form it. The main thing that I got is that it has an RS232 interface and that I have to use a converter from RS232 to TTL/UART, but nothing else. Right now I have disconnected everything that I've done before and I'm trying to start again.

This is my code so far:

byte gotoConfig[] = {0xFA,0xFF,0x30,0x00,0xD1};
byte gotoMeasurement[] = {0xFA,0xFF,0x10,0x00,0xF1};
byte setOutputSkipFactor[] = {0xFA,0x01,0xD4,0x02,0xFF,0xFF,0x2B};
byte reqData[] = {0xFA,0x01,0x34,0x00,0xCB};

byte inByte = 0x00;
byte xsensBID,xsensMID,xsensLEN,xsensCHECKSUM,xsensSTATUS;

union {
  byte asByte[4];
  float asFloat;
} xsensLatitude;
union {
  byte asByte[4];
  float asFloat;
} xsensLongitude;
union {
  byte asByte[4];
  float asFloat;
} xsensAltitude;

union {
  byte asByte[2];
  unsigned int asInt;
} xsensSample;


void setup(){
Serial.begin(115200);
Serial1.begin(115200);
xsensConfigure();
}

void loop() {
  /*poll xsens for a message*/
xsensGetData();
delay(1000);

}

void xsensGetData(){
byte xsensBuffer[100];
int i = 0;
Serial1.write(reqData,5);
//Serial.print("\nRequest Data");
while(Serial1.available() ==0){}
while(Serial1.available()){
  xsensBuffer[i] = Serial1.read();
  i++; 
}
xsensBID=xsensBuffer[1];
xsensMID=xsensBuffer[2];
xsensLEN=xsensBuffer[3];

if(xsensBID==0xFF && xsensMID == 0x32){
  //Latitude, longitude, altitude  
  xsensLatitude.asByte[3] = xsensBuffer[4];
  xsensLatitude.asByte[2] = xsensBuffer[5];
  xsensLatitude.asByte[1] = xsensBuffer[6];
  xsensLatitude.asByte[0] = xsensBuffer[7];
  
  xsensLongitude.asByte[3] = xsensBuffer[8];
  xsensLongitude.asByte[2] = xsensBuffer[9];
  xsensLongitude.asByte[1] = xsensBuffer[10];
  xsensLongitude.asByte[0] = xsensBuffer[11];
  
  xsensAltitude.asByte[3] = xsensBuffer[12];
  xsensAltitude.asByte[2] = xsensBuffer[13];
  xsensAltitude.asByte[1] = xsensBuffer[14];
  xsensAltitude.asByte[0] = xsensBuffer[15];
  
  xsensSTATUS = xsensBuffer[16];
  
  xsensSample.asByte[1] = xsensBuffer[17];
  xsensSample.asByte[0] = xsensBuffer[18];
  xsensCHECKSUM = xsensBuffer[19];
  byte byteSum = 0;
  for(i = 1;i<=19;i++){
    byteSum += xsensBuffer[i];
  }
  
  
  Serial.print("MSG-0:");Serial.print(byteSum,HEX);
  Serial.print("\tGPS:");Serial.print(bitRead(xsensSTATUS,2));
  Serial.print("\tKXF:");Serial.print(bitRead(xsensSTATUS,1));
  Serial.print("\t");Serial.print(xsensLatitude.asFloat,DEC);
  Serial.print("\t");Serial.print(xsensLongitude.asFloat,DEC);
  Serial.print("\t");Serial.print(xsensAltitude.asFloat,DEC);
  Serial.print("\t");Serial.print(xsensSample.asInt,DEC);
  
  
  xsensLatitude.asFloat = 0;
  xsensLongitude.asFloat = 0;
  xsensAltitude.asFloat = 0;
  xsensSample.asInt = 0;

}//end if

  Serial.print("\tBID:");
  Serial.print(xsensBID,HEX);
  Serial.print("\tMID:");
  Serial.print(xsensMID,HEX);
  Serial.print("\tLEN:");
  Serial.print(xsensLEN,DEC);
  Serial.print("\n");

}

void xsensConfigure(){
byte xsensByte = 0x00;
int i = 0; //i is a generic counter
Serial.println("\nConfiguration Mode\n");

Serial1.write(gotoConfig,5);
while(Serial1.available() ==0){}
while(Serial1.available()){
  xsensByte = Serial1.read();
  Serial.print(xsensByte);
  Serial.print("\t");
  delay(5);
}

Serial.println("\nOnly send data when polled\n");
Serial1.write(setOutputSkipFactor,7);
while(Serial1.available() ==0){}
while(Serial1.available()){
  xsensByte = Serial1.read();
  Serial.print(xsensByte);
  Serial.print("\t");
  delay(5);
}

Serial.println("\nMeasurement Mode\n");
Serial1.write(gotoMeasurement,5);

while(Serial1.available() ==0){}
while(Serial1.available()){
  xsensByte = Serial1.read();
  Serial.print(xsensByte);
  Serial.print("\t");
  delay(5);
}
Serial.print("\n");
}

can you upload a schematic showing the connections
MTI-G <> rs232-TTL converter <> Feather M0
the Feather M0 uses 3.3V logic - if the RS232-TTL converter uses 5V logic you require a level converter
does anything appear on the Serial Monitor

Yes, I'm using the MAX232N serial level converter and it doesn't show anything on the serial monitor.

if you have a meter check the voltages on the M0 Tx and Rx pins

I have 0V in RX and 3,24V in TX.

both should have 3.3V - try exchanging the Rx and Tx lines

Still receiving nothing. I'm going to try using another Feather and see if I get something. Thank you very much for replying.

when you exchanged the lines did you get 3.3V on both?

Nope, just in one of them, so it could be a problem withe pin in the Feather, that's why I'm thinking about changing it.

if you disconnect the RS232-TTL and Serial1 is set up the feather Tx pin should be 3.3v
just to prove the feather is OK try connecting the feather Tx pin to Rx pin to form a loop back
characters transmitted should be echoed back and appear on the serial monitor

to test Serial1 try this code

// Adafruit Feather 32u4 serial1 test


// for loopback test connect Tx to Rx

unsigned long time;

void setup() {
  Serial.begin(115200);   // initialise serial monitor port
  Serial1.begin(115200);  // initialise Serial1
  Serial.write("Adafruit Feather 32u4  Serial1 test -  for loopback test connect Tx to Rx\n");
}

void loop() {
  if (Serial1.available())        // read from Serial1 output to Serial
    Serial.write(Serial1.read());
  if (Serial.available()) {       // read from Serial outut to Serial1
    int inByte = Serial.read();
    //Serial.write(inByte);     // local echo if required
    Serial1.write(inByte);
  }
}

connect Tx to Rx characters entered on keyboard should echo back
works OK on an Adafruit Feather 32u4

I've just done it and it does work correctly. What should I do next? Because if there's no problem with the feather, what could it be?

if the loopback works it proves the feather is OK so the problem is on the RS232 side
without the RS232-TTL device being connected to the feather what are the voltages on the

  1. TTL side - one of the pins (probably Rx) should be 5V
  2. and the RS232 side - one of the pins (probably pin 2 Rx) should be 12V

On the RX pin of the RS232 I have 5V and on the TTL side I have nothing on the pin RX.

looks like serial TTL (0 to 5V levels) - are you sure the MTi-G-28A53G35 is outputting RS232 (-12V to +12V levels)??

I've just realized that there was a cable that wasn't connected properly, now this is what I get.
Captura de pantalla 2022-06-27 a las 11.22.10

good news! that looks like an MT message - you shiould now be able to send commands to the device and receive data

Yes it is and yes, I can send and receive data. Thank you very much for helping me!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.