Testing the Output and the Inputs

Discussion and support for the Nmea4Wifi multiplexer - a 4-input Nmea 0183 wifi multiplexer.
Post Reply
Luis Sa
Site Admin
Posts: 843
Joined: Thu May 04, 2017 4:12 am

Testing the Output and the Inputs

Post by Luis Sa » Tue Aug 27, 2019 4:52 pm

Hello,

This is a technical post and explains how I test the Nmea4Wifi hardware. If you think that something is wrong with your multiplexer, you can perform this test, as well. This test is very similar to the one for the Nmea2Wifi multiplexer explained elsewhere.

You only need a 12V power supply to perform the test. The test consists in generating an output signal that is transmitted through P5 and then read at the 4 inputs - P1, P2, P3 and P4. If the transmitted signal is correctly read at a given input, the corresponding Green Led will blink.

When the multiplexer is powered up and starts to run, it loads the settings that are stored in EEPROM. If (and only if) the multiplexer detects factory settings it performs a Self_Test. So, in order to perform the hardware test, you need to start by making an Hard Reset. The Self_Test starts by checking if the output of the multiplexer, P5, is connected to any of its inputs (P1 or P2 or P3 or P4). To achieve this, the multiplexer sends on P5 a combination of "zeros and ones" and checks if that combination appears at any of its inputs. If none of the inputs show the referred to combination of "zeros and ones", the Self_Test is abandoned.

If P5 is connected to one of the inputs, the Self_Test is taken and it enters an infinite loop which is only broken by removing the power supply. Therefore, to perform the hardware test, you need to connect the output P5 to one of the inputs with 2 wires, before starting the multiplexer.

During the test a string of 40 "U" is sent 5 fives at 38400 baud targeting P1. If the string of 40 "U" is read correctly at P1, the corresponding Green Led blinks. Then the same string is sent 5 times to P2 (at 38400 baud) to P3 (at 9600 baud) and to P4 (at 9600). If the strings are read back correctly, the corresponding Green Leds will blink. The code used to test input P1 is shown below. Note that ASCII character "U" in binary is "01010101". Therefore in each string of 40 "U" there are 320 transitions from 0 to 1 or 1 to 0. If any of the transitions fails, the Led will not blink.
.

Code: Select all

void Blink_Led_1() {
  int j, n;
  byte b;
  boolean IsOK;
  while (Serial1.available() > 0) {    // get the characters
    b = Serial1.read();
  }
  for ( j = 0; j < 5; ++j ) {
    IsOK = true; n = 0;
    Serial2.print( "UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU" );
    delay(100);
    while (Serial1.available() > 0) {    // get the characters
      b = Serial1.read();
      n = n + 1;
      if (b != 85) {
        IsOK = false;
      }
    }
    if (n != 40) {
      IsOK = false;
    }
    if ( IsOK) {
      digitalWrite(LED_PIN_1, HIGH);
      delay(250);
      digitalWrite(LED_PIN_1, LOW);
      delay(250);
    }
    if ( ( IsOK == false ) && ( j > 0 ) ) {
      return;
    }
  }
}
In the following I post a video that illustrates this testing. I hope that the video is sufficient for you to repeat the test, should a need occur!


Regards, Luis

Post Reply