Skip to content

Commit ec917c3

Browse files
committed
telink: tl321x: update for SOC version 2
- update to V4.0.4.3 - add pwm module in compilation. - add USB CDC sample in ci build. - use adc_get_code() to fix reading errors. - update to 60m mspi to save power. - clean code for comment code. - update hal_telink in west.yml. Signed-off-by: Haiwen Xia <haiwen.xia@telink-semi.com>
1 parent 46b8269 commit ec917c3

File tree

6 files changed

+35
-21
lines changed

6 files changed

+35
-21
lines changed

.github/workflows/telink-tl321x-build.yaml

+7-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ jobs:
9595
- name: Build TL321X net/openthread/cli
9696
run: |
9797
cd ..
98-
west build -b tl3218x -d build_ot_cli_tl321x zephyr/samples/net/openthread/cli -- -DCONFIG_COMPILER_WARNINGS_AS_ERRORS=y
98+
west build -b tl3218x -d build_ot_cli_tl321x zephyr/samples/net/openthread/cli -- -DCONFIG_COMPILER_WARNINGS_AS_ERRORS=y -DCONFIG_NET_BUF_TX_COUNT=12 -DCONFIG_NET_BUF_RX_COUNT=12
9999
100100
- name: Build TL321X net/openthread/coprocessor in RCP configuration with UART interface
101101
run: |
@@ -107,6 +107,11 @@ jobs:
107107
cd ..
108108
west build -b tl3218x -d build_usb_console_tl321x zephyr/samples/subsys/usb/console -- -DCONFIG_COMPILER_WARNINGS_AS_ERRORS=y
109109
110+
- name: Build TL321x subsys/usb/cdc_acm for USB CDC
111+
run: |
112+
cd ..
113+
west build -b tl3218x -d build_usb_cdc_acm_tl321x zephyr/samples/subsys/usb/cdc_acm -- -DCONFIG_COMPILER_WARNINGS_AS_ERRORS=y
114+
110115
- name: Build TL321X boards/telink/tl321x/basic
111116
run: |
112117
cd ..
@@ -148,6 +153,7 @@ jobs:
148153
cp ../build_ot_cli_tl321x/zephyr/zephyr.bin telink_build_artifacts/tl321x_ot_cli.bin
149154
cp ../build_ot_coprocessor_rcp_uart_tl321x/zephyr/zephyr.bin telink_build_artifacts/tl321x_ot_coprocessor_rcp_uart.bin
150155
cp ../build_usb_console_tl321x/zephyr/zephyr.bin telink_build_artifacts/tl321x_usb_console.bin
156+
cp ../build_usb_cdc_acm_tl321x/zephyr/zephyr.bin telink_build_artifacts/tl321x_usb_cdc_acm.bin
151157
cp ../build_retention_basic_tl321x/zephyr/zephyr.bin telink_build_artifacts/tl321x_retention_basic.bin
152158
cp ../build_ot_echo_client_pm_deep_tl321x/zephyr/zephyr.bin telink_build_artifacts/tl321x_ot_echo_client_pm_retention.bin
153159
cp ../build_crypto_mbedtls_tl321x/zephyr/zephyr.bin telink_build_artifacts/tl321x_mbedtls.bin

drivers/adc/adc_tlx.c

+1-13
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ LOG_MODULE_REGISTER(adc_tlx, CONFIG_ADC_LOG_LEVEL);
2121
#include <adc.h>
2222
#include <zephyr/drivers/pinctrl.h>
2323

24-
#if CONFIG_SOC_RISCV_TELINK_TL321X
25-
#define adc_input_pin_def_e adc_input_pin_e
26-
#endif
27-
2824
/* Set ADC resolution value */
2925
static inline void adc_set_resolution(adc_res_e res)
3026
{
@@ -155,15 +151,7 @@ static signed short adc_tlx_get_code(void)
155151
signed short adc_code;
156152

157153
#if CONFIG_SOC_RISCV_TELINK_TL321X || CONFIG_SOC_RISCV_TELINK_TL721X
158-
extern unsigned char g_adc_rx_fifo_index;
159-
160-
if (g_adc_rx_fifo_index == 0) {
161-
adc_code = reg_adc_rxfifo_dat(g_adc_rx_fifo_index);
162-
g_adc_rx_fifo_index = 1;
163-
} else {
164-
adc_code = reg_adc_rxfifo_dat(g_adc_rx_fifo_index);
165-
g_adc_rx_fifo_index = 0;
166-
}
154+
adc_code = adc_get_code();
167155
#endif
168156
return adc_code;
169157
}

