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

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
114 {
115  uint32_t ui32Fcfg1Revision;
116  uint32_t ui32AonSysResetctl;
117 
118  // Get layout revision of the factory configuration area
119  // (Handle undefined revision as revision = 0)
120  ui32Fcfg1Revision = HWREG(FCFG1_BASE + FCFG1_O_FCFG1_REVISION);
121  if ( ui32Fcfg1Revision == 0xFFFFFFFF ) {
122  ui32Fcfg1Revision = 0;
123  }
124 
125  // This driverlib version and setup file is for the CC13x2, CC26x2 PG2.0 or later chips.
126  // Halt if violated
128 
129  // Enable standby in flash bank
131 
132  // Select correct CACHE mode and set correct CACHE configuration
133 #if ( CCFG_BASE == CCFG_BASE_DEFAULT )
135 #else
136  NOROM_SetupSetCacheModeAccordingToCcfgSetting();
137 #endif
138 
139  // 1. Check for powerdown
140  // 2. Check for shutdown
141  // 3. Assume cold reset if none of the above.
142  //
143  // It is always assumed that the application will freeze the latches in
144  // AON_IOC when going to powerdown in order to retain the values on the IOs.
145  //
146  // NB. If this bit is not cleared before proceeding to powerdown, the IOs
147  // will all default to the reset configuration when restarting.
148  if( ! ( HWREGBITW( AON_IOC_BASE + AON_IOC_O_IOCLATCH, AON_IOC_IOCLATCH_EN_BITN )))
149  {
150  // NB. This should be calling a ROM implementation of required trim and
151  // compensation
152  // e.g. TrimAfterColdResetWakeupFromShutDownWakeupFromPowerDown()
154  }
155  // Check for shutdown
156  //
157  // When device is going to shutdown the hardware will automatically clear
158  // the SLEEPDIS bit in the SLEEP register in the AON_PMCTL module.
159  // It is left for the application to assert this bit when waking back up,
160  // but not before the desired IO configuration has been re-established.
162  {
163  // NB. This should be calling a ROM implementation of required trim and
164  // compensation
165  // e.g. TrimAfterColdResetWakeupFromShutDown() -->
166  // TrimAfterColdResetWakeupFromShutDownWakeupFromPowerDown();
167  TrimAfterColdResetWakeupFromShutDown(ui32Fcfg1Revision);
169  }
170  else
171  {
172  // Consider adding a check for soft reset to allow debugging to skip
173  // this section!!!
174  //
175  // NB. This should be calling a ROM implementation of required trim and
176  // compensation
177  // e.g. TrimAfterColdReset() -->
178  // TrimAfterColdResetWakeupFromShutDown() -->
179  // TrimAfterColdResetWakeupFromShutDownWakeupFromPowerDown()
181  TrimAfterColdResetWakeupFromShutDown(ui32Fcfg1Revision);
183 
184  }
185 
186  // Set VIMS power domain control.
187  // PDCTL1VIMS = 0 ==> VIMS power domain is only powered when CPU power domain is powered
188  HWREG( PRCM_BASE + PRCM_O_PDCTL1VIMS ) = 0;
189 
190  // Configure optimal wait time for flash FSM in cases where flash pump
191  // wakes up from sleep
192  HWREG(FLASH_BASE + FLASH_O_FPAC1) = (HWREG(FLASH_BASE + FLASH_O_FPAC1) &
194  (0x139<<FLASH_FPAC1_PSLEEPTDIS_S);
195 
196  // And finally at the end of the flash boot process:
197  // SET BOOT_DET bits in AON_PMCTL to 3 if already found to be 1
198  // Note: The BOOT_DET_x_CLR/SET bits must be manually cleared
199  if ((( HWREG( AON_PMCTL_BASE + AON_PMCTL_O_RESETCTL ) &
202  {
203  ui32AonSysResetctl = ( HWREG( AON_PMCTL_BASE + AON_PMCTL_O_RESETCTL ) &
207  HWREG( AON_PMCTL_BASE + AON_PMCTL_O_RESETCTL ) = ui32AonSysResetctl;
208  }
209 
210  // Make sure there are no ongoing VIMS mode change when leaving SetupTrimDevice()
211  // (There should typically be no wait time here, but need to be sure)
212  while ( HWREGBITW( VIMS_BASE + VIMS_O_STAT, VIMS_STAT_MODE_CHANGING_BITN )) {
213  // Do nothing - wait for an eventual ongoing mode change to complete.
214  }
215 }
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:226
static void TrimAfterColdResetWakeupFromShutDown(uint32_t ui32Fcfg1Revision)
Trims to be applied when coming from SHUTDOWN (also called when coming from PIN_RESET).
Definition: setup.c:242
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:203
static void TrimAfterColdReset(void)
Trims to be applied when coming from PIN_RESET.
Definition: setup.c:341

Here is the call graph for this function: