Hi @yalin ,
Please debug this code:

Step by step, check the sdram_writeBuffer and sdram, sdram_readBuffer array.
make sure the writebuffer is 0,1,2,3...
Then, sdram arry write it, then readout the sdram to check it.
If still have issues, please also share me your partical schematic.
If you are not convenient to share it in the public community, you can create a new private case and at kerry zhou, then I will reply email to you directly iin private nstead of the public community.
About the process to create the private case:
1. Open below SUPPORT site, click blue "Go to Tickets" in the middle.
http://www.nxp.com/support/support:SUPPORTHOME
2.Then you will be requested to Login, if you have no an account, please first Register with your business email.
3.After login, please "Create New Cases" button in the middle, then you can submit your question.
In the case content, write assign to kerry zhou, then I will help you to check your schematic.
Best Regards,
kerry