⚠️
你好。。谢谢你来到论坛。令人兴奋的消息!我们现在正在迁移到新的论坛平台,该平台将提供更好的功能,并包含在主对话网站中。所有帖子和账号都已迁移。我们现在只接受新论坛的流量-请在https://www.dialog-semicondiondiondumon.com/support.。我们将在未来几天修复错误/优化搜索和标记。
21帖子/ 0新
最后一篇文章
Utkarash
离线
最后一次露面:1年7个月前
加入:2019-01-18 06:36
Unable to Read/Write data From Flash

大家好,

我使用了SDK 5.0.4中的ble_外围示例作为参考,在DA14583的子板上构建了我的应用程序,

我使用它基于连接的方法,

在基于连接的方法中,我在基于连接的方法中获得一些数据(即,128字节),并且我想要写入/读取/从闪存的相同数据。

当设备与中央断开连接时,我将数据写入闪存,在所有初始化之后,我同样会在periph_init函数中读取数据。

I have made the required change for the same and made separate header and source files to handle Flash Read/Write operation, Which I have attached with this post.

我面临的问题是,当我读/写数据闪存时,我的设备在重新通电时停止广告。

我试图调试相同的设备,但当设备处于调试状态时,它工作正常。然而,当我在闪存读/写周期后将代码转储到闪存中时,如果我重新为设备供电,它将停止广告。这种情况尤其在执行写入循环时发生。

My code memory extends till address 0x7DC8 in the Flash memory, So I have given start adddress as 0x 7E00 with read/write size of 256 bytes while Read/Write operation.

I Have tried changing the start adddress to 0x7E10, 0x7EF0, 0x7F00, and read/write size to 255, 100, 128, Taking care that the last address (0x7FFF) of flash doesn’t exceeds.

请尽早帮助我在这种情况下

I am not understanding the reason as i have used the same method and same source and header files in another project which is also connection based, where i am able to read/write data from /to flash without any issue. Here my start address was 0x7000 and size was 150 bytes.

有关我的测试的更多信息

我有很少的观察结果也可能是错误的,但只是告诉你,如果它有所帮助

