Dear Dialog Support,
I need very urgent help in the flash read/ write procedure.
I have designed a device using DA14583 MCU, and I have written code where on the button press i am toggling the group of LED bulbs.
To operate LED bulbs, created a packet of data (packet include the number of bulbs and their address) which assigning from BLEScanner to custom device.
Next thing in firmware I read packet sent from the app I parsh it as per my application and store values/ data into flash( storing of data is perfectly happening ).
And I read data from flash whenever system power on rest did ( when the device initiates) reading is also perfectly happening.
I am facing issue while buring .hex file to device,
I have created a .hex file of my project and using the smart-snippet tool, burn the firmware into the custom device. After successful programming the device, I need to rest the device to advertise and initiate, while doing this, if I rest the device after buring .hex file, i get "0xFF" from the flash buffer and if I again(second time) rest the device I get my default state from the flash buffer.
I am not understanding why the device needs two-time rest to read actual data from the flash buffer?
Or am following the wrong method to get default data from falsh.
It is very urgent for me to slove this issue, please help me to resolve it.
Thanks and Regards
Rohit

嗨Rajapurerohit,
Let me ask you some questions in order to understand what you have accomplish. You burnt the SPI flash with your firmware with the usage of Flash programmer of SmartSnippets toolbox, didn’t you? After you download it your code and press reset, could you please make sure if your device is advertising correctly? You can test is with the Power profiler of the toolbox. Have you based on any of our SDK examples? If I am able to understand correctly, after the booting you would like to read some data from the SPI flash, is that correct? Since you have a custom board and custom application code, it would be very helpful to provide me some additional inputs or screenshots in order to replicate your issue.
Thanks, PM_Dialog
Hello PM_Dialog,
You burnt the SPI flash with your firmware with the usage of Flash programmer of SmartSnippets toolbox - Yes,
After you download it your code and press reset, could you please make sure if your device is advertising correctly - Yes, device advertising
After the booting you would like to read some data from the SPI flash, is that correct? - Yes,
In my firmware user_custs1_imple file, I have written a function where I store data/ read to/from flash. Please find my file attached where flash configuration and flash read/write read/write function written.
store data to flash buffer function -
1. void StorePIRSettings (void);
2. void CombineBDAwithBrightness(void);
read data from flash function-
1. void ReadPIRSettings (void);
2.void ui8UpdateLocalDatabase(void);
I am storing these data to flash [void StoreintoFlash(void)] when disconnects from the app and read data from flash [void ReadfromFlash(void)]when device initiate(i.e., in user_setup file void periph_init(void); function ).
所以,房颤ter the .hex file burn, when reset press I am getting (255) 0xFF in the buffer and if reset the device again I am getting 0x00. After the second reset, my device work perfectly data gets stored and read also perfect.
I want to know why the device needs a two-time rest to function properly. Please help me where I am doing wrong or am I following the wrong steps to debug.
Thanks and Regards
Rohit
嗨Rajapurerohit,
I suppose that you call the StoreintoFlash() in the user_app_disconnect, don’t you? So, after the disconnection. Can you please check the address that you would like to write the stored data from the flash programmer of the SmartSnippets toolbox? Are you able to see the expected data of you see only 0xFF? If you see 0xFF, this means that the value has not already been written. Also, as I am able to see from the code snippets that you have posted, you initialize and enable the SPI flash, both in ReadfromFlash() and in StoreintoFlash() but I am not able to see the SPI initialization. Could you please check at the spi_flash_peripheral_init() function of the spi_flash peripheral example of the SDK? Did you follow this example as reference?
Thanks, PM_Dialog
Hello PM_Dialog,
Yes, after disconnection I am storing data to flash, But I did not understand the step you mentioned to follow-[Can you please check the address that you would like to write the stored data from the flash programmer of the SmartSnippets toolbox? Are you able to see the expected data of you see only 0xFF?].
Can you brief me steps to follow for the above suggestion?
Yes, I have followed the spi_flash () code, I have made changes as I understood, am I doing something wrong in initialization steps?
And in one more project i am facing different issue with flash, same procedure i have followed to read/write what i am following for current project. However,
In this project (another project) device stops advertising.
Thanks and Regards
Rohit Rajapure
嗨Rajapurerohit,
What I mean is to read the SPI flash from the flash programmer of smart snippets toolbox. So, after the disconnection and without resetting your boards, you could check if your data have been stored successfully. Regarding you second question, could you please run your code in debug mode? I to download the firmware into the System-RAM, hot attach the debugger and check if the code gets stuck somewhere.
Thanks, PM_Dialog
Hi PM_Dialog,
Thank you quick response,
I have done the following steps, for第一个project-
1. First, burn the .hex file and reset the device [ device advertises]
2. Second, I again press the connect option on SmartSnippet tool and click on the Read option, saw that 7000 onwards address data is 0xFF [ No data is written]
3. Third, I assigned data from App (BLE Scanner) and repeated step 2, able to see data on field 7000 onwards address
4. Disconnected (power down) the device from USB and reconnected (power up) again using USB, again repeated step 2, I am able to see data.
Are this the correct steps I have followed?
And regarding my second project issue-
In debug mode code is not getting stuck anywhere is it working. I kept the code for half an hour run. the device still advertises perfectly.
Only after the burning .hex file and after assigning data from App and if I disconnect the device (USB) and again power up the device (USB), I am unable to see my device advertisement.
my first project I think we can solve it but the second project I need urgent help and it is something major issue.
So please help to solve my second project advertisement issue.
Thanks and Regards
Rohit
嗨Rajapurerohit,
Regarding your first project, it seems that the data are not written into the SPI Flash. I will check your code snippet again.
Regarding your second project, I suppose that you have burnt the SPI Flash with your firmware and the device boots from there. After the disconnection, if you reset your boards, are you able to advertise again?
谢谢,PM_DIalog
Hello PM_Dialog,
Sorry for the late reply.
第一个project:
This is solved, after the power down and power cycle, my device is advertising properly without any issue.
for the first project, the issue is with notification feature. due to multiple copies of the notification function, the device was not advertising after power down-power up cycle. Now the issue is resolved and also the device is working.
In the second project:
Yes, after the .hex file burns and resets detection, the device is advertising.
Now for both projects, I am facing the same issue, where reset detection flash memory field is 0xFF and after the second reset memory field is 0x00.
Thanks and Regards
Rohit
嗨Rajapurerohit,
Apologies for the delay, but I am not able to replicate your issue. Something might get wrong while writing data to flash.
Thanks, PM_Dialog