samples/net/openthread/cli/boards/tl3218x.conf

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
1+
# usb
2+
CONFIG_USB_DEVICE_STACK=y
3+
CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n
4+
15
# Telink relative thread features
26
CONFIG_NET_PKT_TXTIME=y
37
CONFIG_NET_PKT_TIMESTAMP=y
48
CONFIG_OPENTHREAD_NUM_MESSAGE_BUFFERS=35
59

6-
CONFIG_OPENTHREAD_THREAD_VERSION_1_1=y
7-
CONFIG_OPENTHREAD_SRP_CLIENT=n
10+
CONFIG_OPENTHREAD_NUM_MESSAGE_BUFFERS=150
11+
CONFIG_IEEE802154_TLX_MAC_FLASH=y
12+
813
CONFIG_OPENTHREAD_JOINER=n
914
CONFIG_OPENTHREAD_LINK_METRICS_SUBJECT=n
1015
CONFIG_OPENTHREAD_BORDER_ROUTER=n
1116
CONFIG_OPENTHREAD_COMMISSIONER=n
12-
CONFIG_OPENTHREAD_PING_SENDER=n
1317
CONFIG_OPENTHREAD_DHCP6_CLIENT=n
1418
CONFIG_OPENTHREAD_DNS_CLIENT=n
1519
CONFIG_OPENTHREAD_SLAAC=n
@@ -22,4 +26,3 @@ CONFIG_OPENTHREAD_COAPS=n
2226
CONFIG_OPENTHREAD_ENABLE_SERVICE=n
2327
CONFIG_OPENTHREAD_CSL_RECEIVE_TIME_AHEAD=480
2428
CONFIG_OPENTHREAD_MAX_CHILDREN=5
25-
CONFIG_IEEE802154_TLX_MAC_FLASH=y
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
* Copyright (c) 2024 Telink Semiconductor
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/ {
8+
chosen {
9+
zephyr,shell-uart = &cdc_acm_uart0;
10+
};
11+
};
12+
13+
&zephyr_udc0 {
14+
cdc_acm_uart0: cdc_acm_uart0 {
15+
compatible = "zephyr,cdc-acm-uart";
16+
};
17+
};

soc/telink/tlsr/telink_tlx/soc.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ void soc_early_init_hook(void)
178178

179179
#if CONFIG_SOC_RISCV_TELINK_TL321X
180180
case CLK_96MHZ:
181-
PLL_192M_CCLK_96M_HCLK_48M_PCLK_48M_MSPI_48M;
181+
PLL_192M_CCLK_96M_HCLK_48M_PCLK_48M_MSPI_64M;
182182
break;
183183
#endif /* CONFIG_SOC_RISCV_TELINK_TL321X */
184184
#if CONFIG_SOC_RISCV_TELINK_TL721X
@@ -251,7 +251,7 @@ void soc_tlx_restore(void)
251251
#endif /* CONFIG_SOC_RISCV_TELINK_TL721X */
252252
#if CONFIG_SOC_RISCV_TELINK_TL321X
253253
case CLK_96MHZ:
254-
PLL_192M_CCLK_96M_HCLK_48M_PCLK_48M_MSPI_48M;
254+
PLL_192M_CCLK_96M_HCLK_48M_PCLK_48M_MSPI_64M;
255255
break;
256256
#endif /* CONFIG_SOC_RISCV_TELINK_TL321X */
257257
#if CONFIG_SOC_RISCV_TELINK_TL721X

west.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ manifest:
239239
- hal
240240
- name: hal_telink
241241
url: https://github.com/telink-semi/hal_telink
242-
revision: 8e116bb74c344c043500425793d76c4d3ae21565
242+
revision: 38c66795ef4a79453330a1aed85d1217843a8d05
243243
path: modules/hal/telink
244244
groups:
245245
- hal

0 commit comments

Comments
 (0)