Thank you very much for sharing the links, Carlos. Last few days, I have gone through several articles including many of those you mentioned. I think I understood properly, updated my code and the program is working exactly as I expected. Just for the benefit of others (if required) I would like to summarise my understanding. Please correct me if anything is wrong or misleading.
Just to be clear with basics for beginners.
Peripheral interrupts are Microcontroller dependent and are serviced by bare metal Interrupt Service Routines (ISR), which are to implemented by the programer.
"fromISR()" APIs and Kernel APIs are provided by FreeRTOS.
For the FreeRTOS application to run as intended, priorities have to be defined, even for the simplest of applications using ISR and FreeRTOS.
Interrupt priorities are defined by following parameters in FreeRTOSConfig.h
configLIBRARY_LOWEST_INTERRUPT_PRIORITY
configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY
configKERNEL_INTERRUPT_PRIORITY
configMAX_SYSCALL_INTERRUPT_PRIORITY
All the above interrupt priority levels are decided by Priority Bits, whose number of bits depends on the Microcontroller core. In FRDM-K66F it is 4, so the values can be from 0 to 15, where 0 is for most urgent priority and 15 is for least urgent priority.
configLIBRARY_LOWEST_INTERRUPT_PRIORITY is ISR's lowest possible interrupt priority, which is usually 15 (1111b).
configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY is ISR's highest possible interrupt priority, which can be from 0 to 15, depending upon the need. I set that as 2.
Any Peripheral ISR that is going to be implemented in the program has to be defined priority level between the above two levels (else the program is prone to crash) in the main() program with the function
NVIC_SetPriority(IRQ_Number, Prioiritylevel);
In FreeRTOSConfig.h, I noticed the priority levels of configLIBRARY_LOWEST_INTERRUPT_PRIORITY and configKERNEL_INTERRUPT_PRIORITY are the same and configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY and configMAX_SYSCALL_INTERRUPT_PRIORITY are same, BUT the values are left shifted for KERNEL and MAX_SYSCALL interrupts in FreeRTOSConfig.h.
The values need not be the same. For instance, I assigned configMAX_SYSCALL_INTERRUPT_PRIORITY as 4 (01000000b), so I can have two levels of ISRs that are not interrupted by "fromISR()" APIs.
In the program, any Peripheral ISR, whose priority level is equal to or higher value (less urgent) than configMAX_SYSCALL_INTERRUPT_PRIORITY can use fromISR() APIs of FreeRTOS and still cannot use normal kernel APIs of FreeRTOS.
NB: Task and Timer priorities are at configKERNEL_INTERRUPT_PRIORITY priority. However, Tasks and Timers can have their priority levels from 0 to configMAX_PRIORITIES (From FreeRTOSConfig.h), where 0 priority level is for idle task and sleep mode or low power mode tasks. Unlike the interrupt priorities, Task priorities having a higher number means more urgent.