TI中文支持网
TI专业的中文技术问题搜集分享网站

am335x pru Soft-UART 硬件设备初始化问题

hi,我最近在弄有关pru虚拟串口的东西,按照这上面http://processors.wiki.ti.com/index.php/Soft-UART_Implementation_on_AM335X_PRU_-_Software_Users_Guide#Soft-UART_Configuration_Options  我把驱动移植到了我的内核里面,但现在对硬件设备管脚等的一些初始化不知怎么搞,我的设备接线如下图:

最左边是MCASP0_AXR0,MCASP0_AXR2(图左边没截全)。。。我在board-am335xevm.c里应该怎样初始化呢?

还有,drivers/serial/am335x_pru_suart/am335x_suart_board.h这个文件我需要修改为我对应的gpio管脚么?

望解答,谢谢。

Steven Liu1:

你给的链接中,不是已经告诉了在其他的文件中需要改什么东西了吗?因为是使用的mcasp模块,board-am335xevm.c中应该是需要初始化mcasp对应的管脚信息的。

Dendi:

回复 Steven Liu1:

那网页哪里没有讲到board-am335xevm.c里面该如何配置吧,还有我加载完驱动模块后,提示如下:

/lib/modules # insmod suart_emu.ko

[   26.507110] am33xx_pruss_uart am33xx_pruss_uart.1: no clock available: mcasp0_ick

不知这是什么原因呢?

Dendi:

回复 Steven Liu1:

加载内核后卡在了ti_am335x_pru_suart.c这里:

