Dear Dialog Support,
I am testing the example ble_app_peripheral in SDK_6.0.18.1182.1. I want to realize the following function:
Once DA14531 is powered on, it enters into the extended sleep mode. When the button is pressed down once, DA14531 wakes up and the functions of the original example ble_app_peripheral can normally perform. And when the button is pressed down once again, DA14531 enters into the extended sleep mode again, and so on.
Could you please show me how to achieve this. Thanks a lot!
Hi Nick,Thank you for posting your question online.Please find attached the ble_app_peripheral_wakeup.zip file. I worked on SDK v6.0.18 with the DA14531MOD and the Dev Kit Pro.I configured the P0_11 as my button and whenever I press the button I get into Extended sleep mode or exit Extended Sleep Mode.Please refer to this project for your implementation.
Best Regards,OV_Renesasble_app_peripheral_wakeup.zip
Dear OV,
I downloaded your code and tested it, but I failed with my custom board. My board configuration is shown below:
And I also uploaded the testing video, as you can see, when I used the wire connected to P0.11 to plug the GND on the board, DA14531 seemed enter the extended sleep mode. Actually, the supply current changed from 230uA to tens of uA (17uA to 50uA), but I remember the extended-sleep current should be 3uA. And then I plugged to GND again, DA14531 cannot resume to the active mode. Could you please help to find the problems? Thanks a lot!
Dear Nick,Thank you for the reply.From the video you shared I can see that you are downloading the firmware into the RAM of the DA14531.Could you please download the firmware into the SPI Flash and test again? There could be also leakage current from the custom board. Have you made sure you have calibrated the tool you are using for current measurements so it will only get the DA14531 current consumption?P.S. I really enjoyed the birds chirping in the background .Best Regards,OV_Renesas
Thanks for your kindly reply.
I downloaded the firmware into the SPI Flash, but the result is the same.
I am sure the tool measures the DA14531 current only. You can confirm this from the start of the video.
And there is no leakage current from the custom board. I tested the current in the extended sleep mode previously, and it can drop to around 3uA.
So I am still confused.
Please continue helping on this. Thanks a lot.
P.S. I am glad you enjoy the birds chirping in my video.
Best regards,
Nick
Hi Nick,Thank you for the reply. Apologies for the delay.
Nick Long said:. I tested the current in the extended sleep mode previously, and it can drop to around 3uA.
In which project had you measured the current consumptuion?
Nick Long said:So I am still confused.
Please check on the SDK6 Release Notes as well:If you do not keep the RAM cells detained you will witness a lower current consumption. However, each time you wake-up from Sleep mode (in Extended Sleep mode, each scan/advertise interval) you will have to load again the FW from the SPI Flash which can affect the current consumption as well.Best Regards,OV_Renesas
Thanks for your reply.
I found the second video was just invalid, and now I updated it. You can see from it that I can only put DA14531 into sleep mode but cannot pull it back to the active state. This is the main problem I need your help now.
About the sleep current issue, I found why the sleep current is around 17uA. I just made a stupid mistake. I forgot there is a serial communication CH340 IC on my board, and it consume around 15uA. Sorry about that.
Dear Nick,Thank you for the reply.Glad you were able to see the expected current consumption.
Nick Long said:You can see from it that I can only put DA14531 into sleep mode but cannot pull it back to the active state. This is the main problem I need your help now.
Have you burned the FW into the Flash during the test?What is the Flash part number integrated on your Dev Kit?Have you made any modifications on the Project I shared?Best Regards,OV_Renesas
OV_Renesas said:Have you burned the FW into the Flash during the test?What is the Flash part number integrated on your Dev Kit?
Yes, I have burned the FW into Flash during the test.
The Flash part number is P25Q40.
OV_Renesas said:Have you made any modifications on the Project I shared?
No, I did not modify your codes.
Hi Nick,Thank you for the reply.By default, I used the DA14531MOD which has the P25Q11U part number.On user_periph_setup.h file please add the following:
/****************************************************************************************/ /* SPI configuration */ /****************************************************************************************/ // Define SPI Pads #if defined (__DA14531__) #define SPI_EN_PORT GPIO_PORT_0 #define SPI_EN_PIN GPIO_PIN_1 #define SPI_CLK_PORT GPIO_PORT_0 #define SPI_CLK_PIN GPIO_PIN_4 #define SPI_DO_PORT GPIO_PORT_0 #define SPI_DO_PIN GPIO_PIN_0 #define SPI_DI_PORT GPIO_PORT_0 #define SPI_DI_PIN GPIO_PIN_3 #elif !defined (__DA14586__) #define SPI_EN_PORT GPIO_PORT_0 #define SPI_EN_PIN GPIO_PIN_3 #define SPI_CLK_PORT GPIO_PORT_0 #define SPI_CLK_PIN GPIO_PIN_0 #define SPI_DO_PORT GPIO_PORT_0 #define SPI_DO_PIN GPIO_PIN_6 #define SPI_DI_PORT GPIO_PORT_0 #define SPI_DI_PIN GPIO_PIN_5 #endif /***************************************************************************************/ /* Production debug output configuration */ /***************************************************************************************/ #if PRODUCTION_DEBUG_OUTPUT #if defined (__DA14531__) #define PRODUCTION_DEBUG_PORT GPIO_PORT_0 #define PRODUCTION_DEBUG_PIN GPIO_PIN_11 #else #define PRODUCTION_DEBUG_PORT GPIO_PORT_2 #define PRODUCTION_DEBUG_PIN GPIO_PIN_5 #endif #endif // Define SPI Configuration #define SPI_MS_MODE SPI_MS_MODE_MASTER #define SPI_CP_MODE SPI_CP_MODE_0 #define SPI_WSZ SPI_MODE_8BIT #define SPI_CS SPI_CS_0 #if defined(__DA14531__) #define SPI_SPEED_MODE SPI_SPEED_MODE_4MHz #define SPI_EDGE_CAPTURE SPI_MASTER_EDGE_CAPTURE #else // (DA14585, DA14586) #define SPI_SPEED_MODE SPI_SPEED_MODE_4MHz #endif #if !defined (__DA14586__) #define SPI_FLASH_DEV_SIZE (512 * 1024) //for P25Q40 4Mb #endif
/** **************************************************************************************** * * @file user_periph_setup.c * * @brief Peripherals setup and initialization. * * Copyright (C) 2015-2019 Dialog Semiconductor. * This computer program includes Confidential, Proprietary Information * of Dialog Semiconductor. All Rights Reserved. * **************************************************************************************** */ /* * INCLUDE FILES **************************************************************************************** */ #include "user_periph_setup.h" #include "datasheet.h" #include "system_library.h" #include "rwip_config.h" #include "gpio.h" #include "uart.h" #include "syscntl.h" #include "fpga_helper.h" /* * GLOBAL VARIABLE DEFINITIONS **************************************************************************************** */ /** **************************************************************************************** * @brief Each application reserves its own GPIOs here. **************************************************************************************** */ #if DEVELOPMENT_DEBUG void GPIO_reservations(void) { /* i.e. to reserve P0_1 as Generic Purpose I/O: RESERVE_GPIO(DESCRIPTIVE_NAME, GPIO_PORT_0, GPIO_PIN_1, PID_GPIO); */ // Push Button RESERVE_GPIO(PUSH_BUTTON, GPIO_BUTTON_PORT, GPIO_BUTTON_PIN, PID_GPIO); #if defined (CFG_PRINTF_UART2) RESERVE_GPIO(UART2_TX, UART2_TX_PORT, UART2_TX_PIN, PID_UART2_TX); #endif RESERVE_GPIO(LED, GPIO_LED_PORT, GPIO_LED_PIN, PID_GPIO); #if defined (CFG_SPI_FLASH_ENABLE) RESERVE_GPIO(SPI_FLASH_CS, SPI_EN_PORT, SPI_EN_PIN, PID_SPI_EN); RESERVE_GPIO(SPI_FLASH_CLK, SPI_CLK_PORT, SPI_CLK_PIN, PID_SPI_CLK); RESERVE_GPIO(SPI_FLASH_DO, SPI_DO_PORT, SPI_DO_PIN, PID_SPI_DO); RESERVE_GPIO(SPI_FLASH_DI, SPI_DI_PORT, SPI_DI_PIN, PID_SPI_DI); #endif } #endif void set_pad_functions(void) { /* i.e. to set P0_1 as Generic purpose Output: GPIO_ConfigurePin(GPIO_PORT_0, GPIO_PIN_1, OUTPUT, PID_GPIO, false); */ // Push Button GPIO_ConfigurePin(GPIO_BUTTON_PORT, GPIO_BUTTON_PIN, INPUT_PULLUP, PID_GPIO, false); #if defined (CFG_SPI_FLASH_ENABLE) // Configure SPI pins GPIO_ConfigurePin(SPI_EN_PORT, SPI_EN_PIN, OUTPUT, PID_SPI_EN, true); GPIO_ConfigurePin(SPI_CLK_PORT, SPI_CLK_PIN, OUTPUT, PID_SPI_CLK, false); GPIO_ConfigurePin(SPI_DO_PORT, SPI_DO_PIN, OUTPUT, PID_SPI_DO, false); GPIO_ConfigurePin(SPI_DI_PORT, SPI_DI_PIN, INPUT, PID_SPI_DI, false); #endif #if defined (CFG_PRINTF_UART2) // Configure UART2 TX Pad GPIO_ConfigurePin(UART2_TX_PORT, UART2_TX_PIN, OUTPUT, PID_UART2_TX, false); #endif GPIO_ConfigurePin(GPIO_LED_PORT, GPIO_LED_PIN, OUTPUT, PID_GPIO, false); } #if defined (CFG_PRINTF_UART2) // Configuration struct for UART2 static const uart_cfg_t uart_cfg = { .baud_rate = UART2_BAUDRATE, .data_bits = UART2_DATABITS, .parity = UART2_PARITY, .stop_bits = UART2_STOPBITS, .auto_flow_control = UART2_AFCE, .use_fifo = UART2_FIFO, .tx_fifo_tr_lvl = UART2_TX_FIFO_LEVEL, .rx_fifo_tr_lvl = UART2_RX_FIFO_LEVEL, .intr_priority = 2, }; #endif // Configuration struct for SPI const spi_cfg_t spi_cfg = { .spi_ms = SPI_MS_MODE, .spi_cp = SPI_CP_MODE, .spi_speed = SPI_SPEED_MODE, .spi_wsz = SPI_WSZ, .spi_cs = SPI_CS, .cs_pad.port = SPI_EN_PORT, .cs_pad.pin = SPI_EN_PIN, #if defined (__DA14531__) .spi_capture = SPI_EDGE_CAPTURE, #endif #if defined (CFG_SPI_DMA_SUPPORT) .spi_dma_channel = SPI_DMA_CHANNEL_01, .spi_dma_priority = DMA_PRIO_0, #endif }; // Configuration struct for SPI FLASH const spi_flash_cfg_t spi_flash_cfg = { .chip_size = SPI_FLASH_DEV_SIZE, .jedec_id = P25Q40U_JEDEC_ID, .dev_index = P25Q40U_DEV_INDEX }; void periph_init(void) { #if defined (__DA14531__) // Select FPGA GPIO_MAP 1 // set debugger SWD to SW_CLK = P0[2], SW_DIO=P0[5] FPGA_HELPER(FPGA_GPIO_MAP_1, SWD_DATA_AT_P0_5); // In Boost mode enable the DCDC converter to supply VBAT_HIGH for the used GPIOs // Assumption: The connected external peripheral is powered by 3V syscntl_dcdc_turn_on_in_boost(SYSCNTL_DCDC_LEVEL_3V0); #else // Power up peripherals' power domain SetBits16(PMU_CTRL_REG, PERIPH_SLEEP, 0); while (!(GetWord16(SYS_STAT_REG) & PER_IS_UP)); SetBits16(CLK_16M_REG, XTAL16_BIAS_SH_ENABLE, 1); #endif // ROM patch patch_func(); // Initialize peripherals #if defined (CFG_PRINTF_UART2) // Initialize UART2 uart_initialize(UART2, &uart_cfg); #endif #if defined (CFG_SPI_FLASH_ENABLE) // Configure SPI Flash environment spi_flash_configure_env(&spi_flash_cfg); // Initialize SPI spi_initialize(&spi_cfg); #endif // Set pad functionality set_pad_functions(); // Enable the pads GPIO_set_pad_latch_en(true); }