Hello @Vijay98 !
I downloaded the model you provided and I have the following remarks:
For the first issue, I noticed that the Mem_MainFunction block is misplaced. It is absolutely necessary for the Mem_MainFunction to be executed as many times as required after each operation specific function call. The way it is currently implemented now, it will be executed only once. Please see my previous reply as well. In order to fix this, please add the MainFunction Trigger Subsystem after each Erase/Read/Write operation block. The number of function specific blocks and the number of MainFunction Subsystems must be equal.
More so, I do not recommend cascading the blocks as in the provided model. Since you mentioned that the final model will have a state machine, it is more reliable to add the Function specific block and the MainFunction Subsystem in their specific state. In this way, they are controllable by a state variable and not by a status that may or may not be the expected one. For example, while in "Erase" state, apart from additional algorithms you may implement, the following logic must be executed:

After the Erase operation is successful, the State Machine can switch to "Write" state, which should look similar, the only difference being the Mem_Erase operation being replaced by the Mem_Write. And so on. If you include both the operation specific function call and the MainFunction Trigger Subsystem, you should be able to execute sequentially as many operations as needed(with the limitations mentioned in my first reply).
As for the second question, I believe there might be some confusion with how the Mem_Write function operates. The content of the attached picture is not taken from the provided model. In the picture, it seems to be an issue on how the second input of the block is interpreted. It appears that the SourceAddress value is being fed into the block as the Source Data, which will cause errors. The Mem_Write block has 3 input parameters:
- TargetAddress. This parameter specifies at which address to start writing data in the desired memory zone.
- Source Data. This parameter specifies the content to be written at the target address.
- Length. This parameter specifies how much from the provided Source Data to be written at the target address.
If there is further confusion on how some inputs of the block are implemented for different Mem functions, please refer to the Mem Block and Example help files.

1. Source Data can be taken from anywhere(Data Stores, State Machine Outputs, Constant values, even Mem_Read outputs etc.) and can be fed into the Mem_Write block as long as it is structured in an array of uint8 values.
2. As previously stated, the Mem_Write block accepts memory location as an input, on the TargetAddress parameter. The TargetAddress can be fetched the same way as Source Data and can be fed directly into the block, as long as it is a valid uint32 value that does not exceed the defined range for the configured Mem Instance.
I hope this will help fix your current issues with the model.
Best regards,
Florin.