我已经观察到API“SPI_FLASH.H”的参数“Sector_erase”(API_FLASH_BLOCK_ERASE(USER_FLASH_RW_ADDRESS,Sector_ERase);“虽然闪存写入操作会影响设备的广告,但

当我将此参数更改为0x10,0x05或在API中直接传递255/256时,而不是传递参数“Sector_erase”。

The advertising issue gets solved but either the data is not written in flash or either the data written gets manipulated

我在调试和智能代码片段工具中也检查了这一点。

谢谢和问候

Utkarsh

PM_DIALOG.
离线
最后一次露面:5 hours 15 min ago
职员“title=
加入:2018-02-08 11:03
嗨utkarash,

嗨utkarash,

你提到的是,在调试模式下运行代码时正常工作,但问题是当读/写入闪存时,是我的理解正确?如果在调试模式下运行代码,请您说明与闪存交互时会发生什么吗?

建议不要在Periph_init()函数中与SPI闪存进行交互。此功能将在系统靴子和设备唤醒时触发。您是否将休息点添加到已实现的读/写函数中?另外,如果您已启用或禁用看门狗,请您能告诉我吗?您问题的最可能原因是您的固件可能会粘在某个地方。

如果设备停止adverting并且固件正在执行罚款,则应触发.app_on_adv_undirect_complete回调。您能否在此回调函数中添加一个断点?

“我不理解原因,因为我在另一个同样基于连接的项目中使用了相同的方法、相同的源文件和头文件,在这个项目中,我能够从闪存读取/写入数据,而不会出现任何问题。这里我的起始地址是0x7000,大小是150字节。”

Could you please indicate in which project of the SDK the code is working as expected? Are you using any of the sleep modes ore the device is operating in active mode?

谢谢,PM_DIALOG.

Utkarash
离线
最后一次露面:1年7个月前
加入:2019-01-18 06:36
谢谢您的答复

谢谢您的答复

你提到的是,在调试模式下运行代码时正常工作,但问题是当读/写入闪存时,是我的理解正确?Yes its correct when i flash the code and perform SPI flash read/write then it stops advertising.

如果在调试模式下运行代码,请您说明与闪存交互时会发生什么吗?In debug everything works properly no issue is observed the code flow was proper i.e., after read write fxn's the code properly goes back to normal code flow.

Did you add a break point into the read/write functions that you have implemented ?Yes i tried by keeping breakpoint but didnt face any issue also i tried changing the calling position of read flash from periph init. Now i call read flash in timer handler fxn after 5/10 secs of Initialization. But still issue remains the same.

另外,如果您已启用或禁用看门狗,请您能告诉我吗?不,我没有启用或禁用看门狗。如果我的代码陷入困境,我怎样才能找到它的卡住和解决方案?

您能否在此回调函数中添加一个断点?Please accept my sincere apologies. Actually i forgot to inform yesterday that i have made some modification in ble_perihpheral code as i wanted to operate my device in both Observer and Pheripheral mode so now i dont have "app_on_adv_undirect_complete callback" but my device works fine. Is this creating issue?

Could you please indicate in which project of the SDK the code is working as expected?project same ble peripheral but only connection based and SDK also same (5.0.4)

您使用的是设备在活动模式下运行的任何睡眠模式吗?不。

请注意我在下面提到的确切流程,以便在我刷新代码时理解设备何时停止广告

  • 我加电,然后连接到它 - >在连接到它后,共享所需数据 - >然后我断开连接,同时我称为写入闪存功能 - >然后如果我重新扫描设备是广告 - >现在我关闭电源和电源 - >在重新扫描设备时,目前停止广告。

改变了尝试

我评论了api“spi_flash_block_erase(用户_flash_RW_地址,扇区_erase)”,并在flash中转储了相同的代码。

After following above steps mentioned with bullet point, it worked properly.

I might be wrong but just had a query so wanted to confirm with you that Is this api causing issue beacuse for block erase i have very less memory left after the start address (i.e., 512 bytes (7E00 to 7FFF) ) ?

如果是这样,我们可以使用任何备用函数而不是“spi_flash_block_erase”,其中我可以删除自定义字节数(删除256或512字节也将有所帮助)?或者还有其他问题吗?

Please help me with this at the earliest.

Thanks and Regards

Utkarsh

Utkarash
离线
最后一次露面:1年7个月前
加入:2019-01-18 06:36
大家好,

大家好,

关于昨天的帖子有什么更新吗?

There is one more observation which i would like to share that, what "spi_flash_block_erase"api会从0x7000闪存地址中提取包含的内容,这反过来会导致擦除闪存中的一些代码部分。

As i have checked on Smart snippet after dumping the code the total code extends till memory address 0x7D40.

Please Help at the earliest to avoid this issue.

Thanks and Regards

Utkarsh

PM_DIALOG.
离线
最后一次露面:5 hours 15 min ago
职员“title=
加入:2018-02-08 11:03
嗨utkarash,

嗨utkarash,

  • 不,我没有启用或禁用看门狗。如果我的代码陷入困境,我怎样才能找到它的卡住和解决方案?

你那是什么意思?看门狗可能是禁用或启用的。如果定义了da1458x_config_basic.h中的cfg_wdog宏,则启用WatchDog。默认看门狗周期是watchdog_default_period宏,它在Arch_wdg.h中定义。有关看门狗的更多信息,请参阅数据表。

  • Please accept my sincere apologies. Actually i forgot to inform yesterday that i have made some modification in ble_perihpheral code as i wanted to operate my device in both Observer and Pheripheral mode so now i dont have "app_on_adv_undirect_complete callback" but my device works fine. Is this creating issue?

To be honest, I am not sure how you implemented this functionality. Do you have implemented role switching? If you remove the flash read/write, is it working correctly?

  • In debug everything works properly no issue is observed the code flow was proper i.e., after read write fxn's the code properly goes back to normal code flow.

What do you mean in “normal mode”?

  • Please check the spi_flash peripheral example of the SDK in which the spi_flash_block_erase() is used. The code works perfectly with the SECTOR_ERASE.

The most possible reason might be that your code might get stuck somewhere. I would suggest you to run your code in debug mode, step over the code and try to find where it gets stuck. For example, when reading/writing, is the procedure finished? Did you check what the code does? Please read the教程8:调试方法

谢谢,PM_DIALOG.

Utkarash
离线
最后一次露面:1年7个月前
加入:2019-01-18 06:36
Thank you for your Response

Thank you for your Response

1)诚实,我不确定如何实现此功能。您是否已实现角色切换?如果删除闪存读/写,它是否正常工作?

