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

Here is the call graph for this function: