This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] AM2612:在 syscfg 中将 PRU_GPIO 链接到 GPIOx 时如何初始化 PRU0 GPIO。

Guru**** 2449930 points
Other Parts Discussed in Thread: AM2612, AM2431, SYSCONFIG

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1495890/am2612-how-to-initialize-pru0-gpio-when-link-pru_gpio-to-gpiox-in-syscfg

器件型号:AM2612
主题中讨论的其他器件: AM2431SysConfig

工具/软件:

尊敬的 TI 专家:

我正在处理从 AM2431到 AM2612的代码移植问题。 CPU 是唯一更改的器件、其他外设保持不变。

当我使用与 GPIOx 链接的 PRU0_GPIOx 来检测 ADC 输出时、无法获得 预期结果。 ADC 通道输出为固定状态、不受 ADC 输入的影响。

 AM2431上运行相同的 PRU 代码。 比较差异、 PRU_GPIx 多路复用器配置从 PRU_GPOx 更改为 GPIOx。

在 AM2431上、PRU 代码可轻松读取 R31寄存器并获取 ADC 结果。 但在 AM2612上、 我认为必须在 PRU 或 R5F 上进行 GPIO 初始化。

我在 AM2612 SDK 和文档中查找过、没有这方面的示例。 请提供一个示例吗?

我的环境是:

SDK: mcu_plus_sdk_am261x_10_00_01_10

syscfg: SYSCONFIG_1.23.0

TI-CGT-armllvm_4.0.1.LTS

联系方式1281.

PRU 汇编代码

OFFSET_RAM_DI_STATUS            .set    8

; CCS/makefile specific settings
    .retain     ; Required for building .out with assembly file
    .retainrefs ; Required for building .out with assembly file

    .global     main
    .sect       ".text"

    .asg        r1,       REG_TEMP_1
    .asg        r2.w0,    DATA_OLD
    .asg        r2.w2,    DATA_NEW

IFNE   .set  QBNE  ; if (REG1==OP(255))   then ... else branch to LABEL ( if (!(REG1!=OP(255)) )
IFEQ   .set  QBEQ  ; if (REG1!=OP(255))   then ... else branch to LABEL ( if (!(REG1==OP(255)) )
IFLT   .set  QBLE  ; if (REG1<OP(255))    then ... else branch to LABEL ( if (!(REG1>=OP(255)) )
IFLE   .set  QBLT  ; if (REG1<=OP(255))   then ... else branch to LABEL ( if (!(REG1>OP(255))  )
IFGT   .set  QBGE  ; if (REG1>OP(255))    then ... else branch to LABEL ( if (!(REG1<=OP(255)) )
IFGE   .set  QBGT  ; if (REG1>=OP(255))   then ... else branch to LABEL ( if (!(REG1<OP(255))  )
IFBS   .set  QBBC  ; if (REG1(OP(31))==1) then ... else branch to LABEL ( if (!(REG1(OP(31))==0)) )
IFBC   .set  QBBS  ; if (REG1(OP(31))==0) then ... else branch to LABEL ( if (!(REG1(OP(31))==1)) )

main:
;----------------------------------------------------------------------------
;   Clear the register space
;   Before begining with the application, make sure all the registers are set to 0.
;----------------------------------------------------------------------------
        ZERO    &r0, 120

;----------------------------------------------------------------------------
;   Constant Table Entries Configuration
;----------------------------------------------------------------------------

; PRU_ICSSG DRAM (local)      0000_0n00h, nnnn = c24_blk_index[3:0]  (not clear if 4 or 8bits are configurable)
        LDI     REG_TEMP_1, 0x0000                          ; c24 points to begin of DATA RAM
        SBCO    &REG_TEMP_1, c11, 0x20, 1 ; c11+0x20 => ICSSG_PRU_CTBIR0, bit7..0 => c24_blk_index;  (refman 6.4.14.1.6, 6.4.5.2.1)


;----------------------------------------------------------------------------
;   SECTION: IDLE
;   PRU enters the program, executes intialization and then stays in this
;   section until any further command from r5f
;----------------------------------------------------------------------------
idle:
;        WBS    r31, 31 ; wait until host irq 1 is set
;        LDI    REG_TEMP_1, 22
;        SBCO   &REG_TEMP_1, c0, 0x24, 4 ; clear host interrupt (write interrupt in ICSS_INTC_STATUS_CLR_INDEX_REG)

getdata:
        mov    DATA_NEW, r31.w0 ; Read bit0~15 from r31 register to get value of all PRU pins and store into r2.

        SBCO   &DATA_NEW, c24, OFFSET_RAM_DI_STATUS, 2 ; memcpy(c24+offset, &DATA_NEW, 2bytes)
;        WBC    r31, 30 ; check if host irq 0 is clear, generate irq 16 to host for inform new data.
;        LDI    r31.b0, (0x20 + 0) ; set bit5 of R31 to generate interrupt 16 to host.
        JMP    idle

此致、

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Yang:

    AM261x SDK 缺少 PRU IO 示例、这是一个已知问题、将在下一个 SDK 版本中修复。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    同时、有关权变措施、请按照以下常见问题解答获取 PRU IO 示例工程:

    在 AM261x MCU+ SDK 中找不到 PRU IO 工程
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    感谢您的答复。 实际上、我已经收到 PRU IO 示例、但其中不包括 PRU GPIO 初始化部分、无法解决我的问题。

    R5F GPIO 初始化不能涵盖 PRU GPIO 启动。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    根据我们的讨论、pinmux 配置可通过 SysConfig 完成。

    如果您有任何其他问题、请告诉我。