Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_43676597
arduino-esp32
提交
908ab068
A
arduino-esp32
项目概览
weixin_43676597
/
arduino-esp32
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
arduino-esp32
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
908ab068
编写于
2月 12, 2023
作者:
R
Rodrigo Garcia
提交者:
GitHub
2月 12, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Sets correct code for UART baud rate detection
上级
b31c9361
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
13 addition
and
13 deletion
+13
-13
cores/esp32/esp32-hal-uart.c
cores/esp32/esp32-hal-uart.c
+13
-13
未找到文件。
cores/esp32/esp32-hal-uart.c
浏览文件 @
908ab068
...
...
@@ -615,7 +615,8 @@ void log_print_buf(const uint8_t *b, size_t len){
*/
unsigned
long
uartBaudrateDetect
(
uart_t
*
uart
,
bool
flg
)
{
#ifndef CONFIG_IDF_TARGET_ESP32S3
// Baud rate detection only works for ESP32 and ESP32S2
#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2
if
(
uart
==
NULL
)
{
return
0
;
}
...
...
@@ -679,6 +680,8 @@ void uartStartDetectBaudrate(uart_t *uart) {
//hw->conf0.autobaud_en = 0;
//hw->conf0.autobaud_en = 1;
#elif CONFIG_IDF_TARGET_ESP32S3
log_e
(
"ESP32-S3 baud rate detection is not supported."
);
return
;
#else
uart_dev_t
*
hw
=
UART_LL_GET_HW
(
uart
->
num
);
hw
->
auto_baud
.
glitch_filt
=
0x08
;
...
...
@@ -694,7 +697,8 @@ uartDetectBaudrate(uart_t *uart)
return
0
;
}
#ifndef CONFIG_IDF_TARGET_ESP32C3 // ESP32-C3 requires further testing - Baud rate detection returns wrong values
// Baud rate detection only works for ESP32 and ESP32S2
#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2
static
bool
uartStateDetectingBaudrate
=
false
;
...
...
@@ -707,22 +711,14 @@ uartDetectBaudrate(uart_t *uart)
if
(
!
divisor
)
{
return
0
;
}
// log_i(...) below has been used to check C3 baud rate detection results
//log_i("Divisor = %d\n", divisor);
//log_i("BAUD RATE based on Positive Pulse %d\n", getApbFrequency()/((hw->pospulse.min_cnt + 1)/2));
//log_i("BAUD RATE based on Negative Pulse %d\n", getApbFrequency()/((hw->negpulse.min_cnt + 1)/2));
#ifdef CONFIG_IDF_TARGET_ESP32C3
//hw->conf0.autobaud_en = 0;
#elif CONFIG_IDF_TARGET_ESP32S3
#else
uart_dev_t
*
hw
=
UART_LL_GET_HW
(
uart
->
num
);
hw
->
auto_baud
.
en
=
0
;
#endif
uartStateDetectingBaudrate
=
false
;
// Initialize for the next round
unsigned
long
baudrate
=
getApbFrequency
()
/
divisor
;
//log_i("APB_FREQ = %d\nraw baudrate detected = %d", getApbFrequency(), baudrate);
static
const
unsigned
long
default_rates
[]
=
{
300
,
600
,
1200
,
2400
,
4800
,
9600
,
19200
,
38400
,
57600
,
74880
,
115200
,
230400
,
256000
,
460800
,
921600
,
1843200
,
3686400
};
...
...
@@ -741,7 +737,11 @@ uartDetectBaudrate(uart_t *uart)
return
default_rates
[
i
];
#else
#ifdef CONFIG_IDF_TARGET_ESP32C3
log_e
(
"ESP32-C3 baud rate detection is not supported."
);
#else
log_e
(
"ESP32-S3 baud rate detection is not supported."
);
#endif
return
0
;
#endif
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录