Electronics-Related.com
Forums

RS232 decode routines from raw scope data?

Started by Joerg January 20, 2019
On 2019-01-22, gnuarm.deletethisbit@gmail.com <gnuarm.deletethisbit@gmail.com> wrote:
> On Tuesday, January 22, 2019 at 1:52:41 PM UTC-5, Joerg wrote: >> On 2019-01-22 09:18, makolber@yahoo.com wrote: >> > question to the OP, >> > >> > is your serial data self clocking or do you have a separate clock and data line? >> > >> >> It's self-clocking. The usual 1-start, 1-stop and no parity on a single >> serial data line. Like RS232 and RS485. > > Not really self clocking, right? It's return to zero data, so no clock with the data. It works by using a similar clock at each end and a start bit.
in as much that the timing information for the data bits is transmitted on the same line as the data bits themselves it's self clocking. -- When I tried casting out nines I made a hash of it.
On Tuesday, January 22, 2019 at 4:20:31 PM UTC-5, Joerg wrote:
> On 2019-01-22 13:07, gnuarm.deletethisbit@gmail.com wrote: > > On Tuesday, January 22, 2019 at 1:52:41 PM UTC-5, Joerg wrote: > >> On 2019-01-22 09:18, makolber@yahoo.com wrote: > >>> question to the OP, > >>> > >>> is your serial data self clocking or do you have a separate clock > >>> and data line? > >>> > >> > >> It's self-clocking. The usual 1-start, 1-stop and no parity on a > >> single serial data line. Like RS232 and RS485. > > > > Not really self clocking, right? It's return to zero data, so no > > clock with the data. It works by using a similar clock at each end > > and a start bit. > > > > Yeah, ok, if that doesn't count as self-clocking (for capturing the > frames) then I guess it isn't self-clocking. But it works without a > clock :-)
Hardly. Every UART I've ever seen has a clock running to it. That's how you generate the baud rate. Rick C. --- Get 6 months of free supercharging --- Tesla referral code - https://ts.la/richard11209
On Tuesday, January 22, 2019 at 8:09:17 PM UTC-8, gnuarm.del...@gmail.com wrote:

> > >> It's self-clocking. The usual 1-start, 1-stop and no parity on a > > >> single serial data line. Like RS232 and RS485. > > > > > > Not really self clocking, right? It's return to zero data, so no > > > clock with the data. It works by using a similar clock at each end > > > and a start bit. > > > > > > > Yeah, ok, if that doesn't count as self-clocking (for capturing the > > frames) then I guess it isn't self-clocking. But it works without a > > clock :-) > > Hardly. Every UART I've ever seen has a clock running to it. That's how you generate the baud rate.
So-called self-clocking refers to tweaking the local (receive) clock to phase-lock it to the distant (sending) clock. Done digitally, a local oscillator at 8x or so of the transition period is required. Short Ethernet frames had to waste circa 8 bytes of data just to synchronize, but for long-burst transmissions it works well. RS-232, on the other hand, typically has SUCH short data (ten or eleven must-be-valid windows) that clock accuracy can be off a few percent and still work without any synchronization.
On Jan 22, 2019, Joerg wrote
(in article <gap61hF3qt8U2@mid.individual.net>):

