DA14585 sleepmode code get stuck after OTP

⚠️
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.wsdof.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
39 posts / 0 new
Last post
MarkDsylva_2277
Offline
Last seen:3 months 1 week ago
Joined:2019-06-19 04:20
DA14585 sleepmode code get stuck after OTP

Hello Dialog Team,

I am using a custom board for my project.

This project has a pressure sensor that sends manchester coded data every 30sec through gpio. My dialog chip decodes the data and loads it in the advertisement string. I have a battery attached for powering up my circuit. I am enabling sleep to save battery life.

I have done the following so far. Since we are developing our custom hardware, I did the following changes to the example (ble_app_sleepmode) program as follows.

1) Changed the led port and button pin as per our schematic in user_periph_setup.h

2) Changed #define CFG_LP_CLK LP_CLK_XTAL32 to #define CFG_LP_CLK LP_CLK_RCX20 in da1458x_config_advanced.h, since we dont have a 32Khz external crystal.

3) Changed #define CFG_XTAL16M_ADAPTIVE_SETTLING to #undef CFG_XTAL16M_ADAPTIVE_SETTLING because of point 2.

4) #undef CFG_CODE_LOCATION_EXT and #define CFG_CODE_LOCATION_OTP in da1458x_config_advanced.h

I have successfully debugged the project with my 585devkit and it ran without any problems. I am facing the following problems now. Since my debug session is running properly I have planned to do the OTP. After I did the OTP, the program doesnt run for a long time. It runs for a while and then halts I think. No idea why.

问候,

Mark

Device:
MarkDsylva_2277
Offline
Last seen:3 months 1 week ago
Joined:2019-06-19 04:20
I am attaching the project

我也在附加项目文件夹。

Attachment:
PM_Dialog
Offline
Last seen:9 hours 47 min ago
Staff
Joined:2018-02-08 11:03
Hi kuda,

Hi kuda,

Thanks for your question.

>>>>我现在正面临以下问题。由于我的调试会话正常运行,我计划执行OTP。

Do you mean that you have the debugger attached? If yes, this prevents the system to go into sleep mode. Are you completely sure that your application is running in our DK?

In case of your custom board, did you try to run you application in debug mode? For example, did you try to download fw to System-RAM?

Thanks, PM_Dialog

MarkDsylva_2277
Offline
Last seen:3 months 1 week ago
Joined:2019-06-19 04:20
Hi PM_Dialog,

Hi PM_Dialog,

Yes. I downloaded the code to sys-RAM and it worked perfectly without any problems.

After I downloaded the code to OTP, I disconnected the debugger. I removed the battery and inserted it back. It runs for a few minutes and then it gets stuck.

问候,

Mark

PM_Dialog
Offline
Last seen:9 hours 47 min ago
Staff
Joined:2018-02-08 11:03
Hi MarkDsylva_2277

Hi MarkDsylva_2277

Can you please export and share the OTP Header that you are using?

Thanks, PM_DIalog

MarkDsylva_2277
Offline
Last seen:3 months 1 week ago
Joined:2019-06-19 04:20
Hi PM_Dialog,

Hi PM_Dialog,

How to export OTP header?

问候,

Mark

PM_Dialog
Offline
Last seen:9 hours 47 min ago
Staff
Joined:2018-02-08 11:03
Hi MarkDsylva_2277

Hi MarkDsylva_2277

From the SmartSnippets Toolbox. You need to connect to the OTP Header and export it to file.

Thanks, PM_Dialog

MarkDsylva_2277
Offline
Last seen:3 months 1 week ago
Joined:2019-06-19 04:20
Hi PM_Dialog,

Hi PM_Dialog,

I am getting a lot of errors while reading.

I am attaching the log.

问候,

Mark

Attachment:
MarkDsylva_2277
Offline
Last seen:3 months 1 week ago
Joined:2019-06-19 04:20
Hi PM_dialog,

Hi PM_dialog,

I managed to get the header. Its attached here.

问候,

Mark

Attachment:
MarkDsylva_2277
Offline
Last seen:3 months 1 week ago
Joined:2019-06-19 04:20
Hi PM_Dialog,

Hi PM_Dialog,

Please update me on the status as I am waiting for your reply for further development in my project.

问候,

Mark

PM_Dialog
Offline
Last seen:9 hours 47 min ago
Staff
Joined:2018-02-08 11:03
嗨马克,

嗨马克,

Both application flags are set to “Yes” which is correct. What the package are you using? WLCSP34, QFN40 or QFN48 ? I the OTP header you have selected the QFN40. Additionally, the clock source is selected to the external Crystal oscillator, but in your initial post you are using the interval RCX. What changes have you done in the OTP Header? Have you burnt the “Device and Package” and ”Sleep Clock Source” or it is the default configuration?