Ans :Yes, i have implemented role switching. It works correctly with out flash read/write. Also Please note that i have observed that if i remove flash write function, and keep only flash read function it works totally fine, with no issues.

2)在“正常模式”中你的意思是什么?

Ans :正常模式意味着代码按预期运行,即在调试时,当我运行代码时,正如我之前所说的那样它在观察者和Pheripheral模式下切换了正确的角色,我可以连接到设备,我可以连接数据。此数据正确存储在闪光灯中。如果尝试读取闪光灯,我也可以正确阅读它,并且没有代码困扰的地方。

根据我的观察,我早些时候分享了“spi_flash_block_erase”api which is a part of flash write function earses the contents from 0x7000 flash address which in turn leads erasing of some part of my code in flash. As i have checked on Smart snippet after dumping the code the total code extends till memory address 0x7D40.

我可能是错的,但是,我认为在调试ode the code is in RAM and when perform write flash operation it doesnt affects the code, But when the code is dumped in flash (using Smart Snippet Toolbox) and on executing the flash write operation the code part which is written from adddress 0x7000 to 0x7D40 is erased (Checked with Read30KB option on Smart snippet Toolbox).

3) Please check the spi_flash peripheral example of the SDK in which the spi_flash_block_erase() is used.

Ans :谢谢你的回复。根据你的建议,我已经完成了“spi_闪存外围设备示例”

However as i mentioned that“spi_flash_block_erase()”还可以在我的代码中正常工作。But what it does is, that it earse some part of my code which it turn is leads to stopping advertisement, So I am requesting you that is there any method/api avliable where i can just earse one page (i.e., 256 bytes) of memory size ?那么请尽早帮助我。

因为“spi_闪存外围设备示例”我只找到了像这样的功能“spi_flash_block_erase()”spi_flash_chip_erase.andspi_flash_chip_erase_forced.它再次导致闪存中的我的代码内存部件

4) 例如,当读/写时,程序完成了吗?你查过代码的作用了吗?

Ans :谢谢你的链接我将通过它。是的,我已经检查了读写FALSH操作后的代码,它不会停止任何地方

请验证我在下面提到的调试步骤

  • On runing the code in Debug, the device keeps role switching every 2 secs. Where inobserver mode我可以扫描其他BLE设备并接收他们的广告数据包peripheral modeI am able to connect to my device using BLE scanner.
  • Now I connect to the device using BLE scanner app perform data exchange.
  • 数据交换后,我将设备与应用程序断开连接,同时在用户_on_disconnection fxn中执行闪存写入功能。
  • Then again the device keeps role switching properly. Also I able to connect and Exchange data with device and scan in observer mode.
  • 然后我尝试执行Flash读取操作,我能够读取正确的数据。
  • 我还尝试过关闭设备电源(即退出调试并断开设备)。然后再次打开设备电源,在调试中运行代码并执行读闪存操作。我能正确地得到数据。
  • 此外,如果我重新设置这些步骤,我不会有任何问题。