> On 2019-01-22 06:12, Joseph Gwinn wrote: > > On Jan 21, 2019, Joerg wrote > > (in article <gamfknFg1i9U1@mid.individual.net>): > > > > > On 2019-01-21 07:55, Joseph Gwinn wrote: > > [...] > > > > > I think you are over-thinking this. No VBA programming needed. Just try > > > > it, > > > > using standard Excel functions. Or, just use Excel a a format converter. > > > > > > I don't know which standard Excel funtions or format converters would > > > convert a scope raw data output to hex. Martin and Lasse sent me a VBA > > > rountine and C code respectively and the hex data that came out of both > > > methods was the same, which is very encouraging. > > > > Given that you have a CSV file, name the file something like data.csv, and > > ask Excel to open the file. It should just open. Nor will 25000 points be a > > problem. Select the data column (first to last cells, and all between being > > selected) and go to Charts in the menu. There will be a suitable plot type. > > Choose it. If you don&#4294967295;t like that one, delete the plot and try something > > else. > > > > Scroll through the plot to find the events. Then find the critical span of > > data samples. > > I knew that and it works. Finding events is the key problem. Yesterday I > did but that was a tedious job using a paper ruler on the screen, made > to scale for the baud rate and zoom. Just like I did in the 90's.
That&#4294967295;s good. I guess I don&#4294967295;t know what all the talk about decoding RS232 in hardware is about. What defines an event then? Excel can search using the usual logical operators, like greater than. One can write compound tests, yielding another column having +1 in event rows. Joe Gwinn
On 2019-01-23 07:24, Joseph Gwinn wrote:
> On Jan 22, 2019, Joerg wrote > (in article <gap61hF3qt8U2@mid.individual.net>): > >> On 2019-01-22 06:12, Joseph Gwinn wrote: >>> On Jan 21, 2019, Joerg wrote >>> (in article <gamfknFg1i9U1@mid.individual.net>): >>> >>>> On 2019-01-21 07:55, Joseph Gwinn wrote: >> >> [...] >> >>>>> I think you are over-thinking this. No VBA programming needed. Just try >>>>> it, >>>>> using standard Excel functions. Or, just use Excel a a format converter. >>>> >>>> I don't know which standard Excel funtions or format converters would >>>> convert a scope raw data output to hex. Martin and Lasse sent me a VBA >>>> rountine and C code respectively and the hex data that came out of both >>>> methods was the same, which is very encouraging. >>> >>> Given that you have a CSV file, name the file something like data.csv, and >>> ask Excel to open the file. It should just open. Nor will 25000 points be a >>> problem. Select the data column (first to last cells, and all between being >>> selected) and go to Charts in the menu. There will be a suitable plot type. >>> Choose it. If you don&#4294967295;t like that one, delete the plot and try something >>> else. >>> >>> Scroll through the plot to find the events. Then find the critical span of >>> data samples. >> >> I knew that and it works. Finding events is the key problem. Yesterday I >> did but that was a tedious job using a paper ruler on the screen, made >> to scale for the baud rate and zoom. Just like I did in the 90's. > > That&#4294967295;s good. I guess I don&#4294967295;t know what all the talk about decoding RS232 > in hardware is about. >
Currently I only have ADC raw data recordings of serial data lines from a scope, in 8-bit samples. That needs to be be converted into data, to find out what was sent.
> What defines an event then? Excel can search using the usual logical > operators, like greater than. One can write compound tests, yielding another > column having +1 in event rows. >
An event in this case is, unfortunately, something that I don't know yet. Something happens that can cause the whole thing to hang. So I have to monitor other HW lines and also RS232 responses to find out what might possibly lead to a smoking gun. Clues in RS232 answers could be detected with nifty software or maybe one of the programs such as Sigrok. Triggerable events on other nets, not really, that requires a digital oscilloscope and sometimes also other analyzers. My old boat anchor logic analyzer has nifty trigger qualifier settings which could be pressed into service here but it does not decode serial data streams. The little one I ordered (hopefully) does. -- Regards, Joerg http://www.analogconsultants.com/
On 23/01/2019 07:48, Joerg wrote:
> On 2019-01-22 12:32, Lasse Langwadt Christensen wrote: >> tirsdag den 22. januar 2019 kl. 19.41.05 UTC+1 skrev Joerg: >>> On 2019-01-21 17:44, Mike wrote: > > [...] > > >>>> At some point, it becomes easier to program up an arduino to do exactly >>>> what you want.&nbsp; It's so easy to upload the microcode that you could >>>> hard code the >>>> whole thing without a complicated user interface. Patch the code as you >>>> zero >>>> in on the fault. >>>> >>> >>> Only if you are versed in programming stuff. That's why I couldn't >>> compile Lasse's code, I am just not experienced in handling software >>> jobs. >>> >> >> if you are on linux I can send you an excutable, I'm not sure I have a >> windowsbox with a c compiler >> > > I now also have a Linux laptop (Lubuntu 18, it's an older machine) but > please only if this takes just minutes of your time. It's now more or > less for future use because I did yesterday's extraction with a paper > ruler. Though in the future I hope the new USB logic analyzer will do > the trick. Until you pointed it out I didn't know they'd be even smaller > than a pod of my old boat anchor analyzer. > > Playing around a bit with Sigrok Pulse View it seems it doesn't like > oversampled data, probably has to come from a logic analyzer at exactly > "one bit per data bit" and that USB analyzer isn't here yet. >
No, pulseview can definitely handle oversampled data, at least within reason. Also, you can test it on wavforms that came from disk. That is how I usually use it, because it crashes so often I always save the waveforms as soon as I capture them, and then do the decoding later so that my waveforms are safe even if it crashes. If this is for money so that you can also spend some money on the tools, and if you are not as opposed to closed-source tools as I am, then you might be better served by the products from https://www.saleae.com/ I haven't tried them but I hear that they are good, and are likely to crash less than Pulseview.
On 2019-01-23 19:47, Chris Jones wrote:
> On 23/01/2019 07:48, Joerg wrote: >> On 2019-01-22 12:32, Lasse Langwadt Christensen wrote: >>> tirsdag den 22. januar 2019 kl. 19.41.05 UTC+1 skrev Joerg: >>>> On 2019-01-21 17:44, Mike wrote: >> >> [...] >> >> >>>>> At some point, it becomes easier to program up an arduino to do >>>>> exactly >>>>> what you want. It's so easy to upload the microcode that you could >>>>> hard code the >>>>> whole thing without a complicated user interface. Patch the code as >>>>> you >>>>> zero >>>>> in on the fault. >>>>> >>>> >>>> Only if you are versed in programming stuff. That's why I couldn't >>>> compile Lasse's code, I am just not experienced in handling software >>>> jobs. >>>> >>> >>> if you are on linux I can send you an excutable, I'm not sure I have a >>> windowsbox with a c compiler >>> >> >> I now also have a Linux laptop (Lubuntu 18, it's an older machine) but >> please only if this takes just minutes of your time. It's now more or >> less for future use because I did yesterday's extraction with a paper >> ruler. Though in the future I hope the new USB logic analyzer will do >> the trick. Until you pointed it out I didn't know they'd be even >> smaller than a pod of my old boat anchor analyzer. >> >> Playing around a bit with Sigrok Pulse View it seems it doesn't like >> oversampled data, probably has to come from a logic analyzer at >> exactly "one bit per data bit" and that USB analyzer isn't here yet. >> > > No, pulseview can definitely handle oversampled data, at least within > reason. Also, you can test it on wavforms that came from disk. That is > how I usually use it, because it crashes so often I always save the > waveforms as soon as I capture them, and then do the decoding later so > that my waveforms are safe even if it crashes. >
I would definitely save them first, then look at data.
> If this is for money so that you can also spend some money on the tools, > and if you are not as opposed to closed-source tools as I am, then you > might be better served by the products from > https://www.saleae.com/ > I haven't tried them but I hear that they are good, and are likely to > crash less than Pulseview.
The cheap analyzer that Lasse suggested should suffice for this. Arrives tomorrow but I won't have time to test it until mid next week. I am hoping to log stuff so I can see what the RS232 response to a sent command set was and how all that correlates with other events. The latter I'll have to capture with the scope and one fairly easy way would be to let the scope trigger, crank up the brightness, add in some noise for more "fuzz" on the trace, tap off its screen via a photodiode and amp, then send that into one of the logic analyzers digital pins. That would place trigger markers on an otherwise unused input which I can use to snoop around in the data. This should get me around the problem that my DSO doesn't have a trigger-out jack. I can run PulseView either on a Windows or a Linux computer. Whichever software crashes less :-) -- Regards, Joerg http://www.analogconsultants.com/