>>>After I downloaded the code to OTP, I disconnected the debugger. I removed the battery and inserted it back. It runs for a few minutes and then it gets stuck.

由于它运行几分钟,这意味着设备从OTP正确启动。可能这个问题可能与SW相关。设备是否突然宣传和停止?您是否能够将其与对等设备连接?

Thanks, PM_Dialog

MarkDsylva_2277
Offline
Last seen:3 months 1 week ago
Joined:2019-06-19 04:20
Hi PM_Dialog,

Hi PM_Dialog,

---> What the package are you using? WLCSP34, QFN40 or QFN48 ? I the OTP header you have selected the QFN40.

Yes it is QFN40.

----> Additionally, the clock source is selected to the external Crystal oscillator, but in your initial post you are using the interval RCX. What changes have you done in the OTP Header? Have you burnt the “Device and Package” and ”Sleep Clock Source” or it is the default configuration?

我有一个外部水晶连接。但是对于低功耗水晶选择,我没有32kHz外部水晶连接到我的对话框芯片。所以我将其从#define cfg_lp_clk lp_clk_xtal32更改为#define cfg_lp_clk lp_clk_rcx20。我没有改变标题中的任何东西。我只将应用程序标志更改为是。

---->由于它运行了几分钟,这意味着设备从OTP正确启动。可能这个问题可能与SW相关。设备是否突然宣传和停止?您是否能够将其与对等设备连接?

The devices runs for a few minutes and when it wakes up from sleep its stops. The running time of the application varies a lot. Somtimes it stops in 2 mins or it may take 15mins also. Since my project is related to advertisement only, I didnt connect it with a peer device. If the issue is related to software, Why hasnt it occured during debugging?.

-------------------------------------------------------------------------------------------------------------------------

-> My biggest doubt is, if there is a bug in the application, why does it run for a certain amount of time and then stops.

-> I have a mobile app that logs the advertisement data with system time. As per my project, the advertisement interval is 150ms and it is done for 5 seconds after which advertisement stops. As per my log, the chip wakes up and stops in between those 5 seconds time before advertisement stops.

-> I also read from a online tutorial in your website, that the following line should be commented from rwip.c. if not using 32Khz external crstal

// Boost mode + RCX is not supported in DA14585/586
if (GetBits16(ANA_STATUS_REG, BOOST_SELECTED) == 1)

ASSERT_WARNING(0);

我没有尝试评论这一点,因为我们没有许多筹码,因为我们在Covid-19锁定时锁定。我的代码在调试中跑了超过一周的直线。在我做了OTP之后,我开始面对问题。请支持我,因为它非常紧迫。

------------------------------------------------------------------------------------

It would be better if you can guide me on certain aspects because I am using a custom board and I simply cant waste chips after finding out bugs after doing the OTP. I will be asked question from my mangement on how many chips will u waste for this?.

问候,

Mark

PM_Dialog
Offline
Last seen:9 hours 47 min ago
Staff
Joined:2018-02-08 11:03
嗨马克,

嗨马克,

You mentioned that you tested your project in development mode. Please keep in mind that when the debugger is attached, this prevents the system to go into sleep mode. Have you ever tested without the debugger attached?

Portably your issue is related with the waking up from sleep mode.

For example, if you download the same FW into the Sys-Ram (without the debugger attached) or into SPI Flash, is that running correctly?

关于OTP标题似乎是正确的。如果OTP标题和OTP图像未正确刻录,则设备将无法启动!在您的情况下,DA14585正在正确启动并开始广告。

Thanks, PM_Dialog

MarkDsylva_2277
Offline
Last seen:3 months 1 week ago
Joined:2019-06-19 04:20
Hi PM_Dialog,

Hi PM_Dialog,

——>你提到你测试项目development mode. Please keep in mind that when the debugger is attached, this prevents the system to go into sleep mode. Have you ever tested without the debugger attached?

I tried to start the debug session from keil and stopped the debug session by pressing the same debug button. The code didnt run.

As I had said in the above post, I think the code hangs somewhere in the middle of the advertisement process (ie Waking up and sleeping between advertisemnt intervals). My code is in the user_sleepmode.c file, where I am handling the external interrupt and data decoding. After I receive the data, I start the advertisement and set an app_easy_timer for 5 seconds....after which I stop the advertisement. In between I dont have anything. How am I to check where the code hangs?. Any ideas?

问候,

Mark

PM_Dialog
Offline
Last seen:9 hours 47 min ago
Staff
Joined:2018-02-08 11:03
嗨马克,

嗨马克,

So the problem is related to the SW. Let’s try to investigate what might be the root cause. If you run the application code in your custom board with the debugger attached, does it stop anywhere? If yes, can you please share a screenshot where it gets stuck? Is the watchdog enabled ore disabled?

Thanks, PM_Dialog

