PsSoc6 FLASH应用:怎么应用内置空间做大数据掉电存储,比如>128KB

公告

大中华汽车电子生态圈社区并入开发者社区- 更多资讯点击此

Tip / 登入 to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
zhch_4550981
Level 3
Level 3
10 replies posted 10 questions asked 5 replies posted

现在我这有一个产品做迭代升级,提升用户体验:把蓝牙移到便携式监测设备上,其中:

1、便携式设备内置纽扣电池,容量20mAh,比较小,考虑功耗+蓝牙+存储,所以选型到了PsSoc6上;

2、产品工作内容:一秒监测一次ADC,存储到芯片,一般连续存储5-8小时;用户通过APP同步,获取监测历史数据,并清空芯片存储;

3、产品功能比较单一,无需其它高级算法,只有监测和存储基本功能;

0 点赞
1 解答
NazarP_56
Employee
Employee
25 solutions authored 10 sign-ins 50 replies posted

你好zhch_4550981,

If you want to write larger data (>127k) during an active BLE connection, you need to be aware that the flash write function does not write all 127k in each flash write function call. In this case, you will block the "main loop" for a long time. According to the BLE documentation, to maintain a BLE connection, you must call Cy_BLE_ProcessEvent() at least once per connection interval(CI) and do not block the BLESS interrupt. Therefore, you need to implement some state machines and write 1 row (512b) per call of your flash write function, otherwise you will have disconnection by reason CONNECTION_TIMEOUT. You can look at Cy_BLE_StoreAppData function or implement similar..


Also you will need to modify the Linker script (*.ld) to use some part from "Application flash" section for  your "Flash_Storage" (see example in Linker script how it done for 'em_eeprom' section).

问候,
Nazar

在原帖中查看解决方案

7 回复数
ShipingW_81
Moderator
Moderator
Moderator
500 replies posted 250 solutions authored 250 replies posted

可以再解释下你的意思?

PSoC 6内部flash都有掉电非易失性,且flash大小均大于128KB。在flash大小范围内,可以任意存储数据,若内部flash空间不够,也可以外挂flash。

0 点赞

内部存储.png

我要存储128KB数据,优先使用“ Application flash ”的剩余空间?

如果产品需要用芯片的FLASH来做掉电数据存储,读/写/擦FLASH是不是要关中断这些,会导致蓝牙断线吗?

模拟的32KB-EEPROM,用作数据缓存,再转到FLASH,是不是更方便?比如:在关机前、或缓存数据达到32KB前,把EEPROM的数据写到FLASH。

现在确实因大数据存储,伤透了脑筋!不希望外接EEPROM(>128KB),成本高,占PCB空间。

0 点赞
ShipingW_81
Moderator
Moderator
Moderator
500 replies posted 250 solutions authored 250 replies posted

在BLE连接期间连续的进行flash的写操作,确实可能会导致BLE时间pending或者断连,所以最好在BLESS状态为CY_BLE_BLESS_STATE_EVENT_CLOSE时进行flash写操作。

相对于你的应用要求,32KB EEPROM空间不够存储完整的数据,因此直接写flash或者EEPROM作为缓存都时可行的,需要看具体情况,如果EEPROM作为缓存,会花掉两次写入的时间。

0 点赞

那我在蓝牙连接的情况下,进行读/写/擦“模拟的32KB-EEPROM”,不会导致蓝牙断线吗?

0 点赞
ShipingW_81
Moderator
Moderator
Moderator
500 replies posted 250 solutions authored 250 replies posted

存在这种断连可能,所以最好在Cy_BLE_StackGetBleSsState返回CY_BLE_BLESS_STATE_EVENT_CLOSE时进行flash写操作。

0 点赞

According https://www.omo-ic.com/ to the information on the Internet, the lifetime of a single NOR Flash address is affected by the number of times of erasing. To be more specific, each bit on a single address is independent. For example, the address 0x08011000 has a total of 8 bits. Suppose I keep looping the data of this address to 0x01 and 0x00. Then the bit0 bit will be erased all the time. After tens of thousands of cycles, the bit 0 bit may be damaged and cannot be erased. However, bit0 corruption does not affect the function of other bits, such as bit1, or it can be used normally.

0 点赞
NazarP_56
Employee
Employee
25 solutions authored 10 sign-ins 50 replies posted

你好zhch_4550981,

If you want to write larger data (>127k) during an active BLE connection, you need to be aware that the flash write function does not write all 127k in each flash write function call. In this case, you will block the "main loop" for a long time. According to the BLE documentation, to maintain a BLE connection, you must call Cy_BLE_ProcessEvent() at least once per connection interval(CI) and do not block the BLESS interrupt. Therefore, you need to implement some state machines and write 1 row (512b) per call of your flash write function, otherwise you will have disconnection by reason CONNECTION_TIMEOUT. You can look at Cy_BLE_StoreAppData function or implement similar..


Also you will need to modify the Linker script (*.ld) to use some part from "Application flash" section for  your "Flash_Storage" (see example in Linker script how it done for 'em_eeprom' section).

问候,
Nazar