Products > Test Equipment

SainSmart DDS120 & DDS140 USB Oscilloscope

<< < (26/84) > >>

psynapse:
Donut6

I have a small problem with the code.  The data buffer is constantly overwritten.  This means that you cannot search the data for start points and you must expect to see one or more splice points of new data .

A couple of approaches are possible:- Tell the scope to stop sending data (but we all know that it does not like that, and if we are to support continuous modes on the DDS120/140 this is a problem .
Lock the input buffer whilst data is copied out from it.
Support multiple buffering in order to give enough time to read a buffer.

I do not know enough about libusb to know which are possible, do you have any sage words please?

EDIT
I do have a trigger of sorts working now.  (It is important to remember that the first 27 bytes of "data" are not in fact scope data!)
I also seem to have sufficient control (by using the 34 command) to avoid buffer overwrite, but that is a provisional finding! 5If I have not noted it before 34 00 and 34 FF are start and stop

donut6:
psynapse,


--- Quote ---Support multiple buffering in order to give enough time to read a buffer
--- End quote ---

The function scope_usb::scope_get_buffer writes into the buffer. I imagined this running in a thread, populating a large ring of buffers instead of the single "scope_data" array.
The "app" thread can then take it's time doing any sort of analysis, rendering, etc
I expect there is open source scope that already does this, so perhaps no point reinventing the wheel here.

Feel free to progress things any way you see fit as I haven't had time to spend on this project.
Although I may have a quick attempt at writing a proof of concept sdcc/fx2lib firmware.

psynapse:
Donut6

Thanks, yes, seems a good way forward.  I can write the code to fill a ring of buffers, but what I am less clear about is how I spawn an autonomous thread to fill those buffers.  I know you are short on time, so can you point to some example code which can bring me up to date (I note that your code already has "THREAD" in it, how far advanced is that please?). I will also look at the triplespark guys code, maybe he has a ring of buffers (although as I recall he has a "layer" between the App and libusb to do the buffering).

And "no reply" is also entirely acceptable :-)

doctormord:
Why not having an array in an array to create a ringbuffer.

I.e. 1024byte array in a 32 field array built as a ringbuffer. I use something similar in a microcontroller to have float averaging.

psynapse:
Doctormord,

Yes, that would be my solution of choice too.  The trouble is working out exactly how to pass a pointer to the OS (copying the data from the OS buffer to the application buffer represents too much of an overhead)

Mmark,

I have looked at both wxwidgets and qt and prefer qt I think! So my current plan is to port elements of the donut6 code into qt and then add to it. But to avoid us both doing the same thing, what are your plans/progress please?

and I need to patch the firmware and look at the jtag!

Navigation

[0] Message Index

[#] Next page

[*] Previous page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod