[K32W061][FLASH] Problem with writting to pFlash region of Flash

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

[K32W061][FLASH] Problem with writting to pFlash region of Flash

564 Views
Mateusz_K
Contributor I

Hello, 

 

I've been working with the K32W061K recently. I am trying to write some configuration parameters to Flash region that manual refers to as pFlash. I am able to read the sectors correctly using functions located in ROM (SDK functions). However when I try to change one of the parameters and write new configuration I fail. I am receiving WRITE_OK status code. Pseudo-code describing my method is located below:

.

psector_page_data_t page_data;
psector_page_data_tpage_data_pointer = &page_data;
psector_page_t* page_ptr = (psector_page_t*)page_data_pointer;
psector_ReadData(PSECTOR_PFLASH_PART, 0, (uint32_t)0, (uint32_t)FLASH_PAGE_SIZE, (void*)page_data_pointer);
page_data.pFlash.device_id = (uint64_t)0x12345678;
page_data.hdr.version++;
page_data.hdr.checksum = psector_CalculateChecksum(page_ptr);
psector_write_status_t status = psector_WriteUpdatePage(PSECTOR_PFLASH_PART, page_ptr);

 

0 Kudos
5 Replies

560 Views
Mateusz_K
Contributor I

OK, I was able to change parameter hwtestmode_disable. So now my question is which parameters from pFlash are changeable?

0 Kudos

539 Views
EduardoZamora
NXP TechSupport
NXP TechSupport

Hello @Mateusz_K

Hope you are doing well.

Just to confirm, you are trying to write the "protected data" region of the flash memory, is this correct?

What is the purpose of modifying this region in your application/development? Which fields are you trying to modify?

Some values of pFlash, such as hardware test mode or ISP access level, may be modified. Nonetheless, extreme care needs to be taken when updating PFLASH to avoid corrupting other fields or damaging your device.

Regards,
Eduardo.

0 Kudos

518 Views
Mateusz_K
Contributor I

I am aware of the risk. Well, at least partly. My project demands the ability to write to all possible fields of the pFlash region. Maybe there is some additional documentation, besides SDK comments, that explains the meaning of the rest of the fields? 

0 Kudos

511 Views
EduardoZamora
NXP TechSupport
NXP TechSupport

Hi,

I apologize for insisting, why would your project require to have the ability to write to all the fields of pFlash?

Any additional details would be appreciated.

Regards,
Eduardo.

0 Kudos

479 Views
Mateusz_K
Contributor I

Well, I won't be writing to all of them, but it's nice to have more information than just SDK comments. Besides how does unlocking a device works in the case of this MCU? I understand that I am supposed to send signed unlock key via ISP. Signed by which private key? What if I didn't specified an unlock key and locked a device? 

 

0 Kudos