CC13xx 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
107 {
108  uint32_t ui32Fcfg1Revision;
109  uint32_t ui32AonSysResetctl;
110 
111  // Get layout revision of the factory configuration area
112  // (Handle undefined revision as revision = 0)
113  ui32Fcfg1Revision = HWREG(FCFG1_BASE + FCFG1_O_FCFG1_REVISION);
114  if ( ui32Fcfg1Revision == 0xFFFFFFFF ) {
115  ui32Fcfg1Revision = 0;
116  }
117 
118  // This driverlib version and setup file is for CC13x0 PG2.0 and later.
119  // Halt if violated
121 
122  // Enable standby in flash bank
124 
125  // Clock must always be enabled for the semaphore module (due to ADI/DDI HW workaround)
127 
128  // Warm resets on CC13x0 and CC26x0 complicates software design because much of
129  // our software expect that initialization is done from a full system reset.
130  // This includes RTC setup, oscillator configuration and AUX setup.
131  // To ensure a full reset of the device is done when customers get e.g. a Watchdog
132  // reset, the following is set here:
134 
135  // Select correct CACHE mode and set correct CACHE configuration
136 #if ( CCFG_BASE == CCFG_BASE_DEFAULT )
138 #else
139  NOROM_SetupSetCacheModeAccordingToCcfgSetting();
140 #endif
141 
142  // 1. Check for powerdown
143  // 2. Check for shutdown
144  // 3. Assume cold reset if none of the above.
145  //
146  // It is always assumed that the application will freeze the latches in
147  // AON_IOC when going to powerdown in order to retain the values on the IOs.
148  //
149  // NB. If this bit is not cleared before proceeding to powerdown, the IOs
150  // will all default to the reset configuration when restarting.
152  {
153  // NB. This should be calling a ROM implementation of required trim and
154  // compensation
155  // e.g. TrimAfterColdResetWakeupFromShutDownWakeupFromPowerDown()
157  }
158  // Check for shutdown
159  //
160  // When device is going to shutdown the hardware will automatically clear
161  // the SLEEPDIS bit in the SLEEP register in the AON_SYSCTL module.
162  // It is left for the application to assert this bit when waking back up,
163  // but not before the desired IO configuration has been re-established.
165  {
166  // NB. This should be calling a ROM implementation of required trim and
167  // compensation
168  // e.g. TrimAfterColdResetWakeupFromShutDown() -->
169  // TrimAfterColdResetWakeupFromShutDownWakeupFromPowerDown();
170  TrimAfterColdResetWakeupFromShutDown(ui32Fcfg1Revision);
172  }
173  else
174  {
175  // Consider adding a check for soft reset to allow debugging to skip
176  // this section!!!
177  //
178  // NB. This should be calling a ROM implementation of required trim and
179  // compensation
180  // e.g. TrimAfterColdReset() -->
181  // TrimAfterColdResetWakeupFromShutDown() -->
182  // TrimAfterColdResetWakeupFromShutDownWakeupFromPowerDown()
184  TrimAfterColdResetWakeupFromShutDown(ui32Fcfg1Revision);
186 
187  }
188 
189  // Set VIMS power domain control.
190  // PDCTL1VIMS = 0 ==> VIMS power domain is only powered when CPU power domain is powered
191  HWREG( PRCM_BASE + PRCM_O_PDCTL1VIMS ) = 0;
192 
193  // Configure optimal wait time for flash FSM in cases where flash pump
194  // wakes up from sleep
195  HWREG(FLASH_BASE + FLASH_O_FPAC1) = (HWREG(FLASH_BASE + FLASH_O_FPAC1) &
197  (0x139<<FLASH_FPAC1_PSLEEPTDIS_S);
198 
199  // And finally at the end of the flash boot process:
200  // SET BOOT_DET bits in AON_SYSCTL to 3 if already found to be 1
201  // Note: The BOOT_DET_x_CLR/SET bits must be manually cleared
202  if ((( HWREG( AON_SYSCTL_BASE + AON_SYSCTL_O_RESETCTL ) &
205  {
206  ui32AonSysResetctl = ( HWREG( AON_SYSCTL_BASE + AON_SYSCTL_O_RESETCTL ) &
210  HWREG( AON_SYSCTL_BASE + AON_SYSCTL_O_RESETCTL ) = ui32AonSysResetctl;
211  }
212 
213  // Make sure there are no ongoing VIMS mode change when leaving SetupTrimDevice()
214  // (There should typically be no wait time here, but need to be sure)
215  while ( HWREGBITW( VIMS_BASE + VIMS_O_STAT, VIMS_STAT_MODE_CHANGING_BITN )) {
216  // Do nothing - wait for an eventual ongoing mode change to complete.
217  }
218 }
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:229
void ThisLibraryIsFor_CC13x0_HwRev20AndLater_HaltIfViolated(void)
Verifies that current chip is CC13x0 HwRev 2.0 or later and never returns if violated.
Definition: chipinfo.c:176
static void TrimAfterColdResetWakeupFromShutDown(uint32_t ui32Fcfg1Revision)
Trims to be applied when coming from SHUTDOWN (also called when coming from PIN_RESET).
Definition: setup.c:245
void SetupSetCacheModeAccordingToCcfgSetting(void)
Set correct VIMS_MODE according to CCFG setting (CACHE or GPRAM)
Definition: setup_rom.c:916
static void TrimAfterColdReset(void)
Trims to be applied when coming from PIN_RESET.
Definition: setup.c:349

Here is the call graph for this function: