主题中讨论的其他器件:SysConfig
工具与软件:
您好!
我需要使用 PRU 驱动 BeagleBone Black 的 P8_8 ~ GPIO2_3。 我将按照第一个示例"3.5.1.2"中的设置。 实验1:使用 PRU GPO切 换 LED" 。 我已经添加了以下 CONTROL_MODULE 寄存器更改、以将 pinmux 配置为 GEL 脚本的 PRU_PINMUX_Config ()中的模式7。 我确定了范围并证明、在 Cortex-A8上运行 GEL 脚本时、上拉更改是有效的。
// CONTROL_MODULE register address is 0x44E1000, pin offset for P8_8 is 0x894
*((unsigned int*) 0x44E10894) = AM335X_PIN_OUTPUT | 7;
*((unsigned int*) 0x44E10894) = AM335X_PIN_OUTPUT_PULLUP | AM335X_PULL_UP;
下面是加载到 PRU0上的代码、如果使用 Code Composer Studio 进行调试、该代码无法切换 P8_8。 我还尝试了使用完整的 beaglebonebrack.gel 来初始化 所有内容、方法是先启动 AM335x_Beagconstrica Black_Initialization ()、然后再次启动 PRU_ICSS_Init ()来在顶部应用新的 pinmux 设置并停止 PRU、这样我就可以断开 Cortex-A8连接到 PRU0并加载下面编译的代码。
如果我想 像在上面的 SDK 示例中那样使用 IDE 进行调试、是否有人可以帮助了解在允许 PRU 通过 OCP 控制此 GPIO 时缺少什么内容?
提前感谢您!
#include <stdint.h>
#include <pru_cfg.h>
#define GPIO2 0x481AC000
#define GPIO_CLEARDATAOUT 0x190/4 // Write 1 here to set a given bit
#define GPIO_SETDATAOUT 0x194/4 // A 1 here clears the corresponding bit
void main(void)
{
// Clear SYSCFG[STANDBY_INIT] to enable OCP master port
CT_CFG.SYSCFG_bit.STANDBY_INIT = 0;
/* No effect
* // unlock the BOOT_CFG space kick mechanism
* *(volatile unsigned int *)(0x02620038) = 0x83E70B13; // BOOTCFG_KICK0
* *(volatile unsigned int *)(0x0262003C) = 0x95A4F1E0; // BOOTCFG_KICK1
*/
uint32_t *gpio2 = (uint32_t *)GPIO2;
while(1) {
gpio2[GPIO_CLEARDATAOUT] = (0x1<<3);
__delay_cycles(10000);
gpio2[GPIO_SETDATAOUT] = (0x1<<3);
__delay_cycles(10000);
}
// Halt the PRU core
__halt();
}

