我实现了一个自定义董事会DA14681智慧h a macronix MX25R3235F.
I can program my application in the flash without problem.
I can erase or rewrite flash data using the programmation scripts (program_nvparam, program_qspi, erase_qspi) without any problem.
However i am using the nvms param and generic parts for my application.
When i write data with my application, using ad_nvms_write everything is fine if the flash is blank at the address i want to write.
however when erasing data or writing new data the flash using ad_nvms_erase_region or ad_flash_erase_region or simply writing 'FF' to erase data,
the flash data is then corrupt with random data.
i suspect some configuration problem at the flash level, as i tried the same application code on a DA14680 with a winbond flash and everything is fine.
You will find attached my flash config file.
Thanks for your help.
matthieu
Hi matthieuW,
Tested with the .h file that you have attached on the post with an MX25R3235F on the pro dev kit, i ve written on the GENERIC PART partition (using the direct scheme and not VES, since you cannot actually erase data when using VES) an array of 10 bytes, then erased that speciifc address and then re-written with additional data, didn't noticed any corruption and the procedure was completed as it should.
Thanks MT_dialog
Dear Dialog,
thus the problem root cause should not be the flash config file.
我已经执行ed multiple test :
- i have no problem to write data to the param or generic partition when the flash is blank.
- when data is already written, i got random data when writing a second time at the same address,
here is the command i use :
nvms_t nvms= ad_nvms_open(NVMS_GENERIC_PART);
ad_nvms_write(nvms, addr, data, len);
and here is the partition table i use :
PARTITION2( 0x000000 , 0x025000 , NVMS_FIRMWARE_PART , 0 )
PARTITION2( 0x025000 , 0x001000 , NVMS_PRODUCT_HEADER_PART , 0 )
PARTITION2( 0x026000 , 0x001000 , NVMS_IMAGE_HEADER_PART , 0 )
PARTITION2( 0x027000 , 0x050000 , NVMS_FW_EXEC_PART , 0 )
PARTITION2( 0x077000 , 0x006000 , NVMS_LOG_PART , 0 )
PARTITION2( 0x07D000 , 0x002000 , NVMS_PLATFORM_PARAMS_PART , PARTITION_FLAG_READ_ONLY )
PARTITION2( 0x07F000 , 0x001000 , NVMS_PARTITION_TABLE , PARTITION_FLAG_READ_ONLY )
PARTITION2( 0x080000 , 0x010000 , NVMS_PARAM_PART , 0 )
PARTITION2( 0x090000 , 0x050000 , NVMS_FW_UPDATE_PART , 0 )
PARTITION2( 0x0E0000 , 0x320000 , NVMS_GENERIC_PART , 0 )
- when i change the generic part to VES and reduce its size below 0x100000, everything is fine,the problem is that my application requires all the space of the flash.
is there partition size limitation when using ves partition?
can i use the ves for the param partition?
is there some configuration i am missing?
regards
matthieu
Hi matthieuW,
Can you check if the data are properly erased after you have execute the erase command and before you try writting anything else on that specific address ? And also can you please mention which version of SDK you are using (there is a bug on SDK 1.0.10 where the erase of the flash is canceled due to anykind interrupt, this is fixed on SDK 1.0.12).
Regarding your questions:
Thanks MT_Dialog
I am working with SDk1.0.12,
I checked and the flash is well erased through the swd.
here is a simple log of what happen after erasing through jlink.
rdmem 0 64
0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
wrmem 0 0x0001020304050607
rdmem 0 64
0x0001020304050607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
wrmem 0 0xFFFFFFFFFFFFFFFF
rdmem 0 64
0x0001020304050607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
the second write is ineffective.
otherwise, i understand the ves partition principle
However if i declare my partition as ves, i don't have this problem which is confusing me.
matthieu
Hi matthieW,
Sorry, but i am not able to replicate what you are mentioning, using the same flash, using the driver that you have mentioned and the snippet below, the uint8_t data_buf_1 & 2 are just arrays containing 40 bytes of data:
generic_part_hndl = ad_nvms_open(NVMS_GENERIC_PART);
ad_nvms_write(generic_part_hndl, 0x00, data_buf_1, sizeof(data_buf_1));
ad_nvms_write(generic_part_hndl, 0x00, data_buf_2, sizeof(data_buf_2));
i was able to update the flash data, and verify it from the QSPI partition table tool, that the data were properly written, the only assumption that i can make is that either you are not using the adapters in order to interact with the partition, so something goes sideways, or in the above example you are reading the data not from the same task, but from a different one, therefore you are reading data before the flash is erased and updated with the new data from the previous task. Regarding the VES, as mentioned above, everytime you perform a new write, a different physical address of the flash is used which is allready empty.
Thanks MT_dialog
I disabled the MACRONIX_PERFORMANCE_MODE in the flash configuration file and everything is working fine.
thanks for your help.
matthieu
Hi matthieuW,
Thanks for indicating that.
Best Regards MT_dialog