请尽早帮忙。

Thanks and Regards

Utkarash

Utkarash
离线
最后一次露面:1年7个月前
加入:2019-01-18 06:36
大家好,

大家好,

这个案子有更新吗

请帮忙,

谢谢和问候

PM_DIALOG.
离线
最后一次露面:5 hours 15 min ago
职员“title=
加入:2018-02-08 11:03
嗨utkarash,

嗨utkarash,

  • 您已无效App_on_adv_undirect_complete回调。这可能是一个问题,因为SDK5无法同时处理观察者角色和外围角色。对于双重角色实现,您需要停止像广告的空运操作,然后您可以切换到观察者角色
  • Please indicate if the CFG_WDOG macro in da1458x_config_basic.h is defined or not.
  • 您对用户\u FLASH\u RW\u地址使用的值是多少?
  • 我建议您使用spi_flash_configure_memory_protection()API来确认不应该写入内存的哪一部分。之后,他可以调用spi_flash_芯片_擦除API来擦除未受保护的内存区域。我的意思是对闪存应用内存保护,然后使用API调用擦除内存,该调用只会擦除未受保护的内存区域

谢谢,PM_DIALOG.

Utkarash
离线
最后一次露面:1年7个月前
加入:2019-01-18 06:36
Thank you For your Response

Thank you For your Response

1)请注明DA1458x_config_basic.h中的cfg_wdog宏是否定义了。

ans:是的,它是默认定义的,我没有在那里进行任何更改。

2) What is the value you are using for USER_FLASH_RW_ADDRESS?

Ans: 0x7E00

我会尝试在我的代码中实现这个内存保护,并尝试运行代码返回给您,直到那么请检查并告诉我们的看门狗或“user_flash_rw_address”地址导致任何问题。

另外,你能帮我使用内存保护api吗?因为它只有一个参数和选项可以传递参数“W25x10_MEM_PROT_NONE”、“W25x10_MEM_PROT_UPPER_HALF”、“W25x10_MEM_PROT_LOWER_HALF”、“W25x10_MEM_PROT_ALL”,我想保护0x7000到0x7DF0。

Thanks and Regards

Utkarsh

PM_DIALOG.
离线
最后一次露面:5 hours 15 min ago
职员“title=
加入:2018-02-08 11:03
嗨utkarash,

嗨utkarash,

Please implement the memory protection and let me know.

谢谢,PM_DIALOG.

Utkarash
离线
最后一次露面:1年7个月前
加入:2019-01-18 06:36
大家好,

大家好,

我实施了内存保护,但问题我所遇到的是我无法使用Smart Scippet Toolbox等待我的设备中的转储/程序/刻录代码,即,我无法耳机。

1)此外,由于我之前通知,在智能片段上,代码占用的总闪光灯为0x0乘以0x0x07d48,其中在我阻止擦除api时“spi_flash_block_erase(0x07e00,sector_erase)”the code part from 0x07000 to 0x07D48 where as i have given start address as 0x07E00.

Considering the case of point 1 if i use memory protection api in this case, I was not able to rewrite my data to the flash on the same memory address [i.e., 0x07E00],

我已经尝试了存储器保护API,其中包含以下所有参数,

a)spi_flash_configure_memory_protection(w25x20_mem_prot_upper_quarter);

b) spi_flash_configure_memory_protection(W25x20_MEM_PROT_UPPER_HALF );

c)spi_flash_configure_memory_protection(w25x20_mem_prot_lower_quarter);

d) spi_flash_configure_memory_protection(W25x20_MEM_PROT_LOWER_HALF );

e)spi_flash_configure_memory_protection(w25x20_mem_prot_all);

我已经尝试了所有上述参数,但我要么无法重写数据到闪存,或者代码部分被耳朵。问题仍然是相同的

我请求你帮忙

Thanks and Regards

