FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [February 2014 Threads]
Hi all,
I'm sorry for this trivial question. I am using STM32f407 with STM32 standard peripheral drivers and Keil as development environment.I am currently having a weird problem related to mutex.
I am working based on FreeRTOS and LwIP project provided by ST in
http://www.st.com/web/en/catalog/tools/FM147/CL1794/SC961/SS1743/PF257896?s_searchtype=keyword.
At first I didn't have any problem, but when I need to add mutexes I found a problem where it seems like there are limit to number of mutex that I can create.
I simply create a mutex, both recursive (xSemaphoreCreateRecursiveMutex)and not(xSemaphoreCreateMutex), and when the number of mutex created is more than a certain number, my code behaves unexpectedly although the mutex is not used anywhere yet. But when I deleted the creation line of one of the mutexes, my code works well. So if I want to make a new mutex after I reach mutex threshold number, I have to delete another mutex, and I conclude that there is a maximum number of mutex that I can create, although I am not sure yet.
I have researched for similar case like mine but can't seem to find one on the internet. If anyone here can confirm about this problem I would really appreciate it. And I wonder what is the physical resource on STM32F/cortex m-4 that is used when a mutex is created?
Thanks.
Sounds like you are running out of heap memory to create the mutexs. Are you checking the handle to make sure it isn't zero? There is a hook you can define to call a function when you get a heap allocation error which is good for debugging.
You are right! This is the answer that I've been looking for. I failed to recognize the fact that RTOS kernel allocates RAM each time a task, queue, mutex, software timer or semaphore is created.
I simply had to increase the configTOTALHEAPSIZE to solve this problem.
Regards.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.