MarkDsylva_2277
Offline
Last seen:3 months 1 week ago
Joined:2019-06-19 04:20
Hi PM_Dialog,

Hi PM_Dialog,

--> No. The code doesnt stop anywhere. It runs without any problems.

--> I have disabled the watchdog.

问候,

Mark

PM_Dialog
Offline
Last seen:9 hours 47 min ago
Staff
Joined:2018-02-08 11:03
嗨马克,

嗨马克,

Can you please run it with the WDOG enabled? Now, if you run it in debug mode, does the code stuck anywhere? Please define the CFG_WDOG macro and run it again.

Thanks, PM_Dialog

PM_Dialog
Offline
Last seen:9 hours 47 min ago
Staff
Joined:2018-02-08 11:03
嗨马克,

嗨马克,

此外,您正在使用的SDK是什么?我无法在SDK中构建提供的示例代码。

Thanks, PM_Dialog

MarkDsylva_2277
Offline
Last seen:3 months 1 week ago
Joined:2019-06-19 04:20
Hi PM_Dialog,

Hi PM_Dialog,

The SDK I am using is 6.0.12

问候,

Mark

PM_Dialog
Offline
Last seen:9 hours 47 min ago
Staff
Joined:2018-02-08 11:03
嗨马克,

嗨马克,

My suggestion would be to have the WDOG enabled and run the code in debug mode. Additionally, please enable the CFG_DEVELOPMENT_DEBUG flag. This allows you to hot attach debugger and get debug information if a hardfault or NMI is occurred. So, with these 2 macros enabled, does is get stuck anywhere when ruining it in debug mode? Additionallym there is no need to bunt the OTP in order to debug it - just download the firmware into the System-RAM through the Keil IDE.

In the meanwhile, I will try to run the attached project in our development boards.

Thanks, PM_Dialog

MarkDsylva_2277
Offline
Last seen:3 months 1 week ago
Joined:2019-06-19 04:20
Hi PM_Dialog,

Hi PM_Dialog,

我说你所说的。

I #defined both the macros and uploaded the code by pressing the debug button and then pressed the same button again. The code got stuck again.

问候,

Mark

PM_Dialog
Offline
Last seen:9 hours 47 min ago
Staff
Joined:2018-02-08 11:03
嗨马克,

嗨马克,

Where it gets stuck? Can you please share a screenshoot?

Thanks, PM_Dialog

MarkDsylva_2277
Offline
Last seen:3 months 1 week ago
Joined:2019-06-19 04:20
Hi PM_Dialog,

Hi PM_Dialog,

I have disconnected the debugger. So I am not able to see where its getting stuck.

But when I run with the debugger attached, the code runs properly.

----------------------------------------------------------------------

I am having a deadline to complete the project by tomorrow, and since the code is getting stuck between advertisement intervals, I am thinking of removing the otp copy sleep between advertisement intervals by passsing false to arch_set_extended_sleep(false) and changing the static const sleep_state_t app_default_sleep_mode = ARCH_EXT_SLEEP_ON...

Will this solve my issue for time being?.

问候,

Mark

PM_Dialog
Offline
Last seen:9 hours 47 min ago
Staff
Joined:2018-02-08 11:03
嗨马克,

嗨马克,

I have run your attached project with the CFG_WDOG and the CFG_DEVELOPMENT_DEBUG macros defined. I am working on an QFN40 daughter board and our new Pro-DK motherboard. In order to use the on-board button to wake-up the device, I am using the P1_1 for the LED.

在调试模式下运行代码时,它会在以下行中的GPIO.C文件中陷入GPIO_SETPINFUNCTION()。

__asm("BKPT #0\n"); // this pin has not been previously reserved!

In user_periph_setup.c you are configuring all the GPIOs to input pull down. This is not need as the default state is INPUT_PULLDOWN. You can easily read the GPIOs registers to clarify it. Additionally this peace of code reconfigures all the GPIOs which is not recommend.

Also, in the user_sleepmode.c files you are using a GPIO which is never reserved!

Please find attached a diff file with the modifications I did in your code. With that modifications I am able to run your project in our DKs.

The OTP stand for One Time Programmable, so you should make sure that your project is totally running before burning it!

In development stage, it is recommended to have the WDOG and the development debug enabled, Otherwise, if the code gets stuck somewhere you will be never notified for this! In conclusion, burning the OTP image and OTP header requires that the application code is running 100%. Otherwise, the chip will never boot form OTP!

What is the package of DA14585 that you are using?

Thanks, PM_Dialog

Attachment:
MarkDsylva_2277
Offline
Last seen:3 months 1 week ago
Joined:2019-06-19 04:20
Hi PM_Dialog,

Hi PM_Dialog,

好的。我会按你说的话。

I am using a QFN40 package.

Will GPIO reservation problems cause the code to hang after doing OTP?.

问候,

Mark

