AM5728 PRU问题 - AM57x - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 2808|回复: 0

[未解决] AM5728 PRU问题

[复制链接]

12

主题

32

帖子

186

积分

注册会员

Rank: 2

积分
186
发表于 2018-11-1 17:47:42 | 显示全部楼层 |阅读模式
您好,之前看PRU资料,GPIO的操作都是对R30寄存器进行操作的,阅读创龙现在的代码未发现对R30寄存器进行操作,是哪里进行了映射了吗?

这样如何到R30寄存器的。

#include <stdint.h>
#include <pru_cfg.h>
#include "resource_table_empty.h"
#include "dra7_pinctrl.h"

/* LED port address */
#define GPIO3_BASE_ADDR             0x48057000
#define GPIO_OE_OFFSET              0x134
#define GPIO_CLRDATAOUT_OFFSET        0x190
#define GPIO_SETDATAOUT_OFFSET      0x194

//volatile register uint32_t __R30;

volatile pruCfg CT_CFG __attribute__((cregister("PRU_CFG", near), peripheral));

int main(void) {

    uint32_t i;
    uint32_t value;

    /* GPI Mode 0, GPO Mode 0 */
    CT_CFG.GPCFG0 = 0;
    /* Clear SYSCFG[STANDBY_INIT] to enable OCP master port */
    CT_CFG.SYSCFG_bit.STANDBY_INIT = 0;

    uint32_t led_set_addr;
    uint32_t led_clr_addr;
    uint32_t gpio3_reg_oe_addr;

    led_set_addr = GPIO3_BASE_ADDR + GPIO_SETDATAOUT_OFFSET;
    led_clr_addr = GPIO3_BASE_ADDR + GPIO_CLRDATAOUT_OFFSET;
    gpio3_reg_oe_addr = GPIO3_BASE_ADDR + GPIO_OE_OFFSET;

    *(uint32_t*)led_clr_addr |= 1 << 19; //turn down LED0 (GPIO3_19)
    *(uint32_t*)gpio3_reg_oe_addr &= ~(1<<21 | 1<< 20 | 1<<19); // gpio3_19/gpio3_20/gpio3_21 as output pin

    /* pinmux configuration */
    *(uint32_t*)CTRL_CORE_PAD_VIN1A_D15_ADDR = (PIN_OUTPUT_PULLUP | MUX_MODE14);
    *(uint32_t*)CTRL_CORE_PAD_VIN1A_D16_ADDR = (PIN_OUTPUT_PULLUP | MUX_MODE14);
    *(uint32_t*)CTRL_CORE_PAD_VIN1A_D17_ADDR = (PIN_OUTPUT_PULLUP | MUX_MODE14);

    while(1) {

            for (i = 0; i < 3; i++) {
                value = 1 << (i + 19);
                *(uint32_t*)led_set_addr |= value;
                __delay_cycles(100000000); // half-second delay
                *(uint32_t*)led_clr_addr |= value;
                __delay_cycles(100000000); // half-second delay
            }
    }
     /* Halt the PRU core - shouldn't get here */
     //__halt();
}



回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号

GMT+8, 2024-3-29 17:01 , Processed in 0.036324 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

快速回复 返回顶部 返回列表