Other Parts Discussed in Thread: CC2642R,
Hi team,
Here's an issue from the customer may need your help:
From the perspective of board resource, ADC0 is input on DIO23 and ADC1 is input on DIO24:
Board_init() is executed first after entering main();
Board_init() also calls CC2640R2_LAUNCHXL_initGeneral();
In CC2640R2_LAUNCHXL_initGeneral(); execute Power_init(); then PIN_init();
1) What does Power_init() do?Initialize power supply related resources?But there seems to be processing of the clock again. If power management is not involved in the application, can it be called directly without modifying the content?
* ======== Power_init ======== */ int_fast16_t Power_init() { ClockP_Params clockParams; uint32_t ccfgLfClkSrc; uint32_t timeout; /* if this function has already been called, just return */ if (PowerCC26XX_module.initialized) { return (Power_SOK); } #if defined(DeviceFamily_CC26X0R2) /* check to see if the JTAG_PD is on, meaning the emulator was attached during boot and */ /* that the user is in an active debug session */ PowerCC26XX_module.emulatorAttached = (HWREG(AON_WUC_BASE + AON_WUC_O_PWRSTAT) & AON_WUC_PWRSTAT_JTAG_PD_ON) == AON_WUC_PWRSTAT_JTAG_PD_ON; #endif /* set module state field 'initialized' to true */ PowerCC26XX_module.initialized = true; /* set the module state enablePolicy field */ PowerCC26XX_module.enablePolicy = PowerCC26XX_config.enablePolicy; /* copy the Power policy function to module state */ PowerCC26XX_module.policyFxn = PowerCC26XX_config.policyFxn; /* construct the Clock object for scheduling of wakeups */ /* initiated and started by the power policy */ ClockP_Params_init(&clockParams); clockParams.period = 0; clockParams.startFlag = false; clockParams.arg = 0; ClockP_construct(&PowerCC26XX_module.clockObj, &emptyClockFunc, 0, &clockParams); /* construct the Clock object for XOSC_HF switching */ /* initiated and started by Power module when activating XOSC_HF */ ClockP_construct(&PowerCC26XX_module.xoscClockObj, &switchXOSCHFclockFunc, 0, &clockParams); /* construct the Clock object for disabling LF clock quailifiers */ /* one shot, auto start, first expires at 100 msec */ ClockP_construct(&PowerCC26XX_module.lfClockObj, &lfClockReadyCallback, 0, &clockParams); (*(PowerCC26XX_config.calibrateFxn))(PowerCC26XX_SETUP_CALIBRATE); DRIVERLIB_ASSERT_CURR_RELEASE();
2) The BoardGpioInitTable in PIN_init() does not mention ADC0 (DIO23) and ADC1 (DIO24), where is their initialization code?
const PIN_Config BoardGpioInitTable[] = { CC2640R2_LAUNCHXL_PIN_RLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */ CC2640R2_LAUNCHXL_PIN_GLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */ CC2640R2_LAUNCHXL_PIN_BTN1 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */ CC2640R2_LAUNCHXL_PIN_BTN2 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */ CC2640R2_LAUNCHXL_SPI_FLASH_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */ CC2640R2_LAUNCHXL_UART_RX | PIN_INPUT_EN | PIN_PULLDOWN, /* UART RX via debugger back channel */ CC2640R2_LAUNCHXL_UART_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL, /* UART TX via debugger back channel */ CC2640R2_LAUNCHXL_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master out - slave in */ CC2640R2_LAUNCHXL_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master in - slave out */ CC2640R2_LAUNCHXL_SPI0_CLK | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI clock */ PIN_TERMINATE };
3) Here defines the pins used by SPI0:
These pins are initialized here:
But how does IOID_8~IOID_11 map to the SPI0 peripheral?
4) The same PIN can map multiple functions such as digital IO, analogue input, etc. is there any docs on how to map it?
Could you help check this case? Thanks.
Best Regards,
Cherry