主题中讨论的其他器件: AM2431、 SysConfig
工具/软件:
尊敬的 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 ®_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 ®_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
此致、