Serial Debugging using RX TX - SimHub iRacing MAX7219 Gear Indicator

Hi all,

I have basic understanding when it comes to Arduinos but I'd love to understand more about how serial communication works and if it's possible to view what is being sent over serial via the RX/TX pins when the USB port is being used?

I'm trying to build a very simple Gear Indicator for Iracing that uses simhub to communicate the gear number to the arduino via usb which then displays it on an 8x8 led matrix controlled via a MAX7219 HOW TO MAKE A GEAR INDICATOR DISPLAY w SIM HUB DIY

I've assembled everything and tested the hardware using the LedControl LCDemoMatrix which works great (apart from being mirrored initially) VIDEO


The simhub setup is relatively straight forward and you just enable the LED Matrix and it shows you the connections as above but when I connect it the device is detected and can be seen to be receiving data but the matrix doesn't light up!
Below is a section of the code uploaded to the Arduino from simhub which I think reads the serial communication that is supposed to control the matrix

#ifndef _SHMATRIXMAX7219_H__
#define _SHMATRIXMAX7219_H__
#include <Arduino.h>
#include "SHLedControl.h"

class SHMatrixMAX7219 {
private:

	SHLedControl  MAX7221;
	byte MAX7221_MATRIX_LUMINOSITY = 0;
public:

	void begin(int DataPin, int ClkPin, int LoadPin) {
		MAX7221.begin(DataPin, ClkPin, LoadPin, 1);
		MAX7221.shutdown(0, false);
		MAX7221.setIntensity(0, 0);
		MAX7221.clearDisplay(0);
	}

	void read()
	{
		// Wait for display data
		int newIntensity = FlowSerialTimedRead();
		if (newIntensity != MAX7221_MATRIX_LUMINOSITY) {
			MAX7221.setIntensity(0, newIntensity);
			MAX7221_MATRIX_LUMINOSITY = newIntensity;
		}

		for (int j = 0; j < 8; j++) {
			MAX7221.setRow(0, 7 - j, FlowSerialTimedRead());
		}
	}
};
#endif

My question is . . . is there a way to read the serial communication being sent to the Arduino from simhub (which it only does when a configured arduino is connected) and hopefully understand exactly what is being sent and why this doesn't light up the matrix?

Thanks in advance

if it's possible to view what is being sent over serial via the RX/TX pins when the USB port is being used?

That depends on the board used. It's not possible with the UNO but no problem with the Leonardo (to provide just two examples).

My question is . . . is there a way to read the serial communication being sent to the Arduino from simhub (which it only does when a configured arduino is connected) and hopefully understand exactly what is being sent and why this doesn't light up the matrix?

Sure, this is possible. The easiest way is to sniff the USB traffic on the PC (p.e. by WireShark). Another one is by connecting another Arduino to the serial pins of the Nano (cross-over wires). If you have the hardware, a logic analyzer is another tool to get the traffic on the serial interface.

pylon:
That depends on the board used. It's not possible with the UNO but no problem with the Leonardo (to provide just two examples).

I currently only own Nanos, Unos and a Mega but I keep seeing lots of uses for a Leonardo so might get one

Sure, this is possible. The easiest way is to sniff the USB traffic on the PC (p.e. by WireShark). Another one is by connecting another Arduino to the serial pins of the Nano (cross-over wires). If you have the hardware, a logic analyzer is another tool to get the traffic on the serial interface.

This is great news and will try the sniffing software out but if you could just give me a little more detail on connecting another Arduino to the serial pins of the Nano and can this be done with any Arduino?

Just to confirm by cross-over wires that means rx to tx and tx to rx and then is it just a simple case of connecting the second Arduino via usb and opening up a serial monitor on that com port?

What should I expect to see?

Just to confirm by cross-over wires that means rx to tx and tx to rx and then is it just a simple case of connecting the second Arduino via usb and opening up a serial monitor on that com port?

Yes, that way you get the same traffic on the USB connection of the second Arduino. You have to connect the GNDs too.

What should I expect to see?

The same bytes that are sent to your Arduino. I strongly hope you know what you expect to see, otherwise this setup won't give you any advantage.

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