Telink TLSR8232 BLE SDK Developer Handbook
AN-19112700-E1
43
Ver.1.0.0
If these macros are pre-defined in app_config.h, they will not use the default values
above. PA7 is taken as an example to illustrate GPIO state configuration in app_config.h.
1) Configure func: #define PA7_FUNC AS_GPIO
2) Configure ie
:
#define PA7_INPUT_ENABLE 1
3) Configure oe:
#define PA7_OUTPUT_ENABLE 0
4) Configure dataO
:
#define PA7_DATA_OUT
0
5) Configure internal pull up/ down resistor:
#define PULL_WAKEUP_SRC_PA7
PM_PIN_UP_DOWN_FLOAT
Conclusions for GPIO initialization:
1) Users can pre-define GPIO initial state in app_config.h, and initialize corresponding
GPIO to the configured value by gpio_init;
2) Users can set the GPIO states by GPIO state control functions (gpio_set_input_en,
etc.) in user_init;
3) Users can combine the two methods to configure the GPIO states.
Please note that if the state of one GPIO is configured to different values in
app_config.h and user_init, the configuration in user_init will take effect finally
according to firmware timing sequence.
2.3.4 Configure SWS Pull-up to Avoid MCU Errors
Telink MCU uses the SWS (Single Wire Slave) pin for debugging and firmware burning.
In final application code, the state of SWS is shown as below:
1. Set as SWS function rather than general GPIO.
2. Set ie to 1 to enable input so as to receive commands from EVK to operate MCU.
3. B
oth “oe” and “dataO” are set to 0.
The settings above may bring a risk: since SWS is in float state, large jitter of system
power (e.g. transient current may approach 100mA when IR command is sent) may lead
to incorrect command reception and firmware malfunction.
This problem can be solved by enabling internal 1M pull-up resistor for SWS to change
its float state.
For 5316, SWS is multiplexed with GPIO_PC7. Enable the 1M pull-up resistor for PC7 in
the “drivers/5316/gpio_default.h”.
#ifndef
PULL_WAKEUP_SRC_PC7
#define
PULL_WAKEUP_SRC_PC7
PM_PIN_PULLUP_1M
// SWS pullup
#endif