cancel
Showing results for 
Search instead for 
Did you mean: 

HSEM HAL strange behavior

gasda.1
Associate II

Hi,

I'm playing around HSEM module and i noticed strange behavior. Why calling:

HAL_HSEM_FastTake(HSEM_ID_0);

or

HAL_HSEM_Take(HSEM_ID_0, 0);

lock all semaphores at once instead of just locking single semaphore specified by a macro using 0 as processid?

Then calling release will unlock only the one specified macro and we end up with 31 semaphores locked unintentionally.

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

Reading the RLR (read lock register), which you are doing by examining the value in peripheral mode, will lock the semaphore. Disable the RLR registers from being viewed.

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

4 REPLIES 4
TDK
Guru

Why do you think it's locking all 32 semaphores?

If you feel a post has answered your question, please click "Accept as Solution".
gasda.1
Associate II

Because i've check it with debugger

This is state before calling HAL_HSEM_FastTake:

0693W000001pKq8QAE.png

and this is after:

0693W000001pKqDQAU.png

As you can see all semaphores has been locked by main cpu

TDK
Guru

Reading the RLR (read lock register), which you are doing by examining the value in peripheral mode, will lock the semaphore. Disable the RLR registers from being viewed.

If you feel a post has answered your question, please click "Accept as Solution".
gasda.1
Associate II

Oh you are defenitely right, viewing in peripheral mode does lock every semaphore. Thanks for clarification!