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.

RTOS|AM437x PRU如何直接访问GPO



我准备用PRU直接访问gpo[10],对应GPIO4_16(AD21),该管脚连接了LED。

PRU程序如下:

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

volatile register uint32_t __R30;
volatile register uint32_t __R31;

void main(){
	volatile uint32_t gpio;

	/* Clear SYSCFG[STANDBY_INIT] to enable OCP master port */
	CT_CFG.SYSCFG_bit.STANDBY_INIT = 0;

	/* Toggle GPO pins TODO: Figure out which to use */
	gpio = 0x0400;

	/* TODO: Create stop condition, else it will toggle indefinitely */
	while(1){
		__R30 ^= gpio;
		__delay_cycles(100000000);
	}

	/* Halt the PRU core */
	__halt();
}

编译后得到PRO_XX.hex的array数组,将其拷贝A9程序中生成PRU_LED_Bin.h,在A9中使用如下代码装载:

PRUICSS_Config  *pruIcssCfg;
		int32_t ret  = PRUICSS_socGetInitCfg(&pruIcssCfg);
		if (ret  == PRUICSS_RETURN_SUCCESS)
		{
			pruIcss0Handle = PRUICSS_create((PRUICSS_Config*)pruIcssCfg,1);
			PRUICSS_pruDisable(pruIcss0Handle,0);
			PRUICSS_pruDisable(pruIcss0Handle,1);
			ret = PRUICSS_setPRUBuffer(pruIcss0Handle, 0, (Uint32*)PRU_LED_Firmware, sizeof(PRU_LED_Firmware));
			ret = PRUICSS_setPRUBuffer(pruIcss0Handle, 1, (Uint32*)PRU_LED_Firmware, sizeof(PRU_LED_Firmware));
			if (ret==0)
			{
				ret = PRUICSS_pruExecProgram(pruIcss0Handle, 0);
				ret = PRUICSS_pruExecProgram(pruIcss0Handle, 1);
			}
			PRUICSS_pruEnable(pruIcss0Handle,0);
			PRUICSS_pruEnable(pruIcss0Handle,1);
		}

执行后,对应的LED没有反应,如果直接在A9程序中对GPIO操作则LED正常闪烁。请问有可能是哪个环节的问题?如何进行调试?