Easy programming for the DSO Quad

--DSO203

Moderators: violet, jessie, jpa

jaqb
Pre-kindergarten
Pre-kindergarten
Posts: 9
Joined: Sun Oct 02, 2011 5:16 pm
Are you a staff member of seeedstudio?: no
Which products/projects are your favorite?: DSO Quad

Re: Easy programming for the DSO Quad

Post by jaqb » Wed May 16, 2012 7:19 am

paf wrote:Petteri, your development is great, thank you!
- why do we have to push two keys to quit an application (one to close and one to quit)?
Good question (i haven't noticed it;-)
paf wrote:Is there anywhere a description about how the whole thing works:
- the programs reside on the flash memory and remain only there?
- what is the limitation on the number of programs on flash, only flash capacity (which is how big)?
- is a program completely loaded in RAM at runtime? is it compiled, interpreted, or does it use something like p-code which is then interpreted by the PAWN_APP.HEX?
- what is the limitation on the size of a single program?
- is there somewhere a list of all functions calls and all parameters which can be used?
There's 2MB flash (spec)
Program have to be compiled (the compiler is included in git repo), you should look at Getting started page.
AFAIK there is no documentation (jet?) but there are few examples (especially Volt Meter) and includes (commented).

jpa
Elementary-2
Elementary-2
Posts: 215
Joined: Wed Nov 02, 2011 4:06 am
Are you a staff member of seeedstudio?: no
Which products/projects are your favorite?: DSO Quad

Re: Easy programming for the DSO Quad

Post by jpa » Fri May 18, 2012 1:33 pm

paf wrote: - on my DSO203, the battery symbol is not displayed correctly (the contents of the battery is shifted half out of the shelf)
- why do we have to push two keys to quit an application (one to close and one to quit)?
I fixed the battery icon bug now. I had forgot to test it with less than full battery :)

I guess I could get rid of the second keypress. It's there because e.g. hello world and other simple applications exit immediately, and I want to see the screen after they exit.
paf wrote: Is there anywhere a description about how the whole thing works:
- the programs reside on the flash memory and remain only there?
- what is the limitation on the number of programs on flash, only flash capacity (which is how big)?
- is a program completely loaded in RAM at runtime? is it compiled, interpreted, or does it use something like p-code which is then interpreted by the PAWN_APP.HEX?
- what is the limitation on the size of a single program?
- is there somewhere a list of all functions calls and all parameters which can be used?
The programs are on the 2MB flash memory. There can be as many as can fit, probably about 20-40 because each app is about 50-100kB.

The programs are in the pawn bytecode. Pawn has a p-code interpreter for ARM that is written in assembler (written by someone else, not me). It is quite fast, only about 5-10 instructions per one emulated instruction.

The programs are loaded to RAM at runtime. However, Pawn has an 'overlay' mechanism that is kind of swap. It allows to load programs larger than 32kB. The interpreter will then reload functions from flash as needed, always keeping the most recent functions in RAM.

The program size is kind-of limited by the data size - because data memory is never swapped, you can only have about 20kB of data in order to leave enough space for functions. Of the programs I have done so far, only frequency response app requires the overlays. So I guess programs larger than frequency response have to be a bit careful about memory use.

Only list of functions so far is the .inc files here:
https://github.com/PetteriAimonen/QuadP ... er/include
They do have comments, though.

jpa
Elementary-2
Elementary-2
Posts: 215
Joined: Wed Nov 02, 2011 4:06 am
Are you a staff member of seeedstudio?: no
Which products/projects are your favorite?: DSO Quad

Re: Easy programming for the DSO Quad

Post by jpa » Fri May 18, 2012 1:38 pm

bobtidey wrote: I am running the Community main app which seems to take APP1 and a bit of APP2. I am wondering what the technical feasibility of integrating the PAWN environment into the same build with the idea of making it even easier to switch back and forth between them and even potentially allow PAWN scripts to work directly with data gathered from the main host app and enhance that further.
Indeed, that is a possibility worth considering. It may be too tight on the RAM memory, though. Both the main app and pawn require quite much all the available RAM on the device, so it is difficult to make them run at the same time. One could make a key that easily switches between them, though.

Processing data from main app is already possible by reading the files it creates. I have been thinking that a BMP viewer application would be useful if one wants to use the Quad completely stand-alone :)

dms2
Pre-kindergarten
Pre-kindergarten
Posts: 1
Joined: Sat May 26, 2012 11:39 pm

Re: Easy programming for the DSO Quad

Post by dms2 » Sun May 27, 2012 12:17 am

I just finished a simple Spectrum Analyzer using Petteri's implementation of PAWN and all I can say is that Petteri has provided a great tool. I have started from scratch on many small platforms over the years and this has been the quickest and easiest experience I have ever had in doing this. My little app is called spec_an and can be found with Petteri's examples at https://github.com/PetteriAimonen/QuadP ... r/Programs. Based on what I did I think the very best way to get on top of this is to study a few of the posted programs and then browse through the include files.

