I'm using the MK64FN1M0, and looking at the K64 Sub-Family Reference Manual, Rev. 2, January 2014. I want to erase and reprogram the zeroth sector in block 1 of my program flash. I can see how the Erase Flash Sector command works, but I'm trying to figure out if the Program Section command is appropriate, and how to use it if it is. It refers to the "Section Program Buffer", which the Glossary defines as the "Lower quarter of the programming acceleration FlexRAM". Well, I don't have any FlexRAM, just 4KB of "programming acceleration RAM" which is supposedly accessible at 0x14000000. However, 18.104.22.168.1 on page 708 suggests that the latter can be used in lieu of the former. Step 3 begins, "Beginning with the starting address of the programming acceleration RAM (program flash only devices) or Flex RAM (FlexNVM devices), sequenctially write enough data to the RAM to fill an entire flash sector." Subsequent steps say to issue the Program Section command, and then go back and erase the next sector, which I don't have to do since I'm only writing one sector.
However, 22.214.171.124 says that "The section program buffer is limited to the lower quarter of the FlexRAM (byte addresses 0x0000-0x03FF). Data written to the remainder of the FlexRAM is ignored and may be overwritten during Program Section command execution." This is only 1K. I believe FlexRAM is a lot bigger than 4K, so this suggests that the numbers may refer to the programming acceleration RAM instead. But if I can only use the first 1K of that, how do I program an entire sector?
I get the feeling that this documentation is all wrong, and that one of the following three things must be true:
1) I can load the entire 4K of the programming acceleration RAM with what I want to write to the sector, and use one Program Section command to program the sector.
2) I can load the first 1K of the programming acceleration RAM with one quarter of what I want to write to the sector, use the Program Section command to program one quarter of the sector, then repeat that three more times to fill in the whole sector.
3) The Program Section command really is just for FlexNVM parts, and I need to use the Program Phrase command 512 times.
Can anyone tell me which is the case?