PM_Dialog
Offline
Last seen:9 hours 47 min ago
Staff
Joined:2018-02-08 11:03
Since you are running the

Since you are running the project in debug mode, you should have the CFG_DEVELOPMENT_DEBUG defined. This allows you to simulate the OPT mirroring from the OTP to System-RAM.

PM_Dialog
Offline
Last seen:9 hours 47 min ago
Staff
Joined:2018-02-08 11:03
I would suggest to run the

I would suggest to run the project in out DK. Is it running correctly?

If yes, then use your custom board and download the FW into System-RAM. Please make sure that OTP is empty. Is that working 100%?

MarkDsylva_2277
Offline
Last seen:3 months 1 week ago
Joined:2019-06-19 04:20
Hi PM_Dialog,

Hi PM_Dialog,

I took a fresh copy of sleepmode example from your skd and tried to download it to the ram in the 585 daughter board. I didnt modify anything in any of the code. When I pressed the debug button and started the code it immediately got stopped at the nmi_handler. Will your example code work as such without modification in the 585 daughter board?.

问候,

Mark

PM_Dialog
Offline
Last seen:9 hours 47 min ago
Staff
Joined:2018-02-08 11:03
嗨,马克,请downoload

嗨,马克,请downoloadfw into RAM first - is that working now?

PM_Dialog
Offline
Last seen:9 hours 47 min ago
Staff
Joined:2018-02-08 11:03
嗨马克,can you please

嗨马克,can you please indicate which DK are you using? Which daughter board and which mother board? yes, the example is working correctly..

MarkDsylva_2277
Offline
Last seen:3 months 1 week ago
Joined:2019-06-19 04:20
Hi,

Hi,

Kit is DA14580DevKT-P_VC

子板是DA14585。

Regards

PM_Dialog
Offline
Last seen:9 hours 47 min ago
Staff
Joined:2018-02-08 11:03
嗨马克,Yes the ble_app

嗨马克,Yes the ble_app_sleepmode is runnign correctly in this board. I can run it in my side. Would it be possible to share a phote with the jumpers configuration?

MarkDsylva_2277
Offline
Last seen:3 months 1 week ago
Joined:2019-06-19 04:20
Hi,

Hi,

照片附加了。

问候,

Mark

Attachment:
PM_Dialog
Offline
Last seen:9 hours 47 min ago
Staff
Joined:2018-02-08 11:03
嗨马克,Just tested the ble

嗨,马克,只是测试了ble_app_sleepmode例子on our DK - I am using the same DK with you and the same jumper configuration. Do you have any spare DK to test it? I'd suggest to worki on a clean SDK directory as well. Additionally, with the modification i had shared you yesterday, I am able to run your project in our DK... Are you building the project for DA14585? Thanks, PM_Dialog

MarkDsylva_2277
Offline
Last seen:3 months 1 week ago
Joined:2019-06-19 04:20
Hi PM_Dialog,

Hi PM_Dialog,

--->Do you have any spare DK to test it?

No. I dont have one.

- >我也建议在干净的SDK目录上工作。

I extracted the sdk folder from the 6.0.12.1020.2.zip file and opened the ble_app_sleepmode project and built it and started the debug session. I didnt modify anything else inside. But I am facing the same issue. I have attached the screenshot.

问候,

Mark

PM_Dialog
Offline
Last seen:9 hours 47 min ago
Staff
Joined:2018-02-08 11:03
嗨马克,are you able to run

嗨马克,are you able to run any of the other SDK project? For example, the ble_app_barebone. All the SDK examples are running in our DKs out-of-the-box and as provided by the SDK. In this specific device, have you burnt the OTP?

MarkDsylva_2277
Offline
Last seen:3 months 1 week ago
Joined:2019-06-19 04:20

Hi,

I am not able to run any ble examples. I tried the blinky project. It worked fine.

问候,

Mark

PM_Dialog
Offline
Last seen:9 hours 47 min ago
Staff
Joined:2018-02-08 11:03
嗨马克,

嗨马克,

Please find attached my jumper configuration. All the BLE examples are running as expected. In case of ble_app_sleepmode, I am able to run it with the attached configuration. So please, try to unzip the SDK into a new folder and give again a try. I would suggest to have a short SDK path – probably unzip in under the C:\ . If it Is not running again, probably the board is damaged. Have you written the OTP in that device?

Thanks, PM_Dialog

Attachment:
MarkDsylva_2277
Offline
Last seen:3 months 1 week ago
Joined:2019-06-19 04:20

Hi PM_Dialog,

I tried as you said.

1) I took out a fresh copy of the SDK and created a folder in D drive. I ran the sleepmode example without modifiying anything. As soon as I started the debug session it got stuck at the nmi handler.

2) I connected the smart snippets tool and checked reading the OTP memory. It read only zeros.

问候,

Mark