Serial I/O Control Signal Flipping.. is it possible?

8 views (last 30 days)
Hello all,
As detailed in the Matlab help manual (<http://www.mathworks.com/help/techdoc/matlab_external/f63744.html#f51533>) serial data consists of Control and Data signals. Control signals have an "on" state when +3V is applied and "off" state when -3V is applied, while Data signals are the opposite ("on" when -3V is applied, and "off" when +3V is applied.)
My DSP (Experimenter's kit TMS320 F28335) outputs Control signals the same way as Data signals.. i.e. both are "on" when -3V is applied, and "off" when +3V is applied. Is is possible to configure matlab to not have control signal voltages flipped?
My example that I have tried on DSP communicating with matlab through a serial port:
DSP outputs 8-bit no-parity 1-stop-bit binary stream: 1(default state) ... 0(start) 00010111 1(stop)0(start) 11010100 1(stop)0(start) 11111010 1(stop) which in decimal is 23,212,160 (because 0, which is -3V, is the on state, and the least significant bit is on the left, e.g. 11111010 converted to "real binary" is 10100000.)
Matlab picks up: 1(ignored) 0(seen as default state, but was actually meant to be start bit) 000(the first 3 bits of data, but still seen as default state) 1(seen as start bit) 01111011 0(seen as stop) 1(seen as start) 01001011 111(these three bits ignored) 0(seen as stop) 1(seen as start) 01 (and then more 1's because of default voltage on th e line) which in decimal is 33, 45, 1. Note that both streams are the same, just parsed differently because matlab reverses the control signal "on" and "off" states.
TL;DR: How do I make matlab reverse the polarity it looks for of the start and stop bits?

Accepted Answer

Walter Roberson
Walter Roberson on 10 Aug 2011
MATLAB does not control at that level. The data is being handled by the computer's serial port, which might be integrated as part of the CPU (or one of the mandatory chips), or might be handled by a specific UART (Universal Asynchronous Receiver and Transmitter). You will not find a computer that MATLAB is supported on that allows bit-level analysis of its built-in serial ports.

More Answers (1)

Erich Glück
Erich Glück on 11 Aug 2011
So I found a solution to this problem... turns out the transmitter had been programmed to transmit (255-number), so the data bits were inverted. This made it look like the data bits were being transmitted correctly, and the control bits were not. When I changed it to transmit the actual number is was supposed to, the whole signal was inverted as to what matlab was looking for.
I then solved that problem by implementing a comparator op-amp on the signal cable to invert the output on the hardware level. This resulted in correct functionality.
Note that for transmitting data back to the DSP, I had to include an inverter as well.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!