I’ve got a problem with receiving a message. I have running three tasks. 0:Main, 1:Communicator, 2:Radio.
The problem is that when I send a message from task 2 to task 1, I can’t receive it. When I change the id in the send command to 0, I can receive the message in task 0.
This how my send code looks like (task 2):
The DestinationTask is the task identifier for your task 2, if you are sending from task 1 to task 2. Your message send function should look like this:
However, if you look in your “generated.h” file, you will find a list of #defines for your task identifiers, and this is a much easier way of working out which task you are sending the message to.
Thanks for your reply. Although I can’t get it working
What I would expect is that I have to fill in the task id if the destination task. So, I want to send a message from task 1 to task 2, the destination is task 2. I tried sending the message with
adl_msgSend(1, 1, 0, NULL)
and
adl_msgSend(2, 1, 0, NULL)
but the result is the same, message succesfully send, no message received.
The strange thing is that I can send messages to task 0, but to another task from any task won’t be received at all.
I have seen the defines in generated.h, I have them in use but posting them here wouldn’t make it more readable
My bad, should have been if you are sending from Task 2 to Task 1, so you are correct that the Task ID should be the destination task. Try changing your message filter in task 1 to something different such as:
thanks for your reply again. There must be a difference between your and my code because it is still not working. Could it be something in the generated.c/h settings? This is how the array with tasks looks like in my code:
I normally write my tasks in separate C files. The adl_msgSubscribe and msgFilter declarations are normally in my task function - in your case, it would look like this (in the main task, or one of the other tasks):
I see a difference between your code an my code. Your message ‘receiver’ is the main task. That’s no problem in my situation. Receiving a message in a non main task is the problem. Could you please give that a try? So create beside the main two other tasks. Let one task send a message to the other task and leave the main empty.
Could you also post your adl_InitTasks array from the generated.c?
I have found the whole Open-AT multitasking very confusing and poorly explained.
There seem to be a lot of restrictions & limitations that are not (well) explained.
IIRC, I think I found that a Task can’t receive messages if it’s suspended?
Task-0 can’t be suspended - so it can always accept messages.
That sounds like a good explanation. That would also explain why there isn’t an example with two or more tasks…
A bit offtopic, but important:
I found another thing I couldn’t explain. When I set up a GPRS connection(with WIP) from the main everything goes well, but when I create a second task to do the job, wip_bearerOpen returns the undocumented error -28
Here is a working project based on your code. Every 5 seconds, the packetRadio task sends a message to the packetHandler task, and every 10 seconds the packetHandler task sends a message to the packetRadio Task.
Have tested this on a WMP100,
-“Developer Studio”,“1.2.0.201012171243-R6026”
-“Open AT Embedded Software Suite package”,“2.34.0.201009161320”
-“Open AT OS Package”,“6.34.0.201007281407”
-“Firmware Package”,“7.44.0.201008311212”
If you look in the WIP user guide, hidden away somewhere it says: You MUST run the bearer in the main task (Highest priority). It does not work if the bearer is opened in another task. All other WIP stuff like TCP clients and FTP clients etc can be run on lower priority tasks, but NOT the bearer.
I found what’s going wrong in my code. I had en endless while loop which was waiting for an event (adl_eventWait).
In the handler for receiving a message I triggered the event. Now I think the message wasn’t received because the task was suspended. I removed the eventWait and let the task ‘end’ and now I’m receiving the messages succesfully.
I think my idea isn’t possible on this way, so I have to do the trick on another way.
IMO, it was very unhelpful of Wavecom to overload the meaning of “event” like this.
When you wait for an “Event” (in the specific sense of the ADL Event Service) like this, the task is suspended and cannot handle “events” in the wider ADL sense - such as timer expiry, message arrival, etc.
Well, that’s the way it seems to me, at least - as I said earlier, I don’t find it clearly explained at all.
I think that’s correct.
No - that does not let the task end at all!
The task is now waiting for “events” in the “normal” ADL sense - as it all worked before multitasking was introduced.
Now I’m working with the SiWi modules, I see that the documentation is very poor. I bought the Open AT Tutorial but I think I can learn more by browsing the forum then reading the book
I noticed that your using the ARM_ELF_GCC compiler, I’m using the ARM_EABI_GCC compiler. As I understood the ELF isn’t in use anymore and the EABI is the new one. Is there any reason to keep compiling with the ELF?