#ifdef CONFIG_AM33XX_SUART_MCASP0    

 clk_mcasp0_ick = clk_get(NULL, "mcasp0_ick");   

  if (IS_ERR(clk_mcasp0_ick)) {        

 dev_err(&pdev->dev, "no clock available: mcasp0_ick\n");  

       err = -ENODEV;         goto probe_exit_clk_mcasp0_1;     }

    soft_uart->clk_mcasp = clk_get(NULL, "mcasp0_fck");  

   if (IS_ERR(soft_uart->clk_mcasp)) {  

       dev_err(&pdev->dev, "no clock available: mcasp\n");

        err = PTR_ERR(soft_uart->clk_mcasp);

        soft_uart->clk_mcasp = NULL;

       //  goto probe_exit_clk_mcasp0_2;     }

    soft_uart->clk_freq_mcasp = clk_get_rate(clk_mcasp0_ick);  

   clk_enable(soft_uart->clk_mcasp);

 #endif

#ifdef CONFIG_AM33XX_SUART_MCASP1    

 clk_mcasp1_ick = clk_get(NULL, "mcasp1_ick");    

 if (IS_ERR(clk_mcasp1_ick)) {        

 dev_err(&pdev->dev, "no clock available: mcasp1_ick\n");

         err = -ENODEV;

       //  goto probe_exit_clk_mcasp1_1;     }

    soft_uart->clk_mcasp1 = clk_get(NULL, "mcasp1_fck");

    if (IS_ERR(soft_uart->clk_mcasp1))

 {         dev_err(&pdev->dev, "no clock available: mcasp1\n");

 …..

打印信息:

 # ismod suart_emu.ko

 [  631.034484] am33xx_pruss_uart am33xx_pruss_uart.1: no clock available: mcasp0_ick

 [  631.042846] am33xx_pruss_uart am33xx_pruss_uart.1: no clock available: mcasp

[  631.050537] am33xx_pruss_uart am33xx_pruss_uart.1: no clock available: mcasp1

搞了好多天了,望给点建议,谢谢。

 

Dendi:

回复 Steven Liu1:

是在没办法,最后选用了那网页里面的内核,但移植后还是出错了:

/ # insmod suart_emu.ko

 [  143.640045] am33xx_pruss_uart am33xx_pruss_uart.1: fw size 3912. downloading..

. [  143.647796] Configuring McASP0

 [  143.660064] ENABLING PRU0

 [  143.671783] ENABLING PRU1

[  143.674560] PROGRAM ID PRU0

 [  143.677673] pru_set_ram_data_for, uart_num : 3 pru_num:0 mcasp_num:1 tx_ser:1 rx_ser:0

 [  143.686035] Unable to handle kernel NULL pointer dereference at virtual address 00000184

[  143.694580] pgd = cfbd4000

[  143.697418] [00000184] *pgd=8fab3831, *pte=00000000, *ppte=00000000

 [  143.704101] Internal error: Oops: 817 [#1]

 [  143.708404] Modules linked in: suart_emu(+)

 [  143.712829] CPU: 0    Not tainted  (3.2.0-g41117e1-dirty #7)

 [  143.718811] PC is at pru_set_ram_data_for+0x274/0x2a4 [suart_emu]

[  143.725250] LR is at console_unlock+0x170/0x1f8 [  143.730010] pc : [<bf0002ec>]    lr : [<c003d4b4>]    psr: 60000013

[  143.730010] sp : cf98dc58  ip : cf98db50  fp : cf98dcc4 [  143.742095] r10: 4803c204  r9 : bf003bd4  r8 : 00000000

 [  143.747589] r7 : 4803c280  r6 : 4803c180  r5 : d0a80000  r4 : bf003b7cSegmentation fault

望解答,谢谢!

Dendi:

回复 Steven Liu1:

串口设备节点终于出来了,但这里的ttyS0 、1、2、3分别对应的硬件引脚是哪个呢?如果要改,在哪里改呢?谢谢!

/ # insmod suart_emu.ko

[   68.428436] am33xx_pruss_uart am33xx_pruss_uart.1: fw size 3912. downloading…

 [   68.436187] Configuring McASP0

 [   68.439453] Configuring McASP1

 [   68.451629] ENABLING PRU0

[   68.463409] ENABLING PRU1

 [   68.466186] PROGRAM ID PRU0

 [   68.469146] pru_set_ram_data_for, uart_num : 3 pru_num:0 mcasp_num:1 tx_ser:1 rx_ser:0

 [   68.477478] PROGRAM ID PRU1

 [   68.480407] pru_set_ram_data_for, uart_num : 1 pru_num:1 mcasp_num:0 tx_ser:2 rx_ser:0

 [   68.488769] pru_set_ram_data_for, uart_num : 2 pru_num:1 mcasp_num:0 tx_ser:3 rx_ser:1

 [   68.497100] RUN PRU0 [   68.499420] RUN PRU1

 [   68.501739] am33xx_pruss_uart.1: ttySU0 at MMIO 0x4a310000 (irq = 24) is a suart_tty

[   68.513885] am33xx_pruss_uart.1: ttySU1 at MMIO 0x4a310000 (irq = 25) is a suart_tty

 [   68.522827] am33xx_pruss_uart.1: ttySU2 at MMIO 0x4a310000 (irq = 20) is a suart_tty

 [   68.534210] am33xx_pruss_uart.1: ttySU3 at MMIO 0x4a310000 (irq = 21) is a suart_tty

 [   68.543029] am33xx_pruss_uart am33xx_pruss_uart.1: am33xx_pruss_uart device registered(pru_clk=192000000, asp_clk=100000000)

Dendi:

回复 Dendi:

已解决!在内核源码的clock33xx_data.c的static struct omap_clk am33xx_clks[] 结构体中加入下面语句:

CLK(NULL,       "mcasp0_ick",           &mcasp0_ick,    CK_AM33XX),

 CLK(NULL,       "mcasp0_fck",           &mcasp0_fck,    CK_AM33XX),  

CLK(NULL,       "mcasp1_ick",           &mcasp1_ick,    CK_AM33XX),  

CLK(NULL,       "mcasp1_fck",           &mcasp1_fck,    CK_AM33XX),

赞(0)
未经允许不得转载:TI中文支持网 » am335x pru Soft-UART 硬件设备初始化问题
分享到: 更多 (0)