Hi sir,
i am working on DA14531, after flashing the code into DA14531 then i started checking for power profile using smart snippets toolbar v5.0.24
it detects the device and J-tag, but it won't show the power profile.
what can be the issue behind this problem?
how can solve this issue??
Hi Stanly,
Thanks for your inquiry. You will have to connect via UART to enable PowerProfiler functionalities. .
BR,
PM_Renesas
you can see that i have connect in the UART port
now I am just trying to work on the examples in the GitHub
BLE_SDK6_examples/Readme.md at main · dialog-semiconductor/BLE_SDK6_examples · GitHub
but in central and central security example pops this error
Rebuild started: Project: central *** Using Compiler 'V6.21', folder: 'C:\Keil_v5\ARM\ARMCLANG\Bin' Rebuild target 'DA14531' assembling startup_DA14531.s... compiling arch_console.c... compiling system_DA14531.c... compiling nmi_handler.c... compiling nvds.c... compiling hardfault_handler.c... compiling arch_main.c... compiling arch_sleep.c... compiling chacha20.c... compiling jump_table.c... compiling hash.c... compiling arch_rom.c... compiling arch_system.c... compiling otp_cs.c... compiling otp_hdr.c... compiling syscntl.c... compiling wkupct_quadec.c... compiling gpio.c... compiling battery.c... compiling adc_531.c... compiling trng.c... compiling spi_flash.c... compiling spi_531.c... compiling systick.c... compiling i2c_eeprom.c... compiling uart.c... compiling dma.c... compiling hw_otpc_531.c... compiling rf_585.c... compiling i2c.c... compiling attm_db_128.c... compiling rf_531.c... compiling rwip.c... compiling ble_arp.c... compiling rwble.c... compiling prf.c... compiling prf_utils.c... compiling app_security.c... compiling app_task.c... compiling app.c... compiling app_default_handlers.c... compiling app_security_task.c... compiling app_entry_point.c... compiling app_msg_utils.c... compiling app_easy_msg_utils.c... compiling app_easy_timer.c... compiling app_utils.c... compiling app_easy_security.c... compiling app_bond_db.c... compiling user_custs1_def.c... compiling user_custs_config.c... compiling user_ble_gatt.c... compiling user_ble_gap.c... compiling user_periph_setup.c... compiling user_central_app.c... linking... .\out_DA14531\Objects\central_531.axf: Error: L6218E: Undefined symbol my_custom_msg_handlers (referred from arch_rom.o). .\out_DA14531\Objects\central_531.axf: Error: L6218E: Undefined symbol patch_func (referred from user_periph_setup.o). .\out_DA14531\Objects\central_531.axf: Error: L6218E: Undefined symbol lld_force_timeout_refresh (referred from patch_1.o). Not enough information to produce a SYMDEFs file. Not enough information to list image symbols. Not enough information to list load addresses in the image map. Finished: 3 information, 0 warning and 3 error messages. ".\out_DA14531\Objects\central_531.axf" - 3 Error(s), 0 Warning(s). Target not created. Build Time Elapsed: 00:00:04
how can I resolve this error
Hi Stanly,Thank you for the reply.Which is the SDK version you are trying to use?If you are using SDK v6.0.20 or v6.0.22, please make sure you do the following to integrate Git Repo examples:1) Make sure you add the system_library_531.c on the sdk_arch folder:2) You can do that by right-clicking on the sdk_arch folder:
3)Navigate on the SDK files on the following path ...\6.0.20.1338\sdk\platform\system_library\src\DA14531PS: For different kind of issues, please create new threads. This way when a new user searches for an answer on the communities, they will find it easier.Best Regards,OV_Renesas
Rebuild started: Project: ble_central_with_security *** Using Compiler 'V6.21', folder: 'C:\Keil_v5\ARM\ARMCLANG\Bin' Rebuild target 'DA14531' compiling system_DA14531.c... assembling startup_DA14531.s... compiling hardfault_handler.c... compiling nmi_handler.c... compiling arch_console.c... compiling nvds.c... compiling arch_main.c... compiling jump_table.c... compiling arch_sleep.c... compiling arch_system.c... compiling arch_rom.c... compiling chacha20.c... compiling hash.c... compiling otp_hdr.c... compiling otp_cs.c... compiling system_library_531.c... compiling syscntl.c... compiling gpio.c... compiling wkupct_quadec.c... compiling battery.c... compiling trng.c... compiling spi_flash.c... compiling i2c_eeprom.c... compiling systick.c... compiling adc_531.c... compiling spi_531.c... compiling uart.c... compiling hw_otpc_531.c... compiling i2c.c... compiling rf_585.c... compiling rwble.c... compiling rwip.c... compiling ble_arp.c... compiling rf_531.c... compiling attm_db_128.c... compiling custom_common.c... compiling custs1.c... compiling custs1_task.c... compiling custs2.c... compiling custs2_task.c... compiling prf.c... compiling prf_utils.c... compiling diss.c... compiling diss_task.c... compiling app_default_handlers.c... compiling app.c... compiling app_task.c... compiling app_security.c... compiling app_security_task.c... compiling app_diss.c... compiling app_diss_task.c... compiling app_entry_point.c... compiling app_msg_utils.c... compiling app_easy_msg_utils.c... compiling app_easy_security.c... compiling app_easy_timer.c... compiling app_customs.c... compiling app_customs_task.c... compiling app_customs_common.c... compiling app_bond_db.c... compiling app_utils.c... compiling user_custs_config.c... compiling user_custs1_def.c... compiling user_periph_setup.c... compiling user_central_scanner.c... compiling user_security.c... linking... .\out_531\ble_central_with_security_531.axf: Error: L6221E: Execution region ER_ZI with Execution range [0x07fc74e0,0x07fc85e0) overlaps with Execution region RET_DATA with Execution range [0x07fc83c0,0x07fc88c4). .\out_531\ble_central_with_security_531.axf: Error: L6221E: Execution region ER_NZI with Execution range [0x07fc85e0,0x07fc89ec) overlaps with Execution region RET_DATA with Execution range [0x07fc83c0,0x07fc88c4). .\out_531\ble_central_with_security_531.axf: Error: L6221E: Execution region ER_NZI with Execution range [0x07fc85e0,0x07fc89ec) overlaps with Execution region RET_HEAP_DB with Execution range [0x07fc88c4,0x07fc8cd0). Not enough information to produce a SYMDEFs file. Finished: 1 information, 0 warning and 3 error messages. ".\out_531\ble_central_with_security_531.axf" - 3 Error(s), 0 Warning(s). Target not created. Build Time Elapsed: 00:00:19
this error pops in central security example coding
Hi Stanly,Thank you for the reply.On your Options for Target settings please check C/C++ tab and make sure that Link-Time Optimization is enabled:Best Regards,OV_Renesas
thanks, a lot all the errors are cleared
but new error pops while debug
Rebuild started: Project: ble_central_with_security *** Using Compiler 'V6.21', folder: 'C:\Keil_v5\ARM\ARMCLANG\Bin' Rebuild target 'DA14531' assembling startup_DA14531.s... compiling system_DA14531.c... compiling nvds.c... compiling nmi_handler.c... compiling arch_console.c... compiling hardfault_handler.c... compiling arch_main.c... compiling jump_table.c... compiling arch_sleep.c... compiling chacha20.c... compiling hash.c... compiling arch_rom.c... compiling otp_hdr.c... compiling arch_system.c... compiling otp_cs.c... compiling syscntl.c... compiling wkupct_quadec.c... compiling system_library_531.c... compiling gpio.c... compiling battery.c... compiling trng.c... compiling spi_flash.c... compiling i2c_eeprom.c... compiling systick.c... compiling adc_531.c... compiling spi_531.c... compiling uart.c... compiling hw_otpc_531.c... compiling i2c.c... compiling rf_585.c... compiling attm_db_128.c... compiling rf_531.c... compiling rwip.c... compiling custom_common.c... compiling custs1.c... compiling ble_arp.c... compiling rwble.c... compiling custs1_task.c... compiling custs2.c... compiling prf.c... compiling custs2_task.c... compiling prf_utils.c... compiling diss.c... compiling diss_task.c... compiling app_default_handlers.c... compiling app.c... compiling app_security.c... compiling app_task.c... compiling app_diss_task.c... compiling app_diss.c... compiling app_security_task.c... compiling app_entry_point.c... compiling app_easy_msg_utils.c... compiling app_msg_utils.c... compiling app_customs_task.c... compiling app_easy_timer.c... compiling app_customs.c... compiling app_easy_security.c... compiling app_customs_common.c... compiling app_utils.c... compiling app_bond_db.c... compiling user_custs_config.c... compiling user_custs1_def.c... compiling user_periph_setup.c... compiling user_central_scanner.c... compiling user_security.c... linking... Program Size: Code=20828 RO-data=1868 RW-data=12 ZI-data=9888 FromELF: creating hex file... ".\out_531\ble_central_with_security_531.axf" - 0 Error(s), 0 Warning(s). Build Time Elapsed: 00:00:04 Load "D:\\BLE_SDK6_examples-main\\connectivity\\central_Security_Demo\\project_environment\\out_531\\ble_central_with_security_531.axf" Set JLink Project File to "D:\BLE_SDK6_examples-main\connectivity\central_Security_Demo\project_environment\JLinkSettings.ini" * JLink Info: Device "CORTEX-M0" selected. JLink info: ------------ DLL: V7.92k, compiled Oct 18 2023 14:58:31 Firmware: J-Link OB-SAM3U128 V3 compiled Apr 11 2024 17:43:56 Hardware: V3.00 S/N : 483052500 * JLink Info: Found SW-DP with ID 0x0BC11477 * JLink Info: DPIDR: 0x0BC11477 * JLink Info: CoreSight SoC-400 or earlier * JLink Info: Scanning AP map to find all available APs * JLink Info: AP[1]: Stopped AP scan as end of AP map has been reached * JLink Info: AP[0]: AHB-AP (IDR: 0x04770031) * JLink Info: Iterating through AP map to find AHB-AP to use * JLink Info: AP[0]: Core found * JLink Info: AP[0]: AHB-AP ROM base: 0xE00FF000 * JLink Info: CPUID register: 0x410CC601. Implementer code: 0x41 (ARM) * JLink Info: Found Cortex-M0 r0p1, Little endian. * JLink Info: FPUnit: 4 code (BP) slots and 0 literal slots * JLink Info: CoreSight components: * JLink Info: ROMTbl[0] @ E00FF000 * JLink Info: [0][0]: E000E000 CID B105E00D PID 000BB008 SCS * JLink Info: [0][1]: E0001000 CID B105E00D PID 000BB00A DWT * JLink Info: [0][2]: E0002000 CID B105E00D PID 000BB00B FPB ROMTableAddr = 0xE00FF000 * JLink Info: Reset: Halt core after reset via DEMCR.VC_CORERESET. * JLink Info: Reset: Reset device via AIRCR.SYSRESETREQ. Target info: ------------ Device: ARMCM0P VTarget = 3.300V State of Pins: TCK: 0, TDI: 1, TDO: 1, TMS: 0, TRES: 1, TRST: 1 Hardware-Breakpoints: 4 Software-Breakpoints: 8192 Watchpoints: 2 JTAG speed: 2667 kHz No Algorithm found for: 07FC0000H - 07FC00A7H No Algorithm found for: 07FC0110H - 07FC591BH Erase skipped! Error: Flash Download failed - "Cortex-M0+" Flash Load finished at 15:56:27
Hi Stanly,Thank you for the reply.Go again on Options for Target, on Utilities tab and select the Use External Tool for Flash Programming option:The J-Link debugger should be able to connect now.Best Regards,OV_Renesas
Set JLink Project File to "D:\BLE_SDK6_examples-main\connectivity\central_Security_Demo\project_environment\JLinkSettings.ini"* JLink Info: Device "CORTEX-M0" selected. JLink info: ------------ DLL: V7.92k, compiled Oct 18 2023 14:58:31 Firmware: J-Link OB-SAM3U128 V3 compiled Apr 11 2024 17:43:56 Hardware: V3.00 S/N : 483052500 * JLink Info: Found SW-DP with ID 0x0BC11477 * JLink Info: DPIDR: 0x0BC11477 * JLink Info: CoreSight SoC-400 or earlier * JLink Info: Scanning AP map to find all available APs * JLink Info: AP[1]: Stopped AP scan as end of AP map has been reached * JLink Info: AP[0]: AHB-AP (IDR: 0x04770031) * JLink Info: Iterating through AP map to find AHB-AP to use * JLink Info: AP[0]: Core found * JLink Info: AP[0]: AHB-AP ROM base: 0xE00FF000 * JLink Info: CPUID register: 0x410CC601. Implementer code: 0x41 (ARM) * JLink Info: Found Cortex-M0 r0p1, Little endian. * JLink Info: FPUnit: 4 code (BP) slots and 0 literal slots * JLink Info: CoreSight components: * JLink Info: ROMTbl[0] @ E00FF000 * JLink Info: [0][0]: E000E000 CID B105E00D PID 000BB008 SCS * JLink Info: [0][1]: E0001000 CID B105E00D PID 000BB00A DWT * JLink Info: [0][2]: E0002000 CID B105E00D PID 000BB00B FPB ROMTableAddr = 0xE00FF000 * JLink Info: Reset: Halt core after reset via DEMCR.VC_CORERESET. * JLink Info: Reset: Reset device via AIRCR.SYSRESETREQ. Target info: ------------ Device: ARMCM0P VTarget = 3.300V State of Pins: TCK: 0, TDI: 1, TDO: 1, TMS: 0, TRES: 1, TRST: 1 Hardware-Breakpoints: 4 Software-Breakpoints: 8192 Watchpoints: 2 JTAG speed: 2667 kHz Include "D:\\BLE_SDK6_examples-main\\connectivity\\central_Security_Demo\\project_environment\\..\\..\\..\\..\\..\\sdk\\common_project_files\\misc\\jlink_DA14531.ini" ________^ *** error 56: cannot open file
this error pops while debugging
the setting i have is
these are my settings
Hi Stanly,Thank you for the reply.From the screenshots you have shared, is that you are trying to debug the project directly from the BLE-SDK examples folder of the GitRepo.You should copy/paste the example you are interested in inside your SDK with the rest of the SDK examples included.Then use the python script included to fix the paths to your SDK. The rest of the settings seems OK to me. Keil is trying to locate the jlink_DA14531.ini which is part of the SDK folders and not from the GitRepo folder. This is why you cannot debug.Best Regards,OV_Renesas
non connectable advertisement
externed sleep mode
code size
battery - 35 MAH - 3v (CR1220)
i will press the button at least 20 times a day
NO SPI, I2C
can i get the battery life estimation with this
Hi Stanly,Thank you for the reply.I tried to apply your configuration on the Battery Lifetime Estimator:You can test this on your side with SmartSnippets Toolbox as well. For the Battery Lifetime Estimator you will not need to use any of the Dev Kits.I only put 5% of Lifetime spent in Advertising since you are going to advertise for a few seconds 20 times a day.Best Regards,OV_Renesas
can i get the power profile
ble_app_sleepmode_531.hex
#if defined (__DA14531__) #define GPIO_BUTTON_PORT GPIO_PORT_0 #define GPIO_BUTTON_PIN GPIO_PIN_7 #define GPIO_BUTTON_PIN1 GPIO_PIN_8#else
these are the gpio port that wake up the DA14531 and send the non-connectable advertisement
i have attached the HEX file above
Hi Stanly,Thank you for the reply.Please refer on the mp4 video below:I used Development Kit Pro with the DA14531MOD Daughterboard and I used P0_7 to wake-up the device.The final current consumption will depend on how many times the DA14531 will wake-up to advertise.Best Regards,OV_Renesas
can i get power profile for this firmware because I don't have pro kit
it will send non connectable advertisement always and when the gpio button is long pressed for 2-3 seconds it will send another message with high transmission power
#if defined (__DA14531__)#define GPIO_BUTTON_PORT GPIO_PORT_0#define GPIO_BUTTON_PIN GPIO_PIN_7#define GPIO_BUTTON_PIN1 GPIO_PIN_8#else
i have attached the hex file above
Hey it's a urgent help me out
Hey,
Please refer to the screenshot:
my DA14531 goes into sleepmode but not waking up using gpio can you help me to solve this problem
/** **************************************************************************************** * * @file user_sleepmode.c * * @brief Sleep mode project source code. * * Copyright (C) 2016-2019 Dialog Semiconductor. * This computer program includes Confidential, Proprietary Information * of Dialog Semiconductor. All Rights Reserved. * **************************************************************************************** */ /** **************************************************************************************** * @addtogroup APP * @{ **************************************************************************************** */ /* * INCLUDE FILES **************************************************************************************** */ #include "rwip_config.h" #include "app_api.h" #include "user_sleepmode.h" #include "user_periph_setup.h" #include "user_callback_config.h" #include "user_custs1_def.h" #include "app_default_handlers.h" #include "custs1_task.h" #include "da1458x_config_advanced.h" #include "user_sleepmode_task.h" #include "wkupct_quadec.h" #include "gpio.h" #include "arch_console.h" #include "adc.h" #include "adc_531.h" #include "rf_531.h" #include "spi_flash.h" //#include "arch_system.h" #include "sw_aes.h" #include "aes.h" //#include "time.h" /* * TYPE DEFINITIONS **************************************************************************************** */ /* * GLOBAL VARIABLE DEFINITIONS **************************************************************************************** */ uint8_t app_connection_idx __SECTION_ZERO("retention_mem_area0"); // @RETENTION MEMORY timer_hnd app_adv_data_update_timer_used __SECTION_ZERO("retention_mem_area0"); // @RETENTION MEMORY timer_hnd app_param_update_request_timer_used __SECTION_ZERO("retention_mem_area0"); // @RETENTION MEMORY timer_hnd counter_timer __SECTION_ZERO("retention_mem_area0"); // @RETENTION MEMORY // Retained variables // Index of manufacturer data in advertising data or scan response data (when MSB is 1) uint8_t stored_adv_data_len __SECTION_ZERO("retention_mem_area0"); //@RETENTION MEMORY uint8_t stored_scan_rsp_data_len __SECTION_ZERO("retention_mem_area0"); //@RETENTION MEMORY uint8_t stored_adv_data[ADV_DATA_LEN] __SECTION_ZERO("retention_mem_area0"); //@RETENTION MEMORY uint8_t stored_scan_rsp_data[SCAN_RSP_DATA_LEN] __SECTION_ZERO("retention_mem_area0"); //@RETENTION MEMORY uint8_t state_sleep __SECTION_ZERO("retention_mem_area0"); uint8_t adv_data1[6]={0x05, 0xFF, 0x9E, 0xFE, 0x00,0x00}; int d = 0; int k = 0; int count = 0; uint8_t dup; uint16_t per,volt; /* * FUNCTION DEFINITIONS **************************************************************************************** */ /** **************************************************************************************** * @brief Advertisement data update timer callback function. **************************************************************************************** */ static void adv_data_update_timer_cb() { //arch_printf("\n\rTimer"); // Stop advertising air operation - a button press will wake-up the system app_easy_gap_advertise_stop(); } /** **************************************************************************************** * @brief Parameter update request timer callback function. **************************************************************************************** */ static void param_update_request_timer_cb() { app_easy_gap_param_update_start(app_connection_idx); app_param_update_request_timer_used = EASY_TIMER_INVALID_TIMER; } static uint8_t batt_per(uint16_t batt_volt) { if (batt_volt < 2000) { return 0; } if (batt_volt > 3000) { return 100; } else { return (((batt_volt - 2000) * 100) / (3000 - 2000)); } } static uint16_t get_bat(void){ adc_config_t adc_cfg = { .input_mode = ADC_INPUT_MODE_SINGLE_ENDED, .input = ADC_INPUT_SE_VBAT_HIGH, .smpl_time_mult = 2, .continuous = false, .interval_mult = 0, .input_attenuator = ADC_INPUT_ATTN_4X, .chopping = false, .oversampling = 0, }; adc_init(&adc_cfg); /* Perform offset calibration of the ADC */ adc_offset_calibrate(ADC_INPUT_MODE_SINGLE_ENDED); adc_start(); uint16_t result = adc_correct_sample(adc_get_sample()); adc_disable(); uint32_t adc_res = 10 + ((6 < adc_get_oversampling()) ? 6 : adc_get_oversampling()); /* Reference voltage is 900mv but scale based in input attenation */ uint32_t ref_mv = 900 * (GetBits16(GP_ADC_CTRL2_REG, GP_ADC_ATTN) + 1); return (uint16_t)((((uint32_t)result) * ref_mv) >> adc_res); } void user_app_init(void) { //arch_printf("\n\ruser init"); spi_flash_power_down(); app_param_update_request_timer_used = EASY_TIMER_INVALID_TIMER; rf_pa_pwr_set(RF_TX_PWR_LVL_0d0); default_app_on_init(); } void user_app_adv_start(void) { //arch_printf("\n\rADV start"); GPIO_SetActive(GPIO_LED_PORT, GPIO_LED_PIN); per = batt_per(get_bat()); // Schedule the next advertising data update app_adv_data_update_timer_used = app_easy_timer(APP_ADV_DATA_UPDATE_TO, adv_data_update_timer_cb); struct gapm_start_advertise_cmd *cmd = app_easy_gap_non_connectable_advertise_get_active(); if(count==1) { adv_data1[5]=per; adv_data1[4]=1; cmd->info.host.adv_data_len=6; memcpy(cmd->info.host.adv_data, adv_data1,6); } if(count==3) { adv_data1[5]=per; adv_data1[4]=2; cmd->info.host.adv_data_len=6; memcpy(cmd->info.host.adv_data, adv_data1,6); } if(count==5) { adv_data1[5]=per; adv_data1[4]=3; cmd->info.host.adv_data_len=6; memcpy(cmd->info.host.adv_data, adv_data1,6); } if(count==7) { adv_data1[5]=per; adv_data1[4]=4; cmd->info.host.adv_data_len=6; memcpy(cmd->info.host.adv_data, adv_data1,6); } count=0; arch_set_extended_sleep(true); app_easy_gap_non_connectable_advertise_start(); } void user_app_connection(uint8_t connection_idx, struct gapc_connection_req_ind const *param) { default_app_on_connection(connection_idx, param); if (app_env[connection_idx].conidx != GAP_INVALID_CONIDX) { app_connection_idx = connection_idx; // Stop the advertising data update timer app_easy_timer_cancel(app_adv_data_update_timer_used); // Check if the parameters of the established connection are the preferred ones. // If not then schedule a connection parameter update request. if ((param->con_interval < user_connection_param_conf.intv_min) || (param->con_interval > user_connection_param_conf.intv_max) || (param->con_latency != user_connection_param_conf.latency) || (param->sup_to != user_connection_param_conf.time_out)) { // Connection params are not these that we expect app_param_update_request_timer_used = app_easy_timer(APP_PARAM_UPDATE_REQUEST_TO, param_update_request_timer_cb); } user_app_enable_periphs(); // Set extended sleep without OTP copy during connection arch_set_extended_sleep(false); } } static void app_button_enable(void); /** **************************************************************************************** * @brief Button press callback function. Registered in WKUPCT driver. **************************************************************************************** */ void wakeup_func() { } static void app_button_press_cb(void) { #if !defined (__DA14531__) if (GetBits16(SYS_STAT_REG, PER_IS_DOWN)) #endif { periph_init(); } long long int i=0; if(!GPIO_GetPinStatus(GPIO_BUTTON_PORT, GPIO_BUTTON_PIN)) { for(i=0;!GPIO_GetPinStatus(GPIO_BUTTON_PORT, GPIO_BUTTON_PIN);i++) { if(i>150000) break; } if(i>150000){ count = 7; } else{ count =1; } } if(!GPIO_GetPinStatus(GPIO_BUTTON_PORT, GPIO_BUTTON_PIN1)) { for(i=0;!GPIO_GetPinStatus(GPIO_BUTTON_PORT, GPIO_BUTTON_PIN1);i++) { if(i>150000) break; } if(i>150000){ count = 5; } else{ count =3; } } if (arch_ble_ext_wakeup_get()) { arch_set_sleep_mode(app_default_sleep_mode); arch_ble_force_wakeup(); arch_ble_ext_wakeup_off(); app_easy_wakeup(); } } /** **************************************************************************************** * @brief Application wakeup callback function. Registered in API message utility. **************************************************************************************** */ static void app_wakeup_cb(void) { //arch_printf("\n\rWake up"); if (ke_state_get(TASK_APP) == APP_CONNECTABLE) { //arch_printf("\n\rcount in wakeup : %d",count); user_app_adv_start(); } } /** **************************************************************************************** * @brief Sets button as wakeup trigger **************************************************************************************** */ static void app_button_enable(void) { //arch_printf("\n\rButton enable"); GPIO_SetActive(GPIO_BUTTON_PORT, TEST_POINT_SET); app_easy_wakeup_set(app_wakeup_cb); put_system_into_deep_sleep(); wkupct_register_callback(app_button_press_cb); wkupct_enable_irq(WKUPCT_PIN_SELECT(GPIO_BUTTON_PORT, GPIO_BUTTON_PIN)^ WKUPCT_PIN_SELECT(GPIO_BUTTON_PORT, GPIO_BUTTON_PIN1), WKUPCT_PIN_POLARITY(GPIO_BUTTON_PORT, GPIO_BUTTON_PIN, WKUPCT_PIN_POLARITY_LOW) ^ WKUPCT_PIN_POLARITY(GPIO_BUTTON_PORT, GPIO_BUTTON_PIN1, WKUPCT_PIN_POLARITY_LOW), // polarity low 1, // 1 event 0); // debouncing time = 0 } static void put_system_into_deep_sleep(void) { #if defined (CFG_DEEP_SLEEP_WAKEUP_GPIO) wkupct_enable_irq(WKUPCT_PIN_SELECT(GPIO_BUTTON_PORT, GPIO_BUTTON_PIN)^ WKUPCT_PIN_SELECT(GPIO_BUTTON_PORT, GPIO_BUTTON_PIN1), WKUPCT_PIN_POLARITY(GPIO_BUTTON_PORT, GPIO_BUTTON_PIN, WKUPCT_PIN_POLARITY_LOW) ^ WKUPCT_PIN_POLARITY(GPIO_BUTTON_PORT, GPIO_BUTTON_PIN1, WKUPCT_PIN_POLARITY_LOW), // polarity low 1, // 1 event 0); // debouncing time = 0 #endif // Go to deep sleep arch_set_deep_sleep(CFG_DEEP_SLEEP_RAM1, CFG_DEEP_SLEEP_RAM2, CFG_DEEP_SLEEP_RAM3, CFG_DEEP_SLEEP_PAD_LATCH_EN); } void user_app_adv_undirect_complete(uint8_t status) { //arch_printf("\n\rADV complete"); GPIO_SetInactive(GPIO_LED_PORT, GPIO_LED_PIN); // Disable wakeup for BLE and timer events. Only external (GPIO) wakeup events can wakeup processor. if (status == GAP_ERR_CANCELED) { arch_ble_ext_wakeup_on(); count=0; app_button_enable(); } } void user_app_disconnect(struct gapc_disconnect_ind const *param) { // Cancel the parameter update request timer if (app_param_update_request_timer_used != EASY_TIMER_INVALID_TIMER) { app_easy_timer_cancel(app_param_update_request_timer_used); app_param_update_request_timer_used = EASY_TIMER_INVALID_TIMER; } user_app_disable_periphs(); // Restart Advertising user_app_adv_start(); } void user_catch_rest_hndl(ke_msg_id_t const msgid,void const *param,ke_task_id_t const dest_id,ke_task_id_t const src_id) { switch(msgid) { case CUSTS1_VAL_WRITE_IND: { struct custs1_val_write_ind const *msg_param = (struct custs1_val_write_ind const *)(param); switch( msg_param->handle) { case SVC1_IDX_CONTROL_POINT_VAL: user_svc1_ctrl_wr_ind_handler(msgid, msg_param, dest_id, src_id); break; // Below handlers not used in sleep demo app case SVC1_IDX_LED_STATE_VAL: case SVC1_IDX_ADC_VAL_1_NTF_CFG: case SVC1_IDX_BUTTON_STATE_NTF_CFG: case SVC1_IDX_INDICATEABLE_IND_CFG: case SVC1_IDX_LONG_VALUE_NTF_CFG: case SVC1_IDX_LONG_VALUE_VAL: default: break; } } break; case CUSTS1_VAL_NTF_CFM: { } break; case CUSTS1_VAL_IND_CFM: { } break; case CUSTS1_ERROR_IND: { } break; case GAPC_PARAM_UPDATED_IND: { // Cast the "param" pointer to the appropriate message structure struct gapc_param_updated_ind const *msg_param = (struct gapc_param_updated_ind const *)(param); // Check if updated Conn Params filled to preferred ones if ((msg_param->con_interval >= user_connection_param_conf.intv_min) && (msg_param->con_interval <= user_connection_param_conf.intv_max) && (msg_param->con_latency == user_connection_param_conf.latency) && (msg_param->sup_to == user_connection_param_conf.time_out)) { } } break; default: break; } }
my header file code is
/** **************************************************************************************** * * @file user_sleepmode.h * * @brief Sleep mode project header file. * * Copyright (C) 2016-2019 Dialog Semiconductor. * This computer program includes Confidential, Proprietary Information * of Dialog Semiconductor. All Rights Reserved. * **************************************************************************************** */ #ifndef USER_SLEEPMODE_H_ #define USER_SLEEPMODE_H_ /** **************************************************************************************** * @addtogroup APP * @ingroup RICOW * * @brief * * @{ **************************************************************************************** */ /* * INCLUDE FILES **************************************************************************************** */ #include "rwble_config.h" #include "app_task.h" // application task #include "gapc_task.h" // gap functions and messages #include "gapm_task.h" // gap functions and messages #include "app.h" // application definitions #include "co_error.h" // error code definitions //#include "aes128_ctr.h" /* * TYPE DEFINITIONS **************************************************************************************** */ /* * DEFINES **************************************************************************************** */ /* Duration of timer for connection parameter update request */ #define APP_PARAM_UPDATE_REQUEST_TO (100) // 1000*10ms = 10sec, The maximum allowed value is 41943sec (4194300 * 10ms) /* Advertising data update timer */ #define APP_ADV_DATA_UPDATE_TO (100) // 3000*10ms = 30sec, The maximum allowed value is 41943sec (4194300 * 10ms) /* Manufacturer specific data constants */ #define APP_AD_MSD_COMPANY_ID (0xABCD) #define APP_AD_MSD_COMPANY_ID_LEN (2) #define APP_AD_MSD_DATA_LEN (sizeof(uint16_t)) static void put_system_into_deep_sleep(void); #define CFG_APP_GOTO_DEEP_SLEEP #if defined(CFG_APP_GOTO_DEEP_SLEEP) /**************************************************************************************** * Deep Sleep mode and Wake-up from Deep Sleep Configuration * * Selects the trigger mechanism to wake up from deep sleep. * * * * - CFG_DEEP_SLEEP_WAKEUP_POR - Wake up from POR pin * * * * - CFG_DEEP_SLEEP_WAKEUP_GPIO - Wake up from WakeUp Controller * * * * - CFG_DEEP_SLEEP_WAKEUP_RTC - Wake up from RTC Timer (only in DA14531) * * * * - CFG_DEEP_SLEEP_WAKEUP_TIMER1 - Wake up from Timer1 (only in DA14531) * * * * NOTE: * * A hardware reset or power cycle will always wake up the system from deep sleep. * ****************************************************************************************/ #undef CFG_DEEP_SLEEP_WAKEUP_POR #define CFG_DEEP_SLEEP_WAKEUP_GPIO /**************************************************************************************** * Deep sleep mode configuration * ****************************************************************************************/ #define CFG_DEEP_SLEEP_RAM1 PD_SYS_DOWN_RAM_ON #define CFG_DEEP_SLEEP_RAM2 PD_SYS_DOWN_RAM_ON #define CFG_DEEP_SLEEP_RAM3 PD_SYS_DOWN_RAM_ON #define CFG_DEEP_SLEEP_PAD_LATCH_EN true #endif /* * FUNCTION DECLARATIONS **************************************************************************************** */ static void timer_cb(void); /** **************************************************************************************** * @brief Application initialization function. **************************************************************************************** */ void user_app_init(void); /** **************************************************************************************** * @brief Advertising function. **************************************************************************************** */ void user_app_adv_start(void); /** **************************************************************************************** * @brief Connection function. * @param[in] connection_idx Connection Id index * @param[in] param Pointer to GAPC_CONNECTION_REQ_IND message **************************************************************************************** */ void user_app_connection(uint8_t connection_idx, struct gapc_connection_req_ind const *param); /** **************************************************************************************** * @brief Undirect advertising completion function. * @param[in] status Command complete event message status **************************************************************************************** */ void user_app_adv_undirect_complete(uint8_t status); /** **************************************************************************************** * @brief Disconnection function. * @param[in] param Pointer to GAPC_DISCONNECT_IND message **************************************************************************************** */ void user_app_disconnect(struct gapc_disconnect_ind const *param); /** **************************************************************************************** * @brief Handles the messages that are not handled by the SDK internal mechanisms. * @param[in] msgid Id of the message received. * @param[in] param Pointer to the parameters of the message. * @param[in] dest_id ID of the receiving task instance. * @param[in] src_id ID of the sending task instance. **************************************************************************************** */ void user_catch_rest_hndl(ke_msg_id_t const msgid, void const *param, ke_task_id_t const dest_id, ke_task_id_t const src_id); /// @} APP #endif //USER_SLEEPMODE_H_
its urgent please check it
I found a similar question like yours.
Solution here:
The Wake Up Counter Register which counts the number of events (key presses) that have occurred when in sleep. Now when we use the same pin to both Go To Sleep and Wake Up from Sleep it might occur that this counter will be incremented before actually going into sleep. So instead of counting from 0 it will count from 1 and miss the interrupt.
Hence to avoid doing this before arch_set_deep_sleep is called we need to Reset the Wake Up Counter Register. This can be done in the following:
SetWord16(WKUP_COUNTER_REG , 0x00);
Hope this helps.
JH_Renesas
it's not working it stucks on a loop
while (GetBits16(SYS_STAT_REG, DBG_IS_UP) != 0);
Are you attached the debugger when testing the sleep mode? it's not support.