你好:
我用的板子是beagleboneblack,按照TI的PRU Training: Hands-on Labs例子一步步调试LAB 4: Introduction to Linux driver。
1.firmware编译也成功。
2.linux按例子烧到SD卡启动,SD是按照默认系统烧录
3.按例子把对应文件拷贝到文件系统
实际执行时,也没任何提示错误,但对应的LED灯没闪烁。后面我添加了一段全部闪烁代码,对应IO口也没任何反应,不知是哪里出错了,还是缺了什么配置,急切盼望解答!!!
修改后的例子:
#include <stdint.h>
#include <pru_cfg.h>
/*TODO: Include intc.h */
#include <pru_intc.h>
#include "resource_table_1.h"
volatile register uint32_t __R30;
volatile register uint32_t __R31;
/* Defines */
#define PRU1
#define HOST1_MASK (0x80000000)
#define PRU0_PRU1_EVT (16)
/*TODO: Define toggling the BLUE LED */
#define TOGGLE_BLUE (__R30 ^= (1 << 3))
void main(){
volatile uint32_t gpo;
/* Configure GPI and GPO as Mode 0 (Direct Connect) */
CT_CFG.GPCFG0 = 0x0000;
/* Clear GPO pins */
__R30 &= 0xFFFF0000;
/* Spin in loop until interrupt on HOST 1 is detected */
while(1){
#if 1
// TOGGLE_BLUE;
// __delay_cycles(100000000);
gpo = __R30;
gpo ^= 0xF;
__R30 = gpo;
__delay_cycles(100000000); // half-second delay
#else
if (__R31 & HOST1_MASK){
TOGGLE_BLUE;
/* Clear interrupt event */
CT_INTC.SICR = 16; /*TODO: Clear event 16*/;
/* Delay to ensure the event is cleared in INTC */
__delay_cycles(5);
}
#endif
}
}
一位TI芯片的老程序员。