Hi,
for my project i use AM3359 (with kernel 3.2) and internal PRU1. I have write a code with CCS6 in C. This is my code (GPIO.bin):
#include <stdint.h>
#include <pru_cfg.h>
volatile register uint32_t __R30;
/* Mapping Constant table register to variable */
volatile pruCfg CT_CFG __attribute__((cregister("C4_CFG", near), peripheral));
void main(){
volatile uint32_t gpo;
/* GPI Mode 0, GPO Mode 0 */
CT_CFG.GPCFG0 = 0;
/* Clear GPO pins */
gpo = 0x0000;
unsigned char i = 0;
while( i < 1000)
{
gpo = __R30;
gpo ^= 0xF;
__R30 = gpo;
__delay_cycles(100000000); // half-second delay
i ++;
}
__halt();
}
After 1000 cicle the program execute __halt() command. For run my program from linux i compile and run this code:
#define PRU_NUM 1 // Driver header file #include <prussdrv.h> #include <pruss_intc_mapping.h>
/* Then, initialize the interrupt controller data */
tpruss_intc_initdata pruss_intc_initdata = PRUSS_INTC_INITDATA;
/* Initialize the PRU */
prussdrv_init ();
/* Get the interrupt initialized */
prussdrv_pruintc_init(&pruss_intc_initdata)
/* Execute example on PRU0 where first argument is the PRU# and second is the assembly to execute*/
prussdrv_exec_program (PRU_NUM, "./GPIO.bin");
/* Wait until PRU0 sends the interrupt*/
printf("Wait _halt command\n");
prussdrv_pru_wait_event (PRU_EVTOUT_0);
/* Clear the interrupt*/
prussdrv_pru_clear_event (PRU0_ARM_INTERRUPT);
The problem is that the program blokcsto "printf(Wait _halt command\n)." This program waits for the halt command. How can i resolve the problem?
Thanks
Fabio