SmartSnippets DA1459x SDK
Xtal_TRIM.h
Go to the documentation of this file.
1 
34 #ifndef XTAL_TRIM_H_
35 #define XTAL_TRIM_H_
36 
37 #define AUTO_XTAL_TEST_DBG_EN 0 // Enable/Disable debug parameters.
38 
39 // Status codes
40 #define XTAL_OPERATION_SUCCESS (0) // XTAL calibration success.
41 #define PULSE_OUT_OF_RANGE_ERROR (-1) // Pulse found in the pulse pin assigned GPIO was out of acceptable range
42 #define NO_PULSE_ERROR (-2) // No pulse found, or pulse > 740 ms (measure_pulse aborts)
43 #define WRITING_VAL_TO_OTP_ERROR (-3) // Failed to write value in OTP.
44 #define INVALID_GPIO_ERROR (-4) // Wrong GPIO configuration.
45 #define WRONG_XTAL_SOURCE_ERROR (-5) // Incorrect pulse detected.
46 #define XTAL_CALIBRATION_ERROR (-6) // XTAL calibration error.
47 
48 int16_t auto_trim(HW_GPIO_PORT port, HW_GPIO_PIN pin);
49 
50 uint16_t run_xtal32m_block_calib(void);
51 
52 void delay(uint32_t dd);
53 void Setting_Trim(uint32_t Trim_Value);
54 
55 uint32_t pulse_counter(void); // counting pulses during 500 msec
56 uint32_t MEASURE_PULSE(int32_t datareg1, int32_t shift_bit1); // see assembly code
57 
58 #if AUTO_XTAL_TEST_DBG_EN
59 void TRIM_test (int S1, int S2); // testing
60 #endif
61 
62 #endif /* XTAL_TRIM_H_ */
63 
HW_GPIO_PIN
HW_GPIO_PIN
GPIO pin number.
Definition: hw_gpio.h:106
HW_GPIO_PORT
HW_GPIO_PORT
GPIO port number.
Definition: hw_gpio.h:96