I'm running a BBB Wireless.  The OS version, version.sh output, etc. are 
below.

We're sensor outputs on AIN4 and AIN0 with C using the code below.  The 
intervals between readings is fairly constant at about 350 uS but there is 
periodically, about every 25 readings, a reading interval of between 4000 
and 4800 uS.   Our application can't accept this.  

1) Is there some process the OS is doing periodically to cause this delay 
and can we eliminate it?

2) Would the PRUs solve this problem and is it worth the effort to learn 
and apply them?

Thanks for your insights, advice, and help!

Code is in C...and we run it from the Cloud9 IDE.

 void ReadDetectors(long TimeToRead, int CycleNo)

{

    

    

    // initialize local variables

    char Det1Volts_str[1024][6];

    char Det2Volts_str[1024][6];

    long elapsed_us;

    int index;

    index = 0;

    struct timeval tv_start; //start time hack

    struct timeval tv_now; // current time hack

    long total_elapsed_time_us[1024];

    long start_secs;

    long last_secs;

    long last_usecs;

    

    int KeepReading = 1;

    

    FILE* fDet1 = fopen("/sys/bus/iio/devices/iio:device0/in_voltage4_raw", 
"r");  // top sensor, blue wire

    FILE* fDet2 = fopen("/sys/bus/iio/devices/iio:device0/in_voltage0_raw", 
"r");  // bottom sensor, purple wire

 

    // get time at entry into the routine

    

    gettimeofday(&tv_now,NULL);

    start_secs = tv_now.tv_sec;

    last_usecs = tv_now.tv_usec;

    elapsed_us = 0;

    total_elapsed_time_us[index] = 0;

  

   while (KeepReading)

   

        {

    

          // update elapsed time

          

          gettimeofday(&tv_now,NULL);

        

          if (tv_now.tv_sec >= last_usecs)

          {

              elapsed_us = tv_now.tv_usec - last_usecs;

          }

          else

          {

              elapsed_us = (1000000 - last_usecs) + tv_now.tv_usec;

          }

           

          total_elapsed_time_us[index] = (tv_now.tv_sec - 
start_secs)*1000000 + elapsed_us;

          if (total_elapsed_time_us[index] > TimeToRead) KeepReading = 0;// 
read detectors

        

          fread(&Det1Volts_str[index], 5, 1, fDet1);

          fread(&Det2Volts_str[index], 5, 1, fDet2);

          

          rewind(fDet1);

          rewind(fDet2);

          index += 1;

          if (index >1024) KeepReading = 0;

        }

}

 

debian@beaglebone:/var/lib/cloud9$ uname --a

Linux beaglebone 4.19.94-ti-r42 #1buster SMP PREEMPT Tue Mar 31 19:38:29 
UTC 2020 armv7l GNU/Linux

 

debian@beaglebone:/$ 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-HDMI-TDA998x-00A0]

UBOOT: Loaded Overlay:[BB-I2C2-RTC-DS3231]

UBOOT: Loaded Overlay:[BB-W1-P9.12-00A2]

kernel:[4.19.94-ti-r42]

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:[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.20200403.0-0rcnee0~buster+20200403]

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

[   11.374832] remoteproc remoteproc0: 4a334000.pru is available

[   11.397684] remoteproc remoteproc1: 4a338000.pru is available

[   58.421621] remoteproc remoteproc2: wkup_m3 is available

[   58.879676] remoteproc remoteproc2: powering up wkup_m3

[   58.879705] remoteproc remoteproc2: Booting fw image 
am335x-pm-firmware.elf, size 217168

[   58.879995] remoteproc remoteproc2: remote processor wkup_m3 is now up

dmesg | grep pru

[   11.374832] remoteproc remoteproc0: 4a334000.pru is available

[   11.375013] pru-rproc 4a334000.pru: PRU rproc node pru@4a334000 probed 
successfully

[   11.397684] remoteproc remoteproc1: 4a338000.pru is available

[   11.397867] pru-rproc 4a338000.pru: PRU rproc node pru@4a338000 probed 
successfully

dmesg | grep pinctrl-single

[    0.929984] pinctrl-single 44e10800.pinmux: 142 pins, size 568

dmesg | grep gpio-of-helper

[    0.943137] 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 beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/24e6c7bf-9932-4ee1-b13e-a6bc7f7487den%40googlegroups.com.

Reply via email to