2020-06-24 07:42 AM
I'm using STM32F767 and referring STM32746G-Discovery code. I've question regarding __HAL_LOCK() function. if I'm using FreeRTOS, I've created 2 threads, one to to handle QSPI interface for flash and second thread to handle CAN communication and reading ADC. if I write to block of data into flash over QSPI then HAL will be locked. will it block other interrupts too, can I read ADC in while the flash writing is going on? OR
will other functions continue to work?
2020-06-24 05:02 PM
The __HAL_LOCK only locks a peripheral at a time. If only one thread does QSPI and only one thread does CAN, you'll be fine.
Note also that __HAL_LOCK is not thread-safe, so the safe thing to do is to ensure each peripheral is only accessed by a single thread. There are other methods, but that's the most straightforward.
2020-06-25 12:42 AM
thanks TDK
so, if I lock SPI like _HAL_LOCK(QSPI); still I'll be able to get interrupts on CAN receive pin.