Are you sure /dev/mem isn't there?  I think it's required.

bone$ *ls -ls /dev/mem*
0 crw-r----- 1 root kmem 1, 1 Apr 14 09:11 /dev/mem
bone$ *groups*
debian adm *kmem* dialout cdrom floppy audio dip video plugdev users 
systemd-journal input bluetooth netdev i2c remoteproc eqep pwm cloud9ide 
xenomai weston-launch tisdk docker iio spi admin gpio

You should be in the kmem group by default so sudo isn't needed.

--Mark

On Thursday, April 29, 2021 at 3:17:16 PM UTC-4 [email protected] 
wrote:

> Here's the code too.   Sorry, should have included it.
>
> int fd;
>     printf("Setting up pru0 memory access.\n");
>
>     fd = open ("/dev/mem", O_RDWR | O_SYNC);
>     if (fd == -1) {
>         printf ("ERROR: could not open /dev/mem.\n\n");
>         return 1;
>     }
>
>
> When I look for /dev/mem it doesn't exist whether logged in as debian or 
> root
>
>
>
> On Thursday, April 29, 2021 at 3:15:10 PM UTC-4 Walter Cromer wrote:
>
>> Mark - I'm integrating the concepts from the PRUCookbook so I can send 
>> some control parameters entered by the user in the host side program and 
>> pass them over to the PRU0 firmware.
>>
>> I'm getting this error when I try to compile the code.
>>
>> Setting up pru0 memory access.
>> ERROR: could not open /dev/mem.
>>
>> Any ideas?
>>
>> I'm running a BBB Wireless with video and audio disabled.
>>
>> Here's the output of version.sh
>>
>> debian@beaglebone:/var/lib/cloud9$ sudo /opt/scripts/tools/version.sh
>> [sudo] password for debian:
>> git:/opt/scripts/:[b39ec679648a6be8f25f48bd1c9784c1fc5a0c46]
>> eeprom:[A335BNLTBWA52027BBWG0227]
>> model:[TI_AM335x_BeagleBone_Black_Wireless]
>> dogtag:[BeagleBoard.org Debian Buster IoT Image 2020-04-06]
>> bootloader:[microSD-(push-button)]:[/dev/mmcblk0]:[U-Boot 
>> 2019.04-00002-g07d5700e21]:[location: dd MBR]
>> bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 
>> 2018.03-00002-gac9cce7c6a]:[location: dd MBR]
>> UBOOT: Booted Device-Tree:[am335x-boneblack-uboot-univ.dts]
>> UBOOT: Loaded Overlay:[AM335X-PRU-RPROC-4-19-TI-00A0]
>> UBOOT: Loaded Overlay:[BB-ADC-00A0]
>> UBOOT: Loaded Overlay:[BB-BBBW-WL1835-00A0]
>> UBOOT: Loaded Overlay:[BB-BONE-eMMC1-01-00A0]
>> UBOOT: Loaded Overlay:[BB-I2C2-RTC-DS3231]
>> UBOOT: Loaded Overlay:[BB-W1-P9.12-00A2]
>> kernel:[4.19.94-ti-r61]
>> nodejs:[v10.15.2]
>> /boot/uEnv.txt Settings:
>> uboot_overlay_options:[enable_uboot_overlays=1]
>>
>> uboot_overlay_options:[uboot_overlay_addr4=/lib/firmware/BB-W1-P9.12-00A0.dtbo]
>> uboot_overlay_options:[disable_uboot_overlay_video=1]
>> uboot_overlay_options:[disable_uboot_overlay_audio=1]
>>
>> uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-19-TI-00A0.dtbo]
>> uboot_overlay_options:[enable_uboot_cape_universal=1]
>> uboot_overlay_options:[dtb_overlay=/lib/firmware/BB-I2C2-RTC-DS3231.dtbo]
>> pkg check: to individually upgrade run: [sudo apt install --only-upgrade 
>> <pkg>]
>> pkg:[bb-cape-overlays]:[4.14.20210401.0-0~buster+20210401]
>> pkg:[bb-wl18xx-firmware]:[1.20200322.0-0rcnee0~buster+20200322]
>> pkg:[kmod]:[26-1]
>> pkg:[librobotcontrol]:[1.0.4-git20190227.1-0rcnee0~buster+20190327]
>> pkg:[firmware-ti-connectivity]:[20190717-2rcnee1~buster+20200305]
>> groups:[debian : debian adm kmem dialout cdrom floppy audio dip video 
>> plugdev users systemd-journal bluetooth netdev i2c gpio pwm eqep remoteproc 
>> admin spi iio docker tisdk weston-launch xenomai cloud9ide]
>> cmdline:[console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 
>> root=/dev/mmcblk0p1 ro rootfstype=ext4 rootwait coherent_pool=1M 
>> net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet]
>> dmesg | grep remote
>> [   69.927418] remoteproc remoteproc0: wkup_m3 is available
>> [   70.105672] remoteproc remoteproc0: powering up wkup_m3
>> [   70.105706] remoteproc remoteproc0: Booting fw image 
>> am335x-pm-firmware.elf, size 217148
>> [   70.106000] remoteproc remoteproc0: remote processor wkup_m3 is now up
>> [   72.319951] remoteproc remoteproc1: 4a334000.pru is available
>> [   72.335870] remoteproc remoteproc2: 4a338000.pru is available
>> [  564.302719] remoteproc remoteproc1: powering up 4a334000.pru
>> [  564.303391] remoteproc remoteproc1: Booting fw image am335x-pru0-fw, 
>> size 118908
>> [  564.316303] remoteproc remoteproc1: registered virtio0 (type 7)
>> [  564.316324] remoteproc remoteproc1: remote processor 4a334000.pru is 
>> now up
>> [  590.322924] remoteproc remoteproc1: stopped remote processor 
>> 4a334000.pru
>> [  594.762821] remoteproc remoteproc1: powering up 4a334000.pru
>> [  594.763533] remoteproc remoteproc1: Booting fw image am335x-pru0-fw, 
>> size 118888
>> [  594.777049] remoteproc remoteproc1: registered virtio0 (type 7)
>> [  594.777060] remoteproc remoteproc1: remote processor 4a334000.pru is 
>> now up
>> dmesg | grep pru
>> [   72.319951] remoteproc remoteproc1: 4a334000.pru is available
>> [   72.320135] pru-rproc 4a334000.pru: PRU rproc node pru@4a334000 probed 
>> successfully
>> [   72.335870] remoteproc remoteproc2: 4a338000.pru is available
>> [   72.336020] pru-rproc 4a338000.pru: PRU rproc node pru@4a338000 probed 
>> successfully
>> [  564.302719] remoteproc remoteproc1: powering up 4a334000.pru
>> [  564.303391] remoteproc remoteproc1: Booting fw image am335x-pru0-fw, 
>> size 118908
>> [  564.304236] pruss 4a300000.pruss: configured system_events[63-0] = 
>> 00000000,00030000
>> [  564.304251] pruss 4a300000.pruss: configured intr_channels = 
>> 0x00000005 host_intr = 0x00000005
>> [  564.316324] remoteproc remoteproc1: remote processor 4a334000.pru is 
>> now up
>> [  564.391508] virtio_rpmsg_bus virtio0: creating channel rpmsg-pru addr 
>> 0x1e
>> [  564.467856] rpmsg_pru virtio0.rpmsg-pru.-1.30: new rpmsg_pru device: 
>> /dev/rpmsg_pru30
>> [  590.322860] pruss 4a300000.pruss: unconfigured system_events[63-0] = 
>> 00000000,00030000
>> [  590.322880] pruss 4a300000.pruss: unconfigured host_intr = 0x00000005
>> [  590.322924] remoteproc remoteproc1: stopped remote processor 
>> 4a334000.pru
>> [  594.762821] remoteproc remoteproc1: powering up 4a334000.pru
>> [  594.763533] remoteproc remoteproc1: Booting fw image am335x-pru0-fw, 
>> size 118888
>> [  594.764695] pruss 4a300000.pruss: configured system_events[63-0] = 
>> 00000000,00030000
>> [  594.764710] pruss 4a300000.pruss: configured intr_channels = 
>> 0x00000005 host_intr = 0x00000005
>> [  594.775769] virtio_rpmsg_bus virtio0: creating channel rpmsg-pru addr 
>> 0x1e
>> [  594.776757] rpmsg_pru virtio0.rpmsg-pru.-1.30: new rpmsg_pru device: 
>> /dev/rpmsg_pru30
>> [  594.777060] remoteproc remoteproc1: remote processor 4a334000.pru is 
>> now up
>> dmesg | grep pinctrl-single
>> [    0.952360] pinctrl-single 44e10800.pinmux: 142 pins, size 568
>> dmesg | grep gpio-of-helper
>> [    0.965863] gpio-of-helper ocp:cape-universal: ready
>> lsusb
>> Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
>> END
>>
>>
>> On Wednesday, March 13, 2019 at 10:57:39 AM UTC-4 Mark A. Yoder wrote:
>>
>>> The PRU Cookbook has an exampled of writing shared memory with the ARM.
>>>
>>>
>>> https://markayoder.github.io/PRUCookbook/05blocks/blocks.html#_controlling_the_pwm_frequency
>>>  
>>>
>>> --Mark
>>>
>>>
>>> On Tuesday, March 12, 2019 at 12:54:06 PM UTC-4, [email protected] 
>>> wrote:
>>>>
>>>> i wrote a PRU Programm where i read some Sensors and calculate 
>>>> something. Then i save the Data in the shared RAM.
>>>>
>>>> But how can i read the memory from the ARM? is it possible to read it 
>>>> from an c programm or shell? edit: i programm the PRU with this method: 
>>>> https://markayoder.github.io/PRUCookbook/index.html
>>>>
>>>> Greetings Marcus
>>>>
>>>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/e4e86c7b-5bee-41ea-9adc-7a952a442aden%40googlegroups.com.

Reply via email to