Utkarsh

Utkarash
离线
最后一次露面:1年7个月前
加入:2019-01-18 06:36
大家好,

大家好,

上述问题是否有任何更新?

谢谢并发生

Utkarash

PM_DIALOG.
离线
最后一次露面:5 hours 15 min ago
职员“title=
加入:2018-02-08 11:03
嗨utkarash,

嗨utkarash,

As far as I can understand from what you have described, probably the firmware that you are running is corrupted. Could you please indicate if you have boot from Sys-RAM or from SPI Flash? Did you have burnt the SPI Flash with your firmware? If yes, please to the following procedure in order to make sure that the binary images is corrupted when writing data to the flash or not.

  • Build you project and then use the Flash Programmer tool from the SmartSnippets toolbox in order to burn the SPI Flash and make the device bootable.
  • After that, export the binary image as it is burn in the SPI Flash.
  • 然后,连接到对等设备并将您想要的数据写入SPI Flash
  • 写入数据后,再次导出SPI闪存的二进制图像。
  • 比较两幅图像,并指出它们是否相同。使用差异工具来比较它们。您在SPI闪存中写入的数据,写入了哪些地址?

谢谢,PM_DIALOG.

Utkarash
离线
最后一次露面:1年7个月前
加入:2019-01-18 06:36
大家好,

大家好,

Thank you for responding,

Could you please indicate if you have boot from Sys-RAM or from SPI Flash?ANS:SPI Flash。

你的固件烧坏了SPI闪存吗?答:是的

比较两个图像并指示它们是否相同。使用Diff工具以比较它们。Ans: I followed the steps that you have recomended and also compared both the files In WinMerger tool but both the images are appearing different

您在SPI闪存中写入的数据,写入了哪些地址?Ans: To get exact what has happened before and after flash write operation i loaded both the files in Smart snippet using Browse option in SPI flash Programmer tab. for the same i have attached an Image called as comparision Please Check with it

在闪存数据写入操作和闪存数据写入操作之后,我还为两者附加了导出的二进制文件。

“之后,在SPI闪存中刻录时导出二进制图像。”,文件被命名为在数据写入闪存之前。箱子on the link given below

https://drive.google.com/file/d/10tSntB6UZ1bX7yvFYnb5SMey4PEW0sw-/view?u...

“只要数据写入,再次导出SPI闪存的二进制图像。”,文件名为数据wrirtten flash.bin之后on the link given below

https://drive.google.com/file/d/10tSntB6UZ1bX7yvFYnb5SMey4PEW0sw-/view?u...

如果有任何替代api而不是“spi_flash_block_earse”,我只能使用页面而不是块内存,请帮助我。

感谢致敬

Utkarash

附件:
PM_DIALOG.
离线
最后一次露面:5 hours 15 min ago
职员“title=
加入:2018-02-08 11:03
嗨utkarash,

嗨utkarash,

您可以请zip并附上两个二进制图像以检查它们吗?

If you don’t call the spi_flash_block_earse, after writing the data into the SPI flash, are you able to boot? I am trying to understand which the cause of your issue might be.

谢谢,PM_DIALOG.

PM_DIALOG.
离线
最后一次露面:5 hours 15 min ago
职员“title=
加入:2018-02-08 11:03
嗨utkarash,

嗨utkarash,

您可以请zip并附上两个二进制图像以检查它们吗?

If you don’t call the spi_flash_block_earse, after writing the data into the SPI flash, are you able to boot? I am trying to understand which the cause of your issue might be.

谢谢,PM_DIALOG.

Utkarash
离线
最后一次露面:1年7个月前
加入:2019-01-18 06:36
大家好,

大家好,

Thank you for response.

您可以请zip并附上两个二进制图像以检查它们吗?对不起,我用这条消息附加了Inconvinenc。

