Pumpkin, Inc.

Pumpkin User Forums

Issues with Semaphores.

If you can't make Salvo do what you want it to do, post it here.

Issues with Semaphores.

Postby Salvo Tech Support » Fri Mar 22, 2002 7:58 am

Hi John.

Here are some ideas on why it may not be working:

1) You must have a mainline call to OSSignalSem() if you're using OSFROM_ANYWHERE. If it's actually doing something (and not a dummy call), are you protecting it from interrupts as is outlined in AN-9?

2) You should upgrade to v3.0.0 (you are eligible for a free upgrade). We'll email you how tomorrow (Saturday). v3.0.0 also requires protection, but provides some services (OSProtect() and OSUnprotect()) to make life simpler. This is due to the design of PICC/PICC-18 (parameters are in static areas, not on any stack), and is unavoidable.

3) Make sure you're using the latest version of PICC-18 (v8.11PL1). Earler versions had a few problems, though I don't think they were related to what you're seeing.

4) Keep in mind that you can split up Salvo's variables and locate different portions in different banks, e.g.

code:
#define OSLOC_ALL     near persistent
#define OSLOC_ECB persistent

will place all but the event control blocks in the access bank, but will place the ecbs in a normal bank. Again, I don't see how this would make any difference, but you may be able to discern a pattern ...

It would be helpful if we could know where the problem is. Is the semaphore signaled successfully (i.e. does its value increase with each call to OSSignalSem())? If not, you may want to check OSSignalSem()'s return value. If it is, then it's worth checking to see if the semaphore was really incremented, and if OSSignalSem() is affecting the same bytes of data (the ecb) that OS_WaitSem() is reading from.

Apart from perhaps failing to protect mainline calls of functions that are also called from ISRs, you appear to be doing everything correctly ...

BTW, this also assumes you're doing a source-code build.

------------------
--------
Salvo Technical Support
Please request all tech support through the Forums.

--------
Salvo Technical Support
Please request all tech support through the Forums.
Salvo Tech Support
 
Posts: 173
Joined: Sun Nov 19, 2000 12:00 am

Re: Issues with Semaphores.

Postby JohnT » Fri Mar 22, 2002 12:43 pm

I have the strangest thing going on. I have certain piece of code that sets a semaphore from within an ISR. If I build the files with certain Salvocfg.h options the system works without any problems. If however I change the options in Salvocfg.h, the code will compile and run, but even though the Semaphore is signaled in the ISR, the OS_WaitForSem never works.

Here's my entire salvocfg.h (the one that causes the program to work properly).

#define OSCOMPILER OSHT_PICC
#define OSTARGET OSPIC18
#define OSENABLE_MESSAGE_QUEUES TRUE
#define OSENABLE_DELAYS TRUE
#define OSENABLE_SEMAPHORES TRUE
#define OSENABLE_TIMEOUTS TRUE
#define OSTASKS 8
#define OSEVENTS 12
#define OSMESSAGE_QUEUES 1
#define OSBYTES_OF_TICKS 2
#define OSBYTES_OF_DELAYS 2
#define OSCLEAR_WATCHDOG_TIMER() CLRWDT()
#define OSCLEAR_GLOBALS TRUE
#define OSDISABLE_ERROR_CHECKING TRUE
#define OSCALL_OSSIGNALEVENT OSFROM_ANYWHERE
#define OSENABLE_IDLE_TASK FALSE
#define OSLOC_ALL near persistent

To get it to 'fail' all I need to do is get rid of the #define OSLOC_ALL near persistent. Why is that the case? To make matters worst I need to get rid of OSLOC_ALL since my vars don't seem to all fit in the allotted space.

BTW, I'm using this on a PICC-18C452.

Thanks

JohnT
 
Posts: 3
Joined: Tue Jan 29, 2002 12:00 am
Location: Troy, MI, USA


Return to Coding

Who is online

Users browsing this forum: No registered users and 2 guests

cron