My understanding is that the X2 prefers 5V serial communication voltages. We previously hooked up the X2 to another device running on 3.3V serial, and communications seemed to be functional.
However, we’ve recently tried to run the 3.3 device through a serial voltage level shifter before interfacing with the X2, and now all we’re receiving is garbage. From our scope tests, the shifter performs as expected, ramping up 3.3v signals to 5+V.
So, we’re looking for any ideas why the X2 might not take a 5V or 5+V serial signal? The only thing we’ve been able to come up with is that the source signal has some overshoot (about a volt) that is amplified by the shifter, and maybe that is messing things up? Anything else we can try to check for?
What is the level shifter circuit, and what are your baud rates? This “5+V” label you’re using is troubling. What is the voltage? I’m concerned that you are using something like a MAX232-type chip, which would invert the signals and also try to drive them to about ±10V, which is well past the maximum for the AVR I/O pins, and that you’re getting something over 5V because the protection diodes on the pins are clamping the voltage to Vcc plus the diode drop.
We’re using an ADG3300. The high voltage coming out depends on if we send the chip’s VCC through a regulator or just go straight off our battery, but we tested it with both, getting either 4.98V or 6ishV, respectively. Our baud rate is 57600, which I believe is within the chip spec.
We also tested sending from our other device to a TReX, with and without the shifter circuit, and it worked flawlessly in both situations.
Well, that’s a relief, though you’re still asking for trouble with the 6V connection since that’ll put your out of spec for both chips. Anyway, if the data going into the AVR serial input looks fine on the scope, I’d suspect there’s something wrong with your code on the AVR. Can you post a screen shot of your oscilloscope with the serial signal going into the AVR? You should be sending a single byte, and tell us what the AVR is receiving when you send that byte.
If things seemed to be working at 3.3V, what is your reason for adding in the level-shifter? The ATmega644 on the X2 is guaranteed to interpret 3.0V inputs and above as high, so if your 3.3V serial signals are relatively noise-free and are transmitted over short wires, you probably don’t need to shift them. Note that the Orangutan X2 outputs 5V serial signals, so you will need to shift the X2’s serial output if your 3.3V serial receive line isn’t 5V-tolerant (though this can be achieved with a simple voltage divider).
We put in the level-shifter because we were going to use the Maestro servo controller, which is stated to have a tighter logic limit. We recently tested a couple and this didn’t seem to be the case, so we may end up ditching the whole thing. We had figured that if we were going to put in the level shifter, we might as well run everything through it.
Even with well-regulated 5V supply, the X2 has errors, while the TReX and Maestro are fine. Bypassing the regulator, the X2 is fine with the same code. We’re going to back burner this for now, as more pressing things have come up and we have a work around. I’ll let you know if we can find something more when we test this again, maybe on some fresh X2’s.