Electronics-Related.com
Forums

RS232 decode routines from raw scope data?

Started by Joerg January 20, 2019
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. -- Regards, Joerg http://www.analogconsultants.com/
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. Rick C. ++ Get 6 months of free supercharging ++ Tesla referral code - https://ts.la/richard11209
Am 22.01.19 um 21:16 schrieb Joerg:
>> https://www.bitscope.com/software/dso/guide/2.5/?p=14#files >> >> My oscilloscope is similar. I writes files with meta data which I >> truncate when importing into Excel. However, reading such files back >> into the scope, for example to perform math on them, requires this meta >> data to be there. Else the scope can't know how to interpret the data >> such as the number of channels it represents, what the time base was, >> and so on. >> > > I just tried it. The installed version on the Windows PC here at the > office is missing the whole top menu bar and other stuff. It doesn't > look quite ready yet :-)
Hello, try setup and connect. Bernd Mayer
On 2019-01-22 13:11, Bernd Mayer wrote:
> Am 22.01.19 um 21:16 schrieb Joerg: >>> https://www.bitscope.com/software/dso/guide/2.5/?p=14#files >>> >>> My oscilloscope is similar. I writes files with meta data which I >>> truncate when importing into Excel. However, reading such files back >>> into the scope, for example to perform math on them, requires this meta >>> data to be there. Else the scope can't know how to interpret the data >>> such as the number of channels it represents, what the time base was, >>> and so on. >>> >> >> I just tried it. The installed version on the Windows PC here at the >> office is missing the whole top menu bar and other stuff. It doesn't >> look quite ready yet :-) > > Hello, > > try setup and connect. >
Afraid I don't understand. After the install there were no such menu items. Meantime I uninstalled it but can of course re-install. -- Regards, Joerg http://www.analogconsultants.com/
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 :-) -- Regards, Joerg http://www.analogconsultants.com/
tirsdag den 22. januar 2019 kl. 21.48.26 UTC+1 skrev Joerg:
> 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.
took a second, I sent it
> 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.
that doesn't sound right, the analyzer doesn't know about rs232 or how to synchronize to the data it just samples at a fixed rate
On 01/22/2019 01:51 AM, gnuarm.deletethisbit@gmail.com wrote:
> On Tuesday, January 22, 2019 at 12:47:49 AM UTC-5, bitrex wrote: >> On 01/21/2019 10:59 PM, gnuarm.deletethisbit@gmail.com wrote: >> >>>>> Gosh that's quite nice of Lasse, I'd have least asked for some beer >>>>> money to do it in C! >>>>> >>>>> Dealing with large numbers of data points from a data set of arbitrary >>>>> size is a lot more civilized in C++ with its dynamically-re sizable >>>>> containers (std::list, std::vector, etc.) >>>> >>>> the data size was know at compile time and no matter what language you >>>> use I think you'd want to figure out how much space you need and allocate >>>> that at the beginning so you don't have a vector grow as you read numbers >>>> from a file >>> >>> Why would you need to know the size? This is not so much different from a two pass assembler, but three passes maybe if you want to be fancy. >>> >>> Pass 1 - find the DC average for 1/0 decision. >>> >>> Pass 2 - look for 1/0 transition timing to determine baud rate >>> >>> Pass 3 - decode the bytes and generate output file. >>> >>> Read the input file three times and don't store anything other than a few words for the Pass 1/Pass 2 measurements. >>> >>> Rick C. >>> >>> -+ Get 6 months of free supercharging >>> -+ Tesla referral code - https://ts.la/richard11209 >>> >> >> it's only 25,000 bytes, for input sizes around that in C99 with variable >> length arrays you can just do everything with stack allocations >> something like: >> >> static unsigned int fsize(char* file) { >> FILE* f = fopen(file, "rb"); >> fseek(f, 0, SEEK_END); >> unsigned int len = ftell(f); >> fclose(f); >> return len; >> } >> >> int main(int argc, char *argv[]) { >> char* filename = //etc.... >> //then somewhere in main: >> >> unsigned char file_buf[fsize(filename)*sizeof(unsigned char)]; >> >> /* Read in file contents to stack buffer and do what u want (probably >> using a bunch of "for" loops and 1970s ANSI C-stuff." >> } > > But why? That's extra work even if it's small. Just read each line and process it in a loop until the end. Lather, rinse, repeat. Why make it more complicated than it needs to be? > > Rick C. > > +- Get 6 months of free supercharging > +- Tesla referral code - https://ts.la/richard11209 >
Assuming the data you're processing is a file containing a sequence of null-terminated ASCII strings, sure. Since the OP stated the data was raw ADC data don't know why I would assume it was formatted that way I was assuming it would be just a buncha bytes. There's no way to "read lines" from a raw binary data file in C it's just a blob.
On 2019-01-22 13:33, Lasse Langwadt Christensen wrote:
> tirsdag den 22. januar 2019 kl. 21.48.26 UTC+1 skrev Joerg: >> 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. > > took a second, I sent it >
Thanks, and it worketh! This was pretty much my first real use of a Linux computer :-)
>> 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. > > that doesn't sound right, the analyzer doesn't know about rs232 or > how to synchronize to the data it just samples at a fixed rate >
Yes, it sure doesn't sound right. I just made Pulse View crash. Guess I'll have to wait until the little analyzer is here and then play some more with it. -- Regards, Joerg http://www.analogconsultants.com/
tirsdag den 22. januar 2019 kl. 23.18.09 UTC+1 skrev Joerg:
> On 2019-01-22 13:33, Lasse Langwadt Christensen wrote: > > tirsdag den 22. januar 2019 kl. 21.48.26 UTC+1 skrev Joerg: > >> 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. > > > > took a second, I sent it > > > > Thanks, and it worketh! > > This was pretty much my first real use of a Linux computer :-)
your first step towards freedom ;)
On 2019-01-22 14:44, Lasse Langwadt Christensen wrote:
> tirsdag den 22. januar 2019 kl. 23.18.09 UTC+1 skrev Joerg: >> On 2019-01-22 13:33, Lasse Langwadt Christensen wrote: >>> tirsdag den 22. januar 2019 kl. 21.48.26 UTC+1 skrev Joerg: >>>> 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. >>> >>> took a second, I sent it >>> >> >> Thanks, and it worketh! >> >> This was pretty much my first real use of a Linux computer :-) > > your first step towards freedom ;) >
Oh I took those already when I unpeeled myself from the stranglehold of the giant beer conglomerates and started home brewing again. No more InBev, Coors, Heineken, Diageo oder Carlsberg here :-) -- Regards, Joerg http://www.analogconsultants.com/