⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
8 posts / 0 new
Last post
matthieuW
Offline
Last seen:3 months 2 weeks ago
加入:2015-11-20 14:55
erase flash data

我实现了一个自定义董事会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

Attachment:
Device:
MT_dialog
Offline
Last seen:2 months 2 weeks ago
工作人员
加入:2015-06-08 11:34
Hi matthieuW,

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

matthieuW
Offline
Last seen:3 months 2 weeks ago
加入:2015-11-20 14:55
Dear 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

MT_dialog
Offline
Last seen:2 months 2 weeks ago
工作人员
加入:2015-06-08 11:34
Hi matthieuW,

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:

  1. The VES is applied only to a specific partition and this is the GENERIC_PART, since this is the part that should be written and erased more often, so i dont really get the question regarding the partition size limitation, can you be more specific on what is that you mean ? The VES flag will divide the size of the partition into equally seperated regions (8) and so the usable space of the flash will be the partition size divided by 8, you cannot explictly erase when operate with VES, you just write to another location treated as the same address.
  2. Theoretically all the partitions can support this but as said, the VES is used only on the GENERIC_PART partition since this is the partition that is more oftenly being written and erased, using VES on the parameters partition, i am not sure how this will operate, most probably it would work, but if there is an issue with the erase when its time for performing an erase from the VES and an attempt to rewrite data i would expect the same effect.
  3. I dont see anything wrong with the partition table that you have attached.

Thanks MT_Dialog

matthieuW
Offline
Last seen:3 months 2 weeks ago
加入:2015-11-20 14:55
I am working with SDk1.0.12,

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

MT_dialog
Offline
Last seen:2 months 2 weeks ago
工作人员
加入:2015-06-08 11:34
Hi matthieW,

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

matthieuW
Offline
Last seen:3 months 2 weeks ago
加入:2015-11-20 14:55
I disabled the MACRONIX

I disabled the MACRONIX_PERFORMANCE_MODE in the flash configuration file and everything is working fine.
thanks for your help.
matthieu

MT_dialog
Offline
Last seen:2 months 2 weeks ago
工作人员
加入:2015-06-08 11:34
Hi matthieuW,

Hi matthieuW,

Thanks for indicating that.

Best Regards MT_dialog