現在我把A33 UART2 波特率設定為921600, 但是出來波特率是761904.
同時我找到sunxi-uart.c file 裡要改apb2div. 請問那裡設定?
离线
你如何确定是 761904 ?
离线
用logic analyzer 望 output data. 所以知道波特率大約761904.
同時試過把設波特率定為 1500000, 是無問題!!
离线
会不会是逻辑分析仪的最大频率不够?
离线
会不会是逻辑分析仪的最大频率不够?
逻辑分析仪频率應該足夠,因為可看到1500000频率
离线
apb2时钟默认是OSC24M,时钟源应该使用PLL6,修改uboot时钟初始化的代码就行
24000000/16/921600=1.6276,向上取整,实际波特率24000000/16/2=750000,应该是这样
阿黄 说:会不会是逻辑分析仪的最大频率不够?
逻辑分析仪频率應該足夠,因為可看到1500000频率
最近编辑记录 checkout (2019-10-10 00:00:51)
离线
apb2时钟默认是OSC24M,时钟源应该使用PLL6,修改uboot时钟初始化的代码就行
24000000/16/921600=1.6276,向上取整,实际波特率24000000/16/2=750000,应该是这样augyy 说:阿黄 说:会不会是逻辑分析仪的最大频率不够?
逻辑分析仪频率應該足夠,因為可看到1500000频率
https://whycan.cn/files/members/1429/CONFIG_SYS_NS16550_CLK.png
是否直接把CONFIG_SYS_NS16550_CLK 為 (30000000) ?
离线
修改uboot的clock_sun6i.c文件:
void clock_init_uart(void)
{
#if CONFIG_CONS_INDEX < 5
struct sunxi_ccm_reg *const ccm =
(struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
/* uart clock source is apb2 */
writel(APB2_CLK_SRC_OSC24M| //这里改为APB2_CLK_SRC_PLL6,从内部pll6时钟分频
APB2_CLK_RATE_N_1|
APB2_CLK_RATE_M(1),
&ccm->apb2_div);
离线
只找到board.c 同 serial_tegra2.c 文件
是否改setup_uart(..) function
reg = NVRM_PLLP_FIXED_FREQ_KHZ * 1000 / NV_DEFAULT_DEBUF_BAUD / 16 的
16 為 20 or 其他?
最近编辑记录 augyy (2019-10-10 17:12:43)
离线
你uboot用的哪个版本?看看时钟初始化部分,改改试试
离线
我用u-boot-2011.09 版本的. 同sun8iw5p1.h
最近编辑记录 augyy (2019-10-17 17:18:49)
离线
胸弟,你看!!摊手.jpg
APB2默认时钟源是24MHz.你要改成PLL_PERIPH
u-boot-2011.09/arch/arm/cpu/armv7/sun8iw5/clock.c中,函数sunxi_clock_set_corepll(xxx)进行了时钟初始化...
在这里修改:
int sunxi_clock_set_corepll(int frequency, int core_vol)
{
unsigned int reg_val;
unsigned int i;
struct core_pll_freq_tbl pll_factor;
//检查时钟是否合法,为0或者超过2G
if(!frequency)
{
//默认频率
frequency = 408;
}
else if(frequency < 24)
{
frequency = 24;
}
//切换到24M
reg_val = readl(CCM_CPU_L2_AXI_CTRL);
reg_val &= ~(0x03 << 16);
reg_val |= (0x01 << 16);
writel(reg_val, CCM_CPU_L2_AXI_CTRL);
//延时,等待时钟稳定
for(i=0; i<0x400; i++);
//调整时钟频率
clk_get_pll_para(&pll_factor, frequency);
//回写PLL1
reg_val = readl(CCM_PLL1_CPUX_CTRL);
reg_val &= ~((0x03 << 16) | (0x1f << 8) | (0x03 << 4) | (0x03 << 0));
reg_val |= (pll_factor.FactorP << 16) | (pll_factor.FactorN<<8) | (pll_factor.FactorK<<4) | (0 << 0) ;
writel(reg_val, CCM_PLL1_CPUX_CTRL);
//延时,等待时钟稳定
#ifndef CONFIG_A67_FPGA
do
{
reg_val = readl(CCM_PLL1_CPUX_CTRL);
}
while(!(reg_val & (0x1 << 28)));
#endif
//修改AXI,AHB,APB分频
clk_set_divd();
//切换时钟到COREPLL上
reg_val = readl(CCM_CPU_L2_AXI_CTRL);
reg_val &= ~(0x03 << 16);
reg_val |= (0x02 << 16);
writel(reg_val, CCM_CPU_L2_AXI_CTRL);
//修改apb2时钟源,自己添加。。
return 0;
}
下面这个顺便也要改一下,改成600
/*
************************************************************************************************************
*
* function
*
* 函数名称:
*
* 参数列表:
*
*
*
* 返回值 :
*
* 说明 :
*
*
************************************************************************************************************
*/
int sunxi_clock_get_apb2(void)
{
//return 24;
return 600;//改成600
}
最近编辑记录 checkout (2019-10-17 21:35:23)
离线
出到921600波特率了. 謝謝!!
离线
出到921600波特率了. 謝謝!!
请问怎么做到的呢?
离线
augyy 说:出到921600波特率了. 謝謝!!
请问怎么做到的呢?
Linus-SDK/dragonboard/brandy/u-boot-2011.09/arch/arm/cpu/armv7/sun8iw5/clock.c
int sunxi_clock_set_corepll(xxx) 加 :
reg_val = readl(CCM_APB2_CLK_CTRL);
reg_val &= ~((0x03 << 24) | (0x.03 << 16) | (0x1f << 0);
reg_val |= (0x02 << 24) | (0x07 << 0);
writel(reg_val, CCM_APB2_CLK_CTRL);
int sunxi_clock_get_apb2(void) 改:
//return 24;
return 600;
之後起 brandy/ 行 ./build.sh -p sun8iw5p1
离线
使用的是u-boot-2014.07,这个要怎么改呢
离线
这个只要修改U-BOOT,LINUX系统中不需要修改?
离线
V3S 改后通讯1分钟不到,就中断了void clock_init_uart(void)
{
#if CONFIG_CONS_INDEX < 5
struct sunxi_ccm_reg *const ccm =
(struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
/* uart clock source is apb2 */
writel(APB2_CLK_SRC_OSC24M| //这里改为APB2_CLK_SRC_PLL6,从内部pll6时钟分频
APB2_CLK_RATE_N_1| //这里预分频不变
APB2_CLK_RATE_M(1),
&ccm->apb2_div);
离线
有没有在V3S上成功的?
------------修改后报错--------------------
[ 12.899663] serial8250: too much work for irq37
[ 12.904480] serial8250: too much work for irq37
[ 12.909318] serial8250: too much work for irq37
[ 12.914110] serial8250: too much work for irq37
[ 12.918913] serial8250: too much work for irq37
[ 12.923701] serial8250: too much work for irq37
[ 12.928497] serial8250: too much work for irq37
[ 12.933284] serial8250: too much work for irq37
[ 12.938079] serial8250: too much work for irq37
[ 12.942866] serial8250: too much work for irq37
离线
有没有在V3S上成功的?
------------修改后报错--------------------
[ 12.899663] serial8250: too much work for irq37
[ 12.904480] serial8250: too much work for irq37
[ 12.909318] serial8250: too much work for irq37
[ 12.914110] serial8250: too much work for irq37
[ 12.918913] serial8250: too much work for irq37
[ 12.923701] serial8250: too much work for irq37
[ 12.928497] serial8250: too much work for irq37
[ 12.933284] serial8250: too much work for irq37
[ 12.938079] serial8250: too much work for irq37
[ 12.942866] serial8250: too much work for irq37
问题解决了吗? 遇到同样的问题
离线
@路人
求问,该问题解决了吗?我也遇到了同样问题
离线