Sorry my mistake,

Your code is running inside the pru right?
I was mistaking with host manipulating pru shared memory - in this case 
there is an offset on the host side.
I
You are mentioning when run your code is freezing, could you try to 
decrease the memory to try some kind of debug(pru debug+ dmesg) to try 
understand what is happening? Maybe 1 byte so see if it’s freezing ?



Em terça-feira, 4 de maio de 2021 às 17:11:29 UTC-3, 
[email protected] escreveu:

> Vinicius..
>
> Thanks for looking from your phone!  
>
> Are you saying that SHARE_MEM is incorrect?  I took that directly from 
> Molloy's examples in Exploring BeagleBone.   
>
> Maybe it looks incorrect on your phone?
>
> Walter
>
> On Tuesday, May 4, 2021 at 1:09:35 PM UTC-4 [email protected] wrote:
>
>> Hi Walter,
>>
>> I’m on the cellphone and that is a little hard to read your code? But I 
>> did find the offset of the pru memory , because you need allocate the 
>> memory inside the pru memory address and you is allocating at the 1000 
>> address 
>>
>> Sent from my iPhone
>>
>>
>> Em 4 de mai. de 2021, à(s) 13:16, Walter Cromer <
>> [email protected]> escreveu:
>>
>> I'm on a BBB Wireless running
>>
>>
>> Linux beaglebone 4.19.94-ti-r61 #1buster SMP PREEMPT Wed Mar 31 15:23:20 
>> UTC 2021 armv7l GNU/Linux
>>
>> The version.sh output is at the end of this post.
>>
>> I need to put readings from two analog inputs into two arrays so I can do 
>> some calculations on them.   Basically, when one of the inputs exceeds a 
>> threshold, I'll do these calculations on the values in the arrays.  
>> Essentially these will be two ring buffers.
>> I don't have a lot of variables or a lot of code really but it doesn't 
>> take much to overflow the default stack and heap or 8k of RAM local to each 
>> PRU.  So, I'm thinking the solution is to force these two arrays into the 
>> 12k shared RAM since I'm only using PRU0 in this application.  
>>
>> I've been trying to follow Molloy's example and Mark Yoder's PRUCookbook 
>> example but when I compile the PRU code it freezes the whole system which I 
>> suspect is because of a stack or heap overflow.  
>>
>> Here are the code snippets.  What am I doing wrong and/or what could I do 
>> differently?
>>
>> #define SHARE_MEM  0x00010000
>>
>> // declaring int arrays to go in PRU Shared memory space
>>
>> #define E_RING_BUFFER_SIZE 5  // each array will have 5 elements; 
>> ultimately need 50 each
>>
>> volatile unsigned int *DetTSampleSet = (unsigned int *) SHARE_MEM;
>> volatile unsigned int *DetBSampleSet = (unsigned int *) (SHARE_MEM + 
>> (E_RING_BUFFER_SIZE * sizeof(unsigned int))); ;
>> .
>> .
>> .
>> .
>> // putting data from analog sensor read into array element
>> Data = HWREG(SOC_ADC_TSC_0_REGS + TSC_ADC_SS_FIFODATA(0));
>> StepRead = (Data >> 16) & 0xF;
>> RawAnalog = Data & 0xFFF;
>> switch (StepRead)
>> {
>> case 0:
>> DetTSample = RawAnalog;
>> //DetTSampleSet[pnr]=RawAnalog;
>> break;
>> case 1:
>> DetBSample = RawAnalog;
>> DetBSampleSet[0]=RawAnalog;
>> .
>> .
>> .
>> .
>>
>>
>> debian@beaglebone:/var/lib/cloud9$ sudo /opt/scripts/tools/version.sh
>> 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:
>> 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.919456] remoteproc remoteproc0: wkup_m3 is available
>> [   70.232036] remoteproc remoteproc0: powering up wkup_m3
>> [   70.232072] remoteproc remoteproc0: Booting fw image 
>> am335x-pm-firmware.elf, size 217148
>> [   70.232362] remoteproc remoteproc0: remote processor wkup_m3 is now up
>> [   72.486601] remoteproc remoteproc1: 4a334000.pru is available
>> [   72.507930] remoteproc remoteproc2: 4a338000.pru is available
>> dmesg | grep pru
>> [   72.486601] remoteproc remoteproc1: 4a334000.pru is available
>> [   72.486792] pru-rproc 4a334000.pru: PRU rproc node pru@4a334000 probed 
>> successfully
>> [   72.507930] remoteproc remoteproc2: 4a338000.pru is available
>> [   72.508098] pru-rproc 4a338000.pru: PRU rproc node pru@4a338000 probed 
>> successfully
>> dmesg | grep pinctrl-single
>> [    0.951056] pinctrl-single 44e10800.pinmux: 142 pins, size 568
>> dmesg | grep gpio-of-helper
>> [    0.964776] gpio-of-helper ocp:cape-universal: ready
>> lsusb
>> Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
>> END
>>
>> -- 
>> 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/64e7559c-50fa-44cb-8cc5-9b386755a854n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/beagleboard/64e7559c-50fa-44cb-8cc5-9b386755a854n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>>

-- 
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/1f8ba44e-a1d6-4ae8-9ef1-a62a5c22a34en%40googlegroups.com.

Reply via email to