Hi @KanthReddy
A suitable way to coordinate Fee/Fls operations with other timing‑sensitive software (such as cryptographic routines) is not directly defined by the AUTOSAR specifications. Even though the underlying flash module on the device supports a flash‑erase suspend mechanism at hardware level, this functionality is not exposed through AUTOSAR Fls or Fee drivers. AUTOSAR does not provide any API or configuration option to pause or temporarily interrupt an ongoing flash erase or program sequence. As a result, AUTOSAR leaves this coordination problem entirely to system integration. Given these limitations, the approach described below is probably the only practical and AUTOSAR‑compliant method for interleaving Fee operations with other tasks.
A typical Fee job runs in small incremental steps. Each step is triggered by calling the periodic main functions:
do
{
Fee_MainFunction();
Fls_MainFunction();
status = Fee_GetStatus();
} while (status != MEMIF_IDLE);
Every time these main functions are called, the Fee driver advances its internal state machine and may request Fls to perform exactly one atomic flash operation (for example, a small program or erase action). When that atomic action completes, Fls becomes idle again and waits for the next main‑function call to begin another step. Fee continues this sequence until the entire high‑level Fee job is complete, at which point Fee_GetStatus() transitions to MEMIF_IDLE.
It is important to understand that Fee_GetStatus() reports only whether the full Fee job is finished, not whether the current atomic flash step is done. During a multi‑step write or maintenance sequence, Fee_GetStatus() will remain BUSY or BUSY_INTERNAL for the entire duration.
If timing coordination with other software is needed (for example, to run routines that must avoid overlapping with flash programming), the correct AUTOSAR‑compliant way to detect when an atomic flash step has finished is to use Fls_GetStatus(). Fls is the module that actually executes and tracks each atomic flash operation. When Fls_GetStatus() returns FLS_IDLE, the previous flash step is fully complete and the driver is waiting for the next main‑function call. That idle moment is the safe window in which other timing‑sensitive tasks can run.
After these tasks complete, calling Fee_MainFunction() again will allow Fee to proceed with its next atomic step. This method remains fully compliant with AUTOSAR design rules, requires no direct hardware access, and preserves the integrity of Fee’s internal scheduling.
In summary:
Fee jobs consist of multiple atomic flash steps executed one by one.
Fee_GetStatus() becomes MEMIF_IDLE only when the entire Fee job is finished.
Fls_GetStatus() provides the fine‑grained information needed to detect when each individual atomic flash step has completed.
By running other software tasks only when Fls reports idle, and by controlling when Fee_MainFunction() is invoked, the application can safely interleave its own operations with Fee’s multi‑step flash activity.
Regards,
Lukas