If you don’t call the spi_flash_block_earse, after writing the data into the SPI flash, are you able to boot? I am trying to understand which the cause of your issue might be.你的理解是正确的,如果我不打电话,就是正确的“spi_flash_block_earse"i am able to boot but if flash is not earsed my data is also not written in flash.

如果设备即将进入生产阶段,请尽快帮助帮助,只有这个问题正在进行,我需要紧急解决。

I request you to please help if possible with any other api where i can only erase page of flash

谢谢并发生

Utkarsh

Utkarash
离线
最后一次露面:1年7个月前
加入:2019-01-18 06:36

大家好,

这个问题有更新吗?

我请求你帮忙at the earliest as the device is about to go in production stage and only this issue is remaing i need to solve it urgently.

Thanks and Regards

Utkarash

PM_DIALOG.
离线
最后一次露面:5 hours 15 min ago
职员“title=
加入:2018-02-08 11:03
嗨utkarash,

嗨utkarash,

根据数据之前的二进制文件写入SPI闪存,执行代码从0x0000(sector_0)存储到0x7bd7(sector_7)。每个扇区为0x1000字节。在固件中,数据将从user_flash_rw_address(0x07e00)开始写入/删除,该yours of overs_7井。在执行SPI_FLASH_BLOCK_ERASE(USER_FLASH_RW_ADDRESS,Sector_erase)时,将删除孔扇区_7,其中包含您的固件和存储数据。这意味着二进制图像已损坏,因此您将无法启动。请在将数据写入SPI Flash后检查二进制文件后,您将看到闪光灯从0x7000地址删除。如果您想在将数据写入Flash之前擦除扇区,则应在下一个扇区之一中进行。例如,在Sector_8中,因此您应该执行以下修改:

#define USER_FLASH_RW_ADDRESS 0x08000

spi_flash_block_erase(USER_FLASH_RW_ADDRESS, SECTOR_ERASE);

因此,在执行SPI_FLASH_BLOCK_ERASE()时,将删除Sector_8,其不包含执行代码。

谢谢,PM_DIALOG.

Utkarash
离线
最后一次露面:1年7个月前
加入:2019-01-18 06:36
Hello Sir,

Hello Sir,

谢谢您的答复

我已经用虚拟数据进行了检查,广告问题已经解决,但是现在我将通过写入正确的数据进行测试,并让您知道

Only one more question, As you said that i was using sector 7 (0x07000) and to read/write my data in flash, i should use sector 8 that is address 0x08000,

So considering this, till how many sector are available for user to save data. and will this have any effect on firmware.

再一次感谢你

谢谢和问候

Utkarash

PM_DIALOG.
离线
最后一次露面:5 hours 15 min ago
职员“title=
加入:2018-02-08 11:03
嗨utkarash,

嗨utkarash,

DA14583具有嵌入式1Mbit SPI闪光灯,其对应于1024 x 1024 = 1048576位或131072字节。您可以检查SDK5.0.4的BLE_APP_SECUTITY示例,其中使用SPI闪存以存储键合数据。在user_periph_setup.h标题文件中,下user_cfg_app_bond_db_use_spi_flash宏您将找到以下定义:

#define spi_flash_default_size 131072 // spi闪存大小以字节为单位

#define SPI_FLASH_DEFAULT_PAGE 256

#define spi_sector_size 4096.

每个扇区为4096(= 0x1000)字节对齐,因此每个扇区有131072个字节/ 4096字节= 32(= 0x20)可用扇区,对应于0x00000 - 0x1ffff地址空间。您可以使用SmartSnippets Toolbox的Flash程序员澄清它。

According to your binary before storing the data onto the flash, the firmware is located from 0x0000 (Sector_0) to 0x7BD7(Sector_7). To do so, you could use 0x08000 (Sector_8) - 0x1FFFF(Sector_32) if you want to perform sector erasing.

请检查附加图像,您将在我以前的帖子中提到的内容有关损坏的固件。

谢谢,PM_DIALOG.

附件: