quote:See page 10 of RM-MCC18.PDF
How do you disable the Salvo so that it does not interfere with the interrupt and then give control back again?
quote:We haven't written an App Note that illustrates this yet, sadly. You'll have to ruminate over what I wrote below
Are there any examples you have that shows how this can be done?
quote:No, as per below, we can build you a custom Salvo Lite lib that does this, for your eval purposes. So, pick a library that you like (like sfc18sft.lib, or something) and we can build you one that only disables low-priority interrupts. See the Libraries chapter of the Salvo User Manual on using custom libraries.
Can this be done with the demo version of Salvo?
------------------
[This message has been edited by aek (edited January 07, 2004).]
sfc18sfa-clc1.lib is on its way ...
See the Libraries chapter of the Salvo User Manual on how to use the library and the associated salvoclc1.h header file, and where to put the files ...
Also, please note that you'll need Salvo Pro to generate your own custom libraries, and for custom library support.
------------------
[This message has been edited by aek (edited January 07, 2004).]
Yes, because you need access to the Salvo source code (Pro only) in order for the changes in OSPIC18_INTERRUPT_MASK to have an effect on all of the Salvo services that are in the libraries.
------------------
Which compiler?
100us @ 24MHz is too slow, I think. PICC-18's fastest context switches are around 100-150 cycles (IIRC), and MPLAB-C18 ones will be slower because there are some additional functions involved.
For example, Salvo's demod1 application (unfortunately, a Salvo Pro build only) gets around 2500 ctxSw/s @ 4MHz when built with PICC.
The issue of context-switching speed is rather complex, as it's dependent on the compiler used, the task's priority, and whatever operations are required to complete the context switch (e.g. re-enqueuing a task into the eligible queue).
Your best bet to evaluate the context-switching speed is to create your own Salvo Lite test application, with carefully selected breakpoints and task definitions, and then get numbers from that. The "space" of available configurations is simply too large for us to create a meaningful set of benchmarks.
I would also suggest that a focus on context-switching speed is missing the point (somewhat). In a cooperative system like Salvo, your task-to-task switching speed will be greatly influenced by what you're doing in the task itself, and so the context-switching speed is not as useful a metric as it is in a preemptive RTOS.
Note also that in a well-written Salvo app where at any moment, most of the tasks are waiting or delayed, and only a small number are eligible to run (and none sit around and just OS_Yield()), the context-switching time approaches the ideal (one task only) because the rest of the system is idle, waiting for an event to happen.
Salvo on the PIC is our most popular distribution, and context-switching speed is pretty much a non-issue with existing users.
------------------
Hmmm .... here's the deal. We recommend that one set Salvo's timer ticks to a minimum of 2,000 instruction cycles, with a preferred value of 10,000 instruction cycles. That way, Salvo's overhead is dwarfed by the time between ticks. Now, your application doesn't use delays (AFAIK), but the idea is still applicable -- you need some "processing headroom" to let Salvo do its stuff (worst-case timing), and high-rate continuous interrupts (that cannot tolerate substantial interrupt latency) are generally incompatible with this approach.
100us @ 24MHz is 600 instructions on the PIC18. With ISR overhead, etc. that's not enough "instruction cycle margin" for you to pass on control of the program to Salvo -- you will get bitten sooner or later. Sooner, likely.
You're right to put the PIC to sleep from within the OSIdlingHook().
If you were sampling at 100Hz or even 200-500Hz, then the task-based approach would probably work. But you're at 10kHz, and that's just too fast.
So, what you would do instead (and this is what many of our PIC18 customers do) is dedicate the high-priority interrupts to handling stuff like a 10kHz int, and configure Salvo to only disable (and therefore only interact with) low-priority interrupts. That way, you pass off the high-speed stuff to ISRs and it runs without any interference from Salvo, and then you do the lower-speed stuff with Salvo (e.g. RS-232, user interface, etc).
Salvo's libraries for PIC18 are built by default to disable GIEH and GIEL. If you want, we can build you a custom Salvo Lite library that just disables GIEL -- let me know which one you want if you want to evaluate it thusly.
------------------
Users browsing this forum: No registered users and 1 guest