This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
hi all
Q.我司有個需求是在休眠中,可經由程序或周邊i/o(狀態)等.
來開啓pwn,adc and i/o來控制周邊(led or buzzer). 但不需要開啓通訊的功能.
因此,就 CC26xx 及CC 13xx 依CC13xx, CC26xx SimpleLink Wireless MCU Technical Reference Manual issue:
就上述內容,應可以"Sensor Controller"來達成目的.
但對於這一方面,
我目前有幾點問題.
A.Sensor Controller Studio ,產生後的相關檔案
(main.c,scif.h/.c , scif_framework.c/.h and scif_osal_none.c/.h)
要如何整合入我的Zigbee project
B.因Sensor Controller可在 power-down mode中動作,
我要如何進入及驗証這個行為.
C.可進一步提供對於Sensor Controller的資訊.
I will be grateful for any help you can provide.
ref: https://www.deyisupport.com/question_answer/wireless_connectivity/bluetooth/f/103/t/96397.aspx
目前已将SCS(sensor controller studio)的blink project加入.
但有些问题,仍需帮忙
0.并没有正常动作.但blink led (sensor controller )可以动作.ref: 附件
1.如何验证 power down mode ?
2.在共用资源(介面i/o or spi /i2c))时,又要如何处理?
3.integrating "LED Blinker" project into SampleSwitch project,
in my platform ,it show a warning about the linker : how to solve it ? it information overlap in the vector .
"Warning[Lp023]: absolute placement (in [0x20000000-0x200000c7]) overlaps with reserved areas: C:\ti\simplelink\zstack_home_1_02_02a_44539\Projects\zstack\HomeAutomation\SampleSwitch\CC26xx\cc26xx_app.icf 178"
#include <string.h> #include <xdc/std.h> #include <xdc/runtime/Error.h> #include <ti/sysbios/BIOS.h> #include <ti/sysbios/knl/Task.h> #include <ti/sysbios/hal/Hwi.h> #include <ioc.h> #include "ICall.h" #include "Board.h" #include "TIMACBoard.h" #include "CryptoBoard.h" #include <ti/sysbios/family/arm/cc26xx/Power.h> #include <ti/drivers/crypto/CryptoCC26XX.h> #include <ti/sysbios/family/arm/cc26xx/Power.h> #include <ti/sysbios/family/arm/cc26xx/PowerCC2650.h> #include <aon_rtc.h> #include <prcm.h> /* Header files required to enable instruction fetch cache */ #include <vims.h> #include <hw_memmap.h> #include "cpu.h" #include "hw_types.h" #include <inc/hw_ccfg.h> #include <inc/hw_ccfg_simple_struct.h> #include "pwrmon.h" #include "nvoctp.h" #include "switch.h" #include "zstackconfig.h" #include "scif.h" #include "scif_framework.h" #include "hal_defs.h" /****************************************************************************** * CONSTANTS */ // IEEE Mode #define RFC_MODE_IEEE PRCM_RFCMODESEL_CURR_MODE2 // Size of the Application Thread's Stack #define MY_TASK_STACK_SIZE 512 // Exented Address Length #define EXTADDR_LEN 8 // Extended Address offset in FCFG (LSB..MSB) #define EXTADDR_OFFSET 0x2F0 // Minimum voltage level need to run #if !defined (MIN_VDD_RUN) #define MIN_VDD_RUN MIN_VDD_POLL #endif /****************************************************************************** * MACROS */ // Macro to set the RF Mode #define SET_RFC_MODE(mode) HWREG(PRCM_BASE + PRCM_O_RFCMODESEL) = (mode) // Macro used to break a uint32_t into individual bytes #define BREAK_UINT32(var, ByteNum) \ (uint8)((uint32)(((var) >> ((ByteNum) * 8)) & 0x00FF)) /****************************************************************************** * ZStack Configuration Structure */ zstack_Config_t user0Cfg = { {0, 0, 0, 0, 0, 0, 0, 0}, // Extended Address {0, 0, 0, 0, 0, 0, 0, 0}, // NV function pointers 0, // ICall application thread ID 0, // stack image init fail flag MAC_USER_CFG }; /****************************************************************************** * LOCAL VARIABLES */ // Main application stack space static Task_Struct myTask; static Char myTaskStack[MY_TASK_STACK_SIZE]; //task 2 static Task_Struct myTask2; static Char myTaskStack2[MY_TASK_STACK_SIZE]; // Used to check for a valid extended address static const uint8_t dummyExtAddr[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; /****************************************************************************** * EXTERNALS */ extern const ccfg_t __ccfg; /******************************************************************************* * @fn taskFxn * * @brief Application thread starting function * * @param a0 - argument 0, not used * @param a1 - argument 1, not used * * @return none */ Void taskFxn(UArg a0, UArg a1) { /* Disallow shutting down JTAG, VIMS, SYSBUS during idle state * since TIMAC requires SYSBUS during idle. */ Power_setConstraint(Power_IDLE_PD_DISALLOW); /* Initialize the Power Monitor */ PWRMON_init(); /* Initialize ICall module */ ICall_init(); { CryptoCC26XX_Params CryptoCC26XXParams; extern CryptoCC26XX_Handle CryptoCC26XXHandle; // Initialize the Crypto Driver CryptoCC26XX_init(); CryptoCC26XX_Params_init(&CryptoCC26XXParams); CryptoCC26XXHandle = CryptoCC26XX_open(Board_CRYPTO, false, &CryptoCC26XXParams); if(!CryptoCC26XXHandle) { Task_exit(); } Crypto_init(); } /* * Copy the extended address from the CCFG area * Assumption: the memory in CCFG_IEEE_MAC_0 and CCFG_IEEE_MAC_1 * is contiguous and LSB first. */ memcpy(user0Cfg.extendedAddress, (uint8_t *)&(__ccfg.CCFG_IEEE_MAC_0), EXTADDR_LEN); // Check to see if the CCFG IEEE is valid if(memcmp(user0Cfg.extendedAddress, dummyExtAddr, EXTADDR_LEN) == 0) { // No, it isn't valid. Get the Primary IEEE Address memcpy(user0Cfg.extendedAddress, (uint8_t *)(FCFG1_BASE + EXTADDR_OFFSET), EXTADDR_LEN); } // Make sure the voltage level is high enough to operate while ( PWRMON_check( MIN_VDD_RUN ) == false ) { // Add your own code to do something here, flash LED, sleep, something // For now, we will loop and wait for power comes up to the // MIN_VDD_RUN level. } #if !defined (FEATURE_APP_NO_NV_INIT) /* Setup the NV driver for the ZStack thread */ NVOCTP_loadApiPtrs(&user0Cfg.nvFps); #endif // !FEATURE_APP_NO_NV_INIT if(user0Cfg.nvFps.initNV) { user0Cfg.nvFps.initNV(NULL); } /* Start tasks of external images */ ICall_createRemoteTasks(); /* Kick off application */ Switch_task(&user0Cfg.nvFps); } void ctrlReadyCallback(void) { } // ctrlReadyCallback void taskAlertCallback(void) { // Clear the ALERT interrupt source scifClearAlertIntSource(); if (scifGetTaskIoStructAvailCount(SCIF_LED_BLINKER_TASK_ID, SCIF_STRUCT_OUTPUT) == 1) { SCIF_LED_BLINKER_OUTPUT_T* pOutput = scifGetTaskStruct(SCIF_LED_BLINKER_TASK_ID, SCIF_STRUCT_OUTPUT); if (pOutput->counter & 0x0001) { HWREG(GPIO_BASE + GPIO_O_DOUTSET31_0) = BV(Board_LED1); } else { HWREG(GPIO_BASE + GPIO_O_DOUTCLR31_0) = BV(Board_LED1); } if (pOutput->counter & 0x0002) { HWREG(GPIO_BASE + GPIO_O_DOUTSET31_0) = BV(Board_LED2); } else { HWREG(GPIO_BASE + GPIO_O_DOUTCLR31_0) = BV(Board_LED2); } scifHandoffTaskStruct(SCIF_LED_BLINKER_TASK_ID, SCIF_STRUCT_OUTPUT); } // Acknowledge the alert event scifAckAlertEvents(); } // taskAlertCallback Void taskFxn2(UArg a0, UArg a1) { PRCMPowerDomainOn(PRCM_DOMAIN_PERIPH); PRCMLoadSet(); while (PRCMPowerDomainStatus(PRCM_DOMAIN_PERIPH) != PRCM_DOMAIN_POWER_ON); // Enable the GPIO module PRCMPeripheralRunEnable(PRCM_PERIPH_GPIO); PRCMPeripheralSleepEnable(PRCM_PERIPH_GPIO); PRCMPeripheralDeepSleepEnable(PRCM_PERIPH_GPIO); PRCMLoadSet(); while (!PRCMLoadGet()); // In this example, we keep the AUX domain access permanently enabled scifOsalEnableAuxDomainAccess(); // Initialize and start the Sensor Controller scifOsalRegisterCtrlReadyCallback(ctrlReadyCallback); scifOsalRegisterTaskAlertCallback(taskAlertCallback); scifInit(&scifDriverSetup); scifStartRtcTicksNow(0x00010000 / 128); IntMasterEnable(); AONRTCEnable(); // Main loop while (1) { // Start the LED blinker task? if (!(HWREG(GPIO_BASE + GPIO_O_DIN31_0) & BV(Board_KEY_SELECT))) { if (scifStartTasksNbl(BV(SCIF_LED_BLINKER_TASK_ID)) == SCIF_SUCCESS) { scifWaitOnNbl(42); } // Debounce the button CPUdelay((100 * 1000 * 48) / 3); while (!(HWREG(GPIO_BASE + GPIO_O_DIN31_0) & BV(Board_KEY_SELECT))); CPUdelay((100 * 1000 * 48) / 3); // Stop the LED blinker task? } } } /******************************************************************************* * @fn main * * @brief entry function - standard C [main()] * * @param none * * @return none */ Void main() { Task_Params taskParams; Task_Params taskParams2; // set RFC mode to support IEEE802.15.4 // Note: This must be done before the RF Core is released from reset! SET_RFC_MODE(RFC_MODE_IEEE); // enable iCache prefetching VIMSConfigure(VIMS_BASE, TRUE, TRUE); // Enable cache VIMSModeSet(VIMS_BASE, VIMS_MODE_ENABLED); /* Initialization for board related stuff such as LEDs * following TI-RTOS convention */ PIN_init(BoardGpioInitTable); // Configure task. Task_Params_init(&taskParams); taskParams.stack = myTaskStack; taskParams.stackSize = MY_TASK_STACK_SIZE; taskParams.priority = 1; Task_construct(&myTask, taskFxn, &taskParams, NULL); Task_Params_init(&taskParams2); taskParams2.stack = myTaskStack2; taskParams2.stackSize = MY_TASK_STACK_SIZE; taskParams2.priority = 2; Task_construct(&myTask2, taskFxn2, &taskParams2, NULL); BIOS_start(); /* enable interrupts and start SYS/BIOS */ } /******************************************************************************* * @fn halAssertHandler * * @brief HAL assert handler required by OSAL memory module. * * @param none * * @return none */ void halAssertHandler(void) { Hwi_disable(); while(1) {} } /******************************************************************************* * @fn exceptionHandler * * @brief Exception Handler Loop * * @param none * * @return none */ void exceptionHandler() { while(1) {} } /******************************************************************************* * @fn smallErrorHook * * @brief Error handler to be hooked into TI-RTOS * * @param none * * @return none */ Void smallErrorHook(Error_Block *eb) { while(1) {} }
附件工程利用SCE工程,把UART功能上去,也就是SCE使能UART处于接收状态,当接收到的数据达到一定程度以后,唤醒M3。
直接把Zip解压到下面目录下
C:\ti\simplelink\zstack_home_1_02_02_42930\Projects\zstack\HomeAutomation
你可以参考下。
谢谢!