jaqb
Pre-kindergarten
Pre-kindergarten
Posts: 9
Joined: Sun Oct 02, 2011 5:16 pm
Are you a staff member of seeedstudio?: no
Which products/projects are your favorite?: DSO Quad

Re: Easy programming for the DSO Quad

Post by jaqb » Tue Jun 19, 2012 9:33 pm

Is there possibility to turn off the screen? I haven't found anything in includes.
I would like to analyse battery discharging process. It takes a lot of time. I suppose backlight use a lot of energy, so if I could turn off the screen I could longer measure.

jpa
Elementary-2
Elementary-2
Posts: 215
Joined: Wed Nov 02, 2011 4:06 am
Are you a staff member of seeedstudio?: no
Which products/projects are your favorite?: DSO Quad

Re: Easy programming for the DSO Quad

Post by jpa » Sun Jun 24, 2012 11:19 pm

jaqb wrote:Is there possibility to turn off the screen? I haven't found anything in includes.
I would like to analyse battery discharging process. It takes a lot of time. I suppose backlight use a lot of energy, so if I could turn off the screen I could longer measure.
Not right now. Should be easy enough to add support in runtime once I get around to it (also missing beeper support currently). You can keep the DSO connected through USB if you worry about battery running empty.

jaqb
Pre-kindergarten
Pre-kindergarten
Posts: 9
Joined: Sun Oct 02, 2011 5:16 pm
Are you a staff member of seeedstudio?: no
Which products/projects are your favorite?: DSO Quad

Re: Easy programming for the DSO Quad

Post by jaqb » Mon Jun 25, 2012 7:23 am

jpa wrote:
jaqb wrote:Is there possibility to turn off the screen? I haven't found anything in includes.
I would like to analyse battery discharging process. It takes a lot of time. I suppose backlight use a lot of energy, so if I could turn off the screen I could longer measure.
Not right now. Should be easy enough to add support in runtime once I get around to it (also missing beeper support currently).
I'd add controlling RTC to wishlist - of course if there is RTC on board. Setting time only (without date) would be useful for me, even if I have to set after every power on (or even after application start). I'm working on project (for now "secret" ;-) where I'd like to synchronize asynchronous (user triggered) data dumps with position (from GPS).
jpa wrote:You can keep the DSO connected through USB if you worry about battery running empty.
Yes, I know. I'm going to check "2xAA USB charger" so for now it's no problem ;-)

jpa
Elementary-2
Elementary-2
Posts: 215
Joined: Wed Nov 02, 2011 4:06 am
Are you a staff member of seeedstudio?: no
Which products/projects are your favorite?: DSO Quad

Re: Easy programming for the DSO Quad

Post by jpa » Mon Jun 25, 2012 1:06 pm

jaqb wrote:I'd add controlling RTC to wishlist - of course if there is RTC on board. Setting time only (without date) would be useful for me, even if I have to set after every power on (or even after application start). I'm working on project (for now "secret" ;-) where I'd like to synchronize asynchronous (user triggered) data dumps with position (from GPS).
There is RTC, but it doesn't have backup battery so you'd have to reset it after power-on, just like you guessed.

The get_time() function (which gives millisecond timestamps since power-on) should be accurate.

jaqb
Pre-kindergarten
Pre-kindergarten
Posts: 9
Joined: Sun Oct 02, 2011 5:16 pm
Are you a staff member of seeedstudio?: no
Which products/projects are your favorite?: DSO Quad

Re: Easy programming for the DSO Quad

Post by jaqb » Tue Jun 26, 2012 6:54 am

jpa wrote:The get_time() function (which gives millisecond timestamps since power-on) should be accurate.
This is what I'm using as workaround. But this gives me timestamp relative to power on - every time is similar. Of course using "select_filename" I have files in chronological order.

btw. I'm impressed how easy you can write an application. You don't have to learn PAWN - just use it.

jpa
Elementary-2
Elementary-2
Posts: 215
Joined: Wed Nov 02, 2011 4:06 am
Are you a staff member of seeedstudio?: no
Which products/projects are your favorite?: DSO Quad

Re: Easy programming for the DSO Quad

Post by jpa » Thu Jun 28, 2012 2:37 am

jaqb wrote: This is what I'm using as workaround. But this gives me timestamp relative to power on - every time is similar. Of course using "select_filename" I have files in chronological order.
Hmm yeah, I wonder if there is any reasonable solution to this. One common way to easily set RTC of USB devices is to monitor timestamp on files written to USB drive. Then just sync the time right after the write.

Also if I added proper power saving support to the Pawn runtime, it could possibly be left on for a long time. Most power-consuming parts of the system (ADC, FPGA, switching regulator) can be switched off and MCU could go into standby. The standby current consumption should be less than 1mA, giving a few weeks of standby time.

Too bad that they didn't make use of the RTC in the microcontroller. Would have required just two diodes (to drop 4.2V -> less than 3.6V) if one is happy with LSI oscillator accuracy (can calibrate it right before sleep).

Post Reply