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.

CCS/AM3358: PRU R31 bit 16 issue

Part Number: AM3358

Tool/software: Code Composer Studio

Hi!

I am using AM3358 to capture data from ADC, but _R31 reg bit 16 always zero!

Pinmux configure as follow

         pru_pru_pins: pinmux_pru_pru_pins {   // The PRU pin modes
            pinctrl-single,pins = <
				0x190 0x26 /* ( PIN_INPUT | MUX_MODE5 ) (A13) mcasp0_aclkx.pr1_pru0_pru_r31[0] */
				0x194 0x26 /* ( PIN_INPUT | MUX_MODE5 ) (B13) mcasp0_fsx.pr1_pru0_pru_r31[1] */
				0x198 0x26 /* ( PIN_INPUT | MUX_MODE5 ) (D12) mcasp0_axr0.pr1_pru0_pru_r31[2] */
				0x19c 0x26 /* ( PIN_INPUT | MUX_MODE5 ) (C12) mcasp0_ahclkr.pr1_pru0_pru_r31[3] */
				0x1a0 0x26 /* ( PIN_INPUT | MUX_MODE5 ) (B12) mcasp0_aclkr.pr1_pru0_pru_r31[4] */
				0x1a4 0x26 /* ( PIN_INPUT | MUX_MODE5 ) (C13) mcasp0_fsr.pr1_pru0_pru_r31[5] */
				0x1a8 0x26 /* ( PIN_INPUT | MUX_MODE5 ) (D13) mcasp0_axr1.pr1_pru0_pru_r31[6] */
				0x1ac 0x26 /* ( PIN_INPUT | MUX_MODE5 ) (A14) mcasp0_ahclkx.pr1_pru0_pru_r31[7] */
				0x0f0 0x26 /* ( PIN_INPUT | MUX_MODE5 ) (F17) mmc0_dat3.pr1_pru0_pru_r31[8] */
				0x0f4 0x26 /* ( PIN_INPUT | MUX_MODE5 ) (F18) mmc0_dat2.pr1_pru0_pru_r31[9] */
				0x0f8 0x26 /* ( PIN_INPUT | MUX_MODE5 ) (G15) mmc0_dat1.pr1_pru0_pru_r31[10] */
				0x0fc 0x26 /* ( PIN_INPUT | MUX_MODE5 ) (G16) mmc0_dat0.pr1_pru0_pru_r31[11] */
				0x100 0x26 /* ( PIN_INPUT | MUX_MODE5 ) (G17) mmc0_clk.pr1_pru0_pru_r31[12] */
				0x104 0x26 /* ( PIN_INPUT | MUX_MODE5 ) (G18) mmc0_cmd.pr1_pru0_pru_r31[13] */
				0x038 0x26 /* ( PIN_INPUT | MUX_MODE5 ) (V13) gpmc_ad14.pr1_pru0_pru_r31[14] */
				0x03c 0x26 /* ( PIN_INPUT | MUX_MODE5 ) (U13) gpmc_ad15.pr1_pru0_pru_r31[15] */
				0x1b4 0x26 /* ( PIN_INPUT | MUX_MODE5 ) (D14) xdma_event_intr1.pr1_pru0_pru_r31[16] */
            >;
         };

cat $PINS
pin 109 (44e109b4.0) 00000026 pinctrl-single

if i configure pin 0x1b4 as GPIO in device tree 

0x1b4 0x27

than

echo 20 > /sys/class/gpio/export

and apply 3.3 V to D14 ZCZ ball i read 1 from gpio20/value file

but when i switch pinmux to PRU the result is 0.

Even if i set pinmux to PULLUP mode 0x36 (in devive tree for 0x1b4 pin offset) reading _R31 register return zero

All other 16 bits (_R31[0:15] are just fine) issue only with _R31[16]

Program for PRU is written on C in CCS with PRU compiler 2.1.4

#define DATA            ((uint16_t)(__R31 >> 3)) //Data reg
#define PSYNC		(__R31 & 1 << 0)	 //PSYNC pin
#define VSYNC           (__R31 & 1 << 1)         //VSYNC pin
#define HSYNC		(__R31 & 1 << 2)	//HSYNC pin

while(!VSYNC){}
while(VSYNC)
{
uint16_t* cur = (uint16_t*)imageLoc.cur;
while(!HSYNC){}
while(HSYNC)
{
 while(!PSYNC){}
 *cur = DATA;
 sum += *cur;
 ++cur;
 while(PSYNC){}
}
imageLoc.cur = (void*)cur;
//Handle data transfer
//...

}

So what i'm doing wrong?