cancel
Showing results for 
Search instead for 
Did you mean: 

osThreadFlagsSet function acts differently in two almost the same projects

JNowa.4
Associate III

I have to projects based on FreeRTOS. One is st example and one is generated by me from example .ioc file. All of the files in projects are the same (including FreeRTOS middleware directory). In the projects there is a task called periodically which set flag for the other task using osThreadFlagsSet function. While debugging I've noticed that osThreadFlagsSet function returnes different values. In one project rflags variable has value equal to 1:

0693W00000Nr6w4QAB.jpg 

In the other rflags has some random value:

0693W00000Nr6wJQAR.jpgand because of that I think that there might be the problem with setting flag for the task. Not setting the flag causes project work unstable. What might be the issue?

1 ACCEPTED SOLUTION

Accepted Solutions
JNowa.4
Associate III

Update:

@Walid ZRELLI​ The issue is solved. Increasing stack size of the send thread by 512 solved it. Thanks for the help one again!

View solution in original post

6 REPLIES 6

Hello @Community member​ ,

In order to allow a better analysis of this issue, could you provide the project that contains the flags problem?

As well, are you sure you are pointing to the same line code when debugging both projects?

Otherwise, try to remove the initialization of this variable (uint32_t rflags ;) and leave me your feedback.

BeST Regards,

Walid

JNowa.4
Associate III

Hi @Walid ZRELLI​,

I'm sure that I was poiting to the same line when debugging. I was checking rflags value after execution of xTaskNotifyAndQueryFromISR function. Initialization of variable was for debugging purposes only and program was acting the same with as well as without it.

Attached you will find invalid project. I was using STM32CubeIDE in version 1.9.0 and STM32Cube_FW_WL_V1.2.0 packet. Program was run on the Nucleo-WL55JC2. In the last anwser to this question:

https://community.st.com/s/question/0D53W00001aJT8eSAG/lorawanendnodefreertos-application-on-nucleowl55jc2-problem-with-sending-more-than-one-data-packet-after-successful-join-procedure

I've described when exactly this issue occurs.

Hello @Community member​ ,

I have tested your example and it works well for me. The rflags variable has a value equal to 1.

0693W00000NrLJWQA3.pngThanks for double check from your side.

BeST Regards,

Walid

JNowa.4
Associate III

@Walid ZRELLI​ Thank you for your help so far. Have you tested the example right away after flashing or in the any other case? When I'm running my example issue occures after succesful joining device to the network and sending one data packet. I do not know where should I look for source of the issue.

JNowa.4
Associate III

Update:

@Walid ZRELLI​ The issue is solved. Increasing stack size of the send thread by 512 solved it. Thanks for the help one again!

Great news! Thanks for sharing the solution :smiling_face_with_smiling_eyes: