CC26xx Driver Library
[setup.h] Setup

Functions

void SetupTrimDevice (void)
 Performs the necessary trim of the device which is not done in ROM boot code. More...
 

Detailed Description

This module contains functions for device setup which is not done in boot code.

Function Documentation

§ SetupTrimDevice()

void SetupTrimDevice ( void  )

Performs the necessary trim of the device which is not done in ROM boot code.

This function should only execute coming from ROM boot.

The following is handled by this function:

  • Checks if the driverlib variant used by the application is supported by the device. Execution is halted in case of unsupported driverlib variant.
  • Configures VIMS cache mode based on setting in CCFG.
  • Configures functionalities like DCDC and XOSC dependent on startup modes like cold reset, wakeup from shutdown and wakeup from from powerdown.
  • Configures VIMS power domain control.
  • Configures optimal wait time for flash FSM in cases where flash pump wakes up from sleep.
Note
The current implementation does not take soft reset into account. However, it does no damage to execute it again. It only consumes time.
This function is called by the compiler specific device startup codes that are integrated in the SimpleLink SDKs for CC13xx/CC26XX devices.
Returns
None
118 {
119  uint32_t ui32Fcfg1Revision;
120  uint32_t ui32AonSysResetctl;
121 
122  // Get layout revision of the factory configuration area
123  // (Handle undefined revision as revision = 0)
124  ui32Fcfg1Revision = HWREG(FCFG1_BASE + FCFG1_O_FCFG1_REVISION);
125  if ( ui32Fcfg1Revision == 0xFFFFFFFF ) {
126  ui32Fcfg1Revision = 0;
127  }
128 
129  // This driverlib version and setup file is for the CC13x2, CC26x2 PG2.0 or later chips.
130  // Halt if violated
132 
133  // Enable standby in flash bank
135 
136  // Select correct CACHE mode and set correct CACHE configuration
137 #if ( CCFG_BASE == CCFG_BASE_DEFAULT )
139 #else
140  NOROM_SetupSetCacheModeAccordingToCcfgSetting();
141 #endif
142 
143  // 1. Check for powerdown
144  // 2. Check for shutdown
145  // 3. Assume cold reset if none of the above.
146  //
147  // It is always assumed that the application will freeze the latches in
148  // AON_IOC when going to powerdown in order to retain the values on the IOs.
149  //
150  // NB. If this bit is not cleared before proceeding to powerdown, the IOs
151  // will all default to the reset configuration when restarting.
152  if( ! ( HWREGBITW( AON_IOC_BASE + AON_IOC_O_IOCLATCH, AON_IOC_IOCLATCH_EN_BITN )))
153  {
154  // NB. This should be calling a ROM implementation of required trim and
155  // compensation
156  // e.g. TrimAfterColdResetWakeupFromShutDownWakeupFromPowerDown()
158  }
159  // Check for shutdown
160  //
161  // When device is going to shutdown the hardware will automatically clear
162  // the SLEEPDIS bit in the SLEEP register in the AON_PMCTL module.
163  // It is left for the application to assert this bit when waking back up,
164  // but not before the desired IO configuration has been re-established.
166  {
167  // NB. This should be calling a ROM implementation of required trim and
168  // compensation
169  // e.g. TrimAfterColdResetWakeupFromShutDown() -->
170  // TrimAfterColdResetWakeupFromShutDownWakeupFromPowerDown();
171  TrimAfterColdResetWakeupFromShutDown(ui32Fcfg1Revision);
173  }
174  else
175  {
176  // Consider adding a check for soft reset to allow debugging to skip
177  // this section!!!
178  //
179  // NB. This should be calling a ROM implementation of required trim and
180  // compensation
181  // e.g. TrimAfterColdReset() -->
182  // TrimAfterColdResetWakeupFromShutDown() -->
183  // TrimAfterColdResetWakeupFromShutDownWakeupFromPowerDown()
185  TrimAfterColdResetWakeupFromShutDown(ui32Fcfg1Revision);
187 
188  }
189 
190  // Set VIMS power domain control.
191  // PDCTL1VIMS = 0 ==> VIMS power domain is only powered when CPU power domain is powered
192  HWREG( PRCM_BASE + PRCM_O_PDCTL1VIMS ) = 0;
193 
194  // Configure optimal wait time for flash FSM in cases where flash pump
195  // wakes up from sleep
196  HWREG(FLASH_BASE + FLASH_O_FPAC1) = (HWREG(FLASH_BASE + FLASH_O_FPAC1) &
198  (0x139<<FLASH_FPAC1_PSLEEPTDIS_S);
199 
200  // And finally at the end of the flash boot process:
201  // SET BOOT_DET bits in AON_PMCTL to 3 if already found to be 1
202  // Note: The BOOT_DET_x_CLR/SET bits must be manually cleared
203  if ((( HWREG( AON_PMCTL_BASE + AON_PMCTL_O_RESETCTL ) &
206  {
207  ui32AonSysResetctl = ( HWREG( AON_PMCTL_BASE + AON_PMCTL_O_RESETCTL ) &
211  HWREG( AON_PMCTL_BASE + AON_PMCTL_O_RESETCTL ) = ui32AonSysResetctl;
212  }
213 
214  // Reset the RTC
215  AONRTCReset();
216  // Configure the combined event
217  IntPendClear(INT_AON_RTC_COMB);
219  // Start the RTC
220  AONRTCEnable();
221 
222  // Make sure there are no ongoing VIMS mode change when leaving SetupTrimDevice()
223  // (There should typically be no wait time here, but need to be sure)
224  while ( HWREGBITW( VIMS_BASE + VIMS_O_STAT, VIMS_STAT_MODE_CHANGING_BITN )) {
225  // Do nothing - wait for an eventual ongoing mode change to complete.
226  }
227 
228 }
#define AON_RTC_CH1
Definition: aon_rtc.h:95
void IntPendClear(uint32_t ui32Interrupt)
Unpends an interrupt.
Definition: interrupt.c:443
#define AON_RTC_CH2
Definition: aon_rtc.h:96
static void AONRTCCombinedEventConfig(uint32_t ui32Channels)
Configure the source of the combined event.
Definition: aon_rtc.h:337
static void TrimAfterColdResetWakeupFromShutDownWakeupFromPowerDown(void)
Trims to be applied when coming from POWER_DOWN (also called when coming from SHUTDOWN and PIN_RESET)...
Definition: setup.c:239
static void AONRTCReset(void)
Reset the RTC.
Definition: aon_rtc.h:211
#define AON_RTC_CH0
Definition: aon_rtc.h:94
static void TrimAfterColdResetWakeupFromShutDown(uint32_t ui32Fcfg1Revision)
Trims to be applied when coming from SHUTDOWN (also called when coming from PIN_RESET).
Definition: setup.c:255
static void AONRTCEnable(void)
Enable the RTC.
Definition: aon_rtc.h:174
void SetupSetCacheModeAccordingToCcfgSetting(void)
Set correct VIMS_MODE according to CCFG setting (CACHE or GPRAM)
Definition: setup_rom.c:884
void ThisLibraryIsFor_CC13x2_CC26x2_HwRev20AndLater_HaltIfViolated(void)
Verifies that current chip is CC13x2 or CC26x2 PG2.0 or later and never returns if violated...
Definition: chipinfo.c:220
static void TrimAfterColdReset(void)
Trims to be applied when coming from PIN_RESET.
Definition: setup.c:355
Here is the call graph for this function: