i want to use a queue in two different c files and in one of it is ISR and from it i am sending an queue item.
but the task in the another c file cannot receive the item in this queue.
yes, i am creating it bevor the interrupt tries to use it.
the creation as i said is done in the other c file. in which i placed the receiving task too.
Since the code is in two files, make sure the queue handle is in a global and both files are accessing the same exact variable. if a file declares that handle as static, or inside of a function, then the other file will use a different version of the variable even if they have the same name.
there should probably be an extern declaration in a header they both include, and a global definition in just one file.
i declare the variable as extern in the hal_usb.c and i write the defintion in the other c file.
now it works for the first sending and receiving and then it stops for abother problem due to micro controller i think.
Is your problem caused by the fact that you are not returning xHigherPriorityTaskWoken from your ISR? I had a similar problem where a task wasn’t responding to a queue and it was because I didn’t understand how that mechanism works and therefore the task was not getting unblocked. My ISRs all have the following format…
It looks as though return xHigherPriorityTaskWoken doesn’t actually get used but it does!!! The macro portEXIT_SWITCHING_ISR retrieves the value directly from the register. All of this is port specific so you need to check the demo for your particular architecture.
Can you post a simplified version of the two files? It is probably something obvious to an experienced user of FreeRTOS. Try to hack out any application-specific code until you have nothing but the creation and reception from your queue in one file and the ISR in the other. If you can do that without your error going away, I would be happy to look at your code…