I need to write a value to the flash as a check bit for the bootloader. So the bootloader can determine whether to stay in bootloader to update the program or jump to the existing application.
Hi Brendan,
Sorry for the later reply.
Please make sure the erased sector is not in Flash protection range.
Could you provide the FTFE_FPROTn registers value for double check?
Have a great day,
Ma Hui
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Ma Hui,
Do you mean the FTFA_FPROTn? Using the EmbSys Register tab in kinetis those registers are all 0xFF. Seems like that would mean nothing is protected.
-Brendan
Hi Brendan,
Please check [Erase Flash Sector Command] info with K22 reference manual:
The ACCERR with below condition, please check if the provided Flash address is no phrase aligned (flash_address[2:0] = 000).
And could you check with MCUXpresso SDK for TWR-K22F120M [flash] demo, which located with below path:
..\SDK_2.2_TWR-K22F120M\boards\twrk22f120m\driver_examples\flash\pflash\iar
If that demo also with same issue on your site? Thanks.
Have a great day,
Ma Hui
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi,
If using runtime routine to program data at Flash address, customer could refer TFS Flash Driver Software for Kinetis® and ColdFire+ Microcontrollers(REV 1.03) provided [demo_normal].
https://www.nxp.com/downloads/en/device-drivers/C90TFS_FLASH_DRIVER.exe
Customer could refer [MK21FN1M0xxx10] chip related code as an example.
Wish it helps.
Have a great day,
Ma Hui
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hey Ma Hui,
I implemented the driver examples in the SDK, but its causing an error return when I try to go erase the flash. The result I get back is kStatus_FLASH_AccessError. Is there another step I need to do to unlock something.
-Brendan