I read your last email with attention by still I can’t understad why my code is not working. I a few words:
The code works when properly when I comment the line " WBS r31.t15 //Wait til GPIO-15-in is high… P9_24"
PINMUX DTS:
/dts-v1/;
/plugin/;
/ {
compatible = “ti,beaglebone”, “ti,beaglebone-black”;
/* identification */
part-number = “BB-BONE-W”;
version = “00A0”;
exclusive-use = “P9.24”;
fragment@0 {
target = <&am33xx_pinmux>;
overlay {
mygpio: pinmux_mygpio{
pinctrl-single,pins = <
0x184 0x36 /* P9 24 pr1_pru0_pru_r31_16.GPIO0_15: | PULLUP | MODE6 | INPUT */
;
};
};
};
fragment@1 {
target = <&ocp>;
overlay {
test_helper: helper {
compatible = “bone-pinmux-helper”;
pinctrl-names = “default”;
pinctrl-0 = <&mygpio>;
status = “okay”;
};
};
};
fragment@2{
target = <&pruss>;
overlay {
status = “okay”;
};
};
};
PIN MUX STATUS:
cat /sys/kernel/debug/pinctrl/44e10800.pinmux/pins | grep “pin 97”
pin 97 (44e10984) 00000036 pinctrl-single
UNAME +DIST:
uname -a
Linux don-t001 3.8.13-bone30 #1 SMP Thu Nov 14 11:19:20 UTC 2013 armv7l armv7l armv7l GNU/Linux
cat /etc/issue
Ubuntu 12.04.3 LTS \n \l
ASM CODE:
.origin 0
.entrypoint START
#define PRU0_ARM_INTERRUPT 19
#define AM33XX
#define GPIO1 0x4804c000
#define GPIO_CLEARDATAOUT 0x190
#define GPIO_SETDATAOUT 0x194
START:
//Enable OCP master port
LBCO r0, C4, 4, 4
CLR r0, r0, 4 // Clear SYSCFG[STANDBY_INIT] to enable OCP master port
SBCO r0, C4, 4, 4
MOV r1, 1000 //# cycles
INPUTTEST:
WBS r31.t15 //Wait til GPIO-15-in is high… P9_24
SUB r1, r1, 1 //Subtract from counter
QBNE INPUTTEST, r1, 0 //Loop if counter not at zero
// Send notification to Host for program completion
MOV R31.b0, PRU0_ARM_INTERRUPT+16
MOV r1, 0
HALT
INIT PROGRAM USING PyPRUSS:
#!/usr/bin/python
‘’’ ddr_write.py - Finds the DDR address and size, passes that info to the PRU0
data memory, executes a program and reads back data from the first and last banks’‘’
import pypruss
import mmap
import struct
pypruss.modprobe()
ddr_addr = pypruss.ddr_addr()
ddr_size = pypruss.ddr_size()
print “DDR memory address is 0x%x and the size is 0x%x”%(ddr_addr, ddr_size)
ddr_offset = ddr_addr-0x10000000
ddr_filelen = ddr_size+0x10000000
ddr_start = 0x10000000
ddr_end = 0x10000000+ddr_size
pypruss.init() # Init the PRU
pypruss.open(0) # Open PRU event 0 which is PRU0_ARM_INTERRUPT
pypruss.pruintc_init() # Init the interrupt controller
pypruss.pru_write_memory(0, 0, [ddr_addr, ddr_addr+ddr_size-4]) # Put the ddr address in the first region
pypruss.exec_program(0, “./ddr_write.bin”) # Load firmware “ddr_write.bin” on PRU 0
pypruss.wait_for_event(0) # Wait for event 0 which is connected to PRU0_ARM_INTERRUPT
pypruss.clear_event(0) # Clear the event
pypruss.exit() # Exit PRU
with open(“/dev/mem”, “r+b”) as f: # Open the physical memory device
ddr_mem = mmap.mmap(f.fileno(), ddr_filelen, offset=ddr_offset) # mmap the right area
read_back = struct.unpack(“L”, ddr_mem[ddr_start:ddr_start+4])[0] # Parse the data
print "The first 4 bytes of DDR memory reads "+hex(read_back)
ddr_mem.close() # Close the memory
f.close() # Close the file
No way to read the P9_24 PIN From BBB using PRUSS
May be the WBS does no work as I think … a week working on that and still nothing.