Trident IoT SDK
 
Loading...
Searching...
No Matches
T32CZ20_power.h
Go to the documentation of this file.
1
13
14#ifndef T32CZ20_POWER_H_
15#define T32CZ20_POWER_H_
16
17#include "tr_hal_platform.h"
18
24
25
36#ifdef DPD_SECURE_EN
37 #define CHIP_MEMORY_MAP_DEEP_PWR_DOWN_BASE (0x50005000UL)
38#else
39 #define CHIP_MEMORY_MAP_DEEP_PWR_DOWN_BASE (0x40005000UL)
40#endif // DPD_SECURE_EN
41
42#ifdef SOC_PMU_SECURE_EN
43 #define CHIP_MEMORY_MAP_POWER_MGMT_BASE (0x50006000UL)
44#else
45 #define CHIP_MEMORY_MAP_POWER_MGMT_BASE (0x40006000UL)
46#endif // SOC_PMU_SECURE_EN
47
53typedef struct
54{
55 // read the reset reason from the chip
56 __IO uint32_t reset_reason; // 0x00
57
58 // write 1 to clear the reset reason
59 __IO uint32_t clear_reset_reason; // 0x04
60
61 // bitmask of what GPIOs can wake the chip
62 __IO uint32_t gpio_wake_enable; // 0x08
63
64 // bitmask of wake polarity for GPIOs
65 // value of 1 = wake on high
66 // value of 0 = wake on low
67 __IO uint32_t gpio_wake_polarity; // 0x0C
68
69 // retention registers
70 // these can be used to store information and will not be cleared
71 // when the chip goes to deep sleep
72 __IO uint32_t retention_0; // 0x10
73 __IO uint32_t retention_1; // 0x14
74 __IO uint32_t retention_2; // 0x18
75 __IO uint32_t retention_3; // 0x1C
76
78
79// *****************************************************************
80// this is for the RESET REASON register (0x00)
81#define TR_HAL_RESET_REASON_POWER 0x01
82#define TR_HAL_RESET_REASON_EXTERNAL_RESET 0x02
83#define TR_HAL_RESET_REASON_DEEP_POWER_DOWN 0x04
84#define TR_HAL_RESET_REASON_DEEP_SLEEP 0x08
85#define TR_HAL_RESET_REASON_WATCHDOG 0x10
86#define TR_HAL_RESET_REASON_SOFTWARE 0x20
87#define TR_HAL_RESET_REASON_MCU_LOCKUP 0x40
88
89
90// *****************************************************************
91// this orients the DEEP POWER DOWN REGISTERS struct with the correct addresses
92// so referencing a field will now read/write the correct SYSCTRL register
93// chip address
94#define DEEP_POWER_DOWN_CHIP_REGISTERS ((DEEP_POWER_DOWN_REGISTERS_T *) CHIP_MEMORY_MAP_DEEP_PWR_DOWN_BASE)
95
96
97
102typedef struct
103{
104 __IO uint32_t reserved0[2]; // 0x00, 0x04
105
106 __IO uint32_t soc_bbpll_read; // 0x08
107
108 __IO uint32_t reserved1[5]; // 0x0C, 0x10, 0x14, 0x18, 0x1C
109
110 __IO uint32_t pmu_soc_pmu_xtal_0; // 0x20
111 __IO uint32_t pmu_soc_pmu_xtal_1; // 0x24
112
113 __IO uint32_t reserved2[3]; // 0x28, 0x2C, 0x30
114
115 // setup the 32KHz RC Oscillator
116 __IO uint32_t pmu_osc_32k; // 0x34
117
118 __IO uint32_t reserved3[2]; // 0x38, 0x3C
119
120 __IO uint32_t pmu_rvd_0; // 0x40
121
122 __IO uint32_t reserved4[18]; // 0x44, 0x48, 0x4C
123 // 0x50, 0x54, 0x58, 0x5C
124 // 0x60, 0x64, 0x68, 0x6C
125 // 0x70, 0x74, 0x78, 0x7C
126 // 0x80, 0x84, 0x88,
127 // setup the 1MHz RC Oscillator
128 __IO uint32_t soc_pmu_rco1m; // 0x40
129
131
132
133// *****************************************************************
134// this is for the soc_pmu_rco1m register (0x40)
135
136// bits 0-6
137#define PM_RCO_1M_TUNE_FINE_MASK 0x8F
138
139// bits 8-11
140#define PM_RCO_1M_TUNE_COARSE_MASK 0xF00
141
142// bits 12-13: PW_RCO_1M
143// bits 14-15: TEST_RCO_1M
144
145// bit 16
146#define PM_RCO_1M_ENABLE_BIT 0x10000
147
148
149// *****************************************************************
150// this is for the pmu_osc_32k register (0x34)
151
152// bits 0-7
153#define PM_RCO_32K_TUNE_FINE_MASK 0xFF
154
155// bits 8-9
156#define PM_RCO_32K_TUNE_COARSE_MASK 0x300
157
158// bits 10-11: PW_BUF_RCO_32K
159// bits 12-15: PW_RCO_32K
160// bit 16 : EN_XO_32K
161// bit 17 : EN_XO_32K_FAST
162// bits 18-19: PW_BUF_XO_32K
163// bits 20-22: PW_XO_32K
164// bit 23 : FORCE_RCO_32K_OFF
165
166// bit 24 = select / enable
167#define PM_RCO_32K_ENABLE_BIT 0x01000000
168
169
170// *****************************************************************
171// this orients the POWER MGMT REGISTERS struct with the correct addresses
172// so referencing a field will now read/write the correct SYSCTRL register
173// chip address
174#define POWER_MGMT_CHIP_REGISTERS ((POWER_MGMT_REGISTERS_T *) CHIP_MEMORY_MAP_POWER_MGMT_BASE)
175
176
177
182typedef enum
183{
184 TR_HAL_POWER_MODE_0 = 10, // wake = CPU on, all clocks on, wake on INT
185 TR_HAL_POWER_MODE_1 = 11, // sleep = CPU on, slow clocks on, wake on INT
186 TR_HAL_POWER_MODE_2 = 12, // deep sleep = CPU off, slow clocks on, wake on GPIO/RTC
187 TR_HAL_POWER_MODE_3 = 13, // deep power down = CPU off, clocks off, wake on GPIO
188
190
191
201typedef enum
202{
203 // this is the system clock, for use when the device is not sleeping
204 // this is called per_clk in the SYS_CTRL_CHIP_REGISTERS->system_clock_control_1
206
207 // this is still using the system clock but set for 16MHz
208 // the field per_clk_sel is set to 0b10 = xtal_clk/2 in the
209 // SYS_CTRL_CHIP_REGISTERS->system_clock_control_0
211
212 // this is the rco1m option for clock. This is used for UARTs that are required
213 // to operate normally in low-power modes. This is limited to 115200 maximum
214 // baud rate. The clock rate is actually 921.6 KHz (not 1000 MHz)
216
217 // this is the rco32k option for clock. This is used for UARTs powered on in
218 // sleep mode, but off in deep sleep mode. This is set for 38.4 KHz with a
219 // maximum baud rate of 9600
221
223
224
228
229
230#endif // T32CZ20_POWER_H_
231
232
This file contains the CHIP SPECIFIC types and defines for the T32CZ20.
tr_hal_power_mode_t
enum for the different power modes that the chip can be in see section 5, table 5-2
Definition T32CZ20_power.h:183
tr_hal_clock_t
enum for the different clocks some of these can be disabled and some cannot, the crystal oscillator c...
Definition T32CZ20_power.h:202
@ TR_HAL_POWER_MODE_1
Definition T32CZ20_power.h:185
@ TR_HAL_POWER_MODE_3
Definition T32CZ20_power.h:187
@ TR_HAL_POWER_MODE_0
Definition T32CZ20_power.h:184
@ TR_HAL_POWER_MODE_2
Definition T32CZ20_power.h:186
@ TR_HAL_CLOCK_16M
Definition T32CZ20_power.h:210
@ TR_HAL_CLOCK_32M
Definition T32CZ20_power.h:205
@ TR_HAL_CLOCK_32K
Definition T32CZ20_power.h:220
@ TR_HAL_CLOCK_1M
Definition T32CZ20_power.h:215
offsets for where to find chip registers needed for Deep Power Down register which is used to see sec...
Definition T32CZ20_power.h:54
__IO uint32_t retention_3
Definition T32CZ20_power.h:75
__IO uint32_t reset_reason
Definition T32CZ20_power.h:56
__IO uint32_t retention_1
Definition T32CZ20_power.h:73
__IO uint32_t gpio_wake_enable
Definition T32CZ20_power.h:62
__IO uint32_t retention_2
Definition T32CZ20_power.h:74
__IO uint32_t clear_reset_reason
Definition T32CZ20_power.h:59
__IO uint32_t retention_0
Definition T32CZ20_power.h:72
__IO uint32_t gpio_wake_polarity
Definition T32CZ20_power.h:67
offsets for where to find chip registers needed for Power Mgmt register. This is not documented in th...
Definition T32CZ20_power.h:103
__IO uint32_t pmu_soc_pmu_xtal_1
Definition T32CZ20_power.h:111
__IO uint32_t pmu_osc_32k
Definition T32CZ20_power.h:116
__IO uint32_t soc_pmu_rco1m
Definition T32CZ20_power.h:128
__IO uint32_t pmu_soc_pmu_xtal_0
Definition T32CZ20_power.h:110
__IO uint32_t soc_bbpll_read
Definition T32CZ20_power.h:106
__IO uint32_t pmu_rvd_0
Definition T32CZ20_power.h:120