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