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
I'm looking at some example code and there references to ADC_TSC. I realize this is a reference to the Touchscreen controller which provides the ADC functionality. And I suspect this refers to the base memory address of the chip but I cannot find where that is defined in any header files anywhere. It would help me to follow these examples if I knew where that reference was.
Unfortunately, too, the examples are Python and I'm not a Python programmer. I work in C. So I'm having to dig through this and learn some Python at the same time. Not a bad thing but time consuming!
|
--https://groups.google.com/d/msgid/beagleboard/04caf3a3-cd8c-449e-9fd7-9ed6df33f99en%40googlegroups.com
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...@googlegroups.com.
To view this discussion on the web visit.
To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/55b15f32-c44a-4977-8390-e91615c5e788n%40googlegroups.com.
Happy to help; I have worked some with these examples, so feel free to reach out if you have any questions!
Pierrick
**********************************************************************
Pierrick Rauby
Graduate Research Assistant
pierric...@gatech.edu
(+33) 640 237 194
Georgia Institute of Technology
George W. Woodruff School of Mechanical Engineering GeorgiaTech Institute of Technology
771 Ferst Drive, NW, Love Bldg. Room 108
Atlanta, GA 30332-0405
**********************************************************************
To view this discussion on the web visit
https://groups.google.com/d/msgid/beagleboard/a50a177c-ba59-47d7-aaab-8352868a3199n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/DBBPR03MB6988AE54BE71B8EFDAD8A4BDA7739%40DBBPR03MB6988.eurprd03.prod.outlook.com.
--
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...@googlegroups.com.
To view this discussion on the web visit
On Fri, Apr 9, 2021 at 2:00 PM, Walter Cromer<wal...@edenconceptsllc.com> wrote:
To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/1c1af0c5-207f-47fe-9c47-e97b563bbcecn%40googlegroups.com.
--
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...@googlegroups.com.
To view this discussion on the web visit
--
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+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/44cb7gtf6pl4d4j3e6oqo57g5n0hobi29c%404ax.com.
Here's one more thing I am struggling with though. It's a mental block I think. I'm used to controlling GPIOs on the ARM side using sysfs. It appears that on the PRU, we use __R30 instead but I don't understand how that works. I read through it this morning and it still isn't sinking in. If anyone can help make this clearer, I'd appreciate it.
The easy way to benefit from libpruio is to install the Debian packages. They're not in mainline, yet. So you have to add a PPA (Personal Package Archive) to your package management sources. On the default Debian operating system, edit the file sudo nano /etc/apt/sources.list and add the lines:
deb http://beagle.tuks.nl/debian jessie/ deb-src http://beagle.tuks.nl/debian jessie/Then grep the keyring by (mind the '-' character at the end)
wget -qO - http://beagle.tuks.nl/debian/pubring.gpg | sudo apt-key add -Once prepared, you can update your package manager database
sudo apt-get update--
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...@googlegroups.com.
To view this discussion on the web visit
0x0001_0000 | Data 12KB RAM 2 (Shared) |
--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+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/i1je7g5lji264tiuae2ftumvb1e3mauicv%404ax.com.
So I looked over the libpruio page and it looks great. My head's spinning a bit between remoteproc, uio, and libpruio options but I'd like to try libpruio.I don't want to break remoteproc if I set up to use libpruio. Will that happen?
Also, I'm running Buster (version.sh) at the bottom of this postThe instructions refer to Jessie. Are the Debian packages referred to compatible with Buster? Here's what I am referring to.The easy way to benefit from libpruio is to install the Debian packages. They're not in mainline, yet.
--
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...@googlegroups.com.
To view this discussion on the web visit
I thought he had an unacceptable delay reading ADC from ARM?Just trying to understand how libpruio fixes this and if it did why even bother with PRU?
--
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...@googlegroups.com.
To view this discussion on the web visit
So if I had an application that had a sensor A that needs to be read every 10ms and sensor B that only needs to be read every minute, I could wire channel 1 to sensor A and assign it to step 1 and wire channel 2 to sensor B and assign it to step 2.
Then at startup, when I want to read both sensors, I enable steps 1 and 2 but not 3-16. This saves time on the read as channels 3-7 aren't needed and steps 3-16 aren't needed so I don't use them. Then after the initial read when I don't need to read sensor B until a minute passes, I can change STEPENABLE so only step 1 is enabled and execute a read every 10 ms. Only sensor A would be read. Then at one minute intervals, I change STEPENABLE so steps 1 & 2 are enabled and when read is triggered, sensors A and B are read.
BTW - I don't have a real-world application like this but I guess someday I could.
This is a very flexible system!--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/11c39bb9-4891-4271-8374-ae76f00f9e17n%40googlegroups.com.
So, STEPENABLE lets me enable the steps that I want to be executed. (I missed that concept before.)So if I had an application that had a sensor A that needs to be read every 10ms and sensor B that only needs to be read every minute, I could wire channel 1 to sensor A and assign it to step 1 and wire channel 2 to sensor B and assign it to step 2.
Then at startup, when I want to read both sensors, I enable steps 1 and 2 but not 3-16. This saves time on the read as channels 3-7 aren't needed and steps 3-16 aren't needed so I don't use them. Then after the initial read when I don't need to read sensor B until a minute passes, I can change STEPENABLE so only step 1 is enabled and execute a read every 10 ms. Only sensor A would be read. Then at one minute intervals, I change STEPENABLE so steps 1 & 2 are enabled and when read is triggered, sensors A and B are read.
Confg
and Delay
. See ARM Reference Guide, chapter 12 for details on ADC configurations.--
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...@googlegroups.com.
To view this discussion on the web visit
Looks very powerful and code is very generic and well thought out. I thought you couldn't code?🤣
I'm on tablet forgive my laziness where are the ADC examples located in c language if possible
I'm guessing below reference you mentioned is the am335x TRM or are you referring to the ARM intellectual property for ADC?It's also possible to directly write to the step configuration in AdcSet::St_p by writing to the member variablesConfg
andDelay
. See ARM Reference Guide, chapter 12 for details on ADC configurations.
Thanks. Did you write this library? It's quite a bit to wrap ones mind around. How long dis this take to develop.
I've got a basic understanding of how RPMSG works I'd like to understand how libpruio handles the data exchange.I'm wondering why Walter isn't using RPMSG he's talking about using the other unused PRU memory to store data and have ARM read it. I'm trying to see if that's doable for my own understanding. Certainly would not be good if that PRU loaded code from ARM. The Linux part I'm unfamiliar with. From my reading it sounds like starting PRU is manually done from linux command line.Loading and debugging PRU code seems to me to be slow and time consuming compared to jtag.Lastly in the unlikely event a modified libpruio example crashes what is the debug mechanisms beyond dmsg saying dude you crashed go recompile and reload. Are console output echoed back.
Thanks in advance also any data sharing examples in libpruio?
To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/CAMRnUvDf16iYJoqN_xZo%2BJMKF%2Bso6oUdLPKXKEwaqrCjK4a8Ng%40mail.gmail.com.
--
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...@googlegroups.com.
To view this discussion on the web visit
We're designing it the way you suggested. The nice thing is that basically the control logic has already been written in C on the ARM side. Now, I just need to get it ported to the PRUs and create the communications between the PRUs and a new ARM app that supervises everything from the user's point of view. Meaning, taking inputs like start, stop and giving feedback by turning LEDs on and off. And it needs to take in some basic system configuration data from the cloud periodically that the PRU will consume to adjust it's operation.I am making progress. Part of my problem was using Cloud9 for development. That's where all my ARM development has been so far. I have CCS installed on my Windows 10 machine and started working through TI's PRU Hands On Labs. Unfortunately, the very first one doesn't work because their document is written for CCS running on Linux. Step 6 says to delete the linker file and add it back with Project->Add Files but that's grayed out. I've asked TI about that. But I got it to compile by writing on the Beagle using nano and compiling it there. I've ready a lot of TI documentation today and learned a lot.
Here's one more thing I am struggling with though. It's a mental block I think. I'm used to controlling GPIOs on the ARM side using sysfs. It appears that on the PRU, we use __R30 instead but I don't understand how that works. I read through it this morning and it still isn't sinking in. If anyone can help make this clearer, I'd appreciate it.
On Tuesday, April 13, 2021 at 11:25:08 AM UTC-4 lazarman wrote:WalterYour best bet.Run your whole control loop on the PRU that's as realtime as you get. Use a foreground background loop. Use the ARM like a PC with Linux to access the system via ethernet.You could also run control on ARM without linux but this way you have all the resources of Linux to access the system.This assumes your output's from control loop are accessable from PRU.The point is Linux can only run slow control loops and this way you don't have to debug the delay.This wasn't obvious to me before as all the hard realtime systems I work on run an RTOS on ARM it has all the resources of Linux but cost $$$$$.In our system we did that on the DSP the PID did the math on a fast DSP.ARM is just a gateway to outside world.Myself I'd debug the PRU with JTAG and CCS you can see exactly what's going on and dump these registers from CCS.Some people like printf but with a PRU based system you are essentially doing barebones.There's videos on PRU development doing this online.Loading code via rproc and using printf is like burning and erasing an eeprom to test your changes. You wait 45 minutes for it to erase try your code and do it again.Not for me.
On Tue, Apr 13, 2021 at 9:54 AM, Dennis Lee Bieber<dennis....@gmail.com> wrote:On Mon, 12 Apr 2021 13:08:48 -0700 (PDT), in
gmane.comp.hardware.beagleboard.user Walter Cromer
<walterc-2dFtBuzUeF/tpnMUCzy8b...@public.gmane.org> wrote:
>What's really throwing me is the + between what looks like two macro
>values. Normally, we see the + on the right sign of the equals, right?
>Or am I forgetting something I used to know!?
>
Why? Take into account the ()s.
From what I can tell, this is adding the ADC register offset to the
base address of the (?) wakeup register block, which is passed as parameter
to HWREG (no doubt some macro that sets up actual access to the SoC
registers and returns a pointer or some such), and then assigns 0x02 into
the register so indicated.
--
Dennis L Bieber
--
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+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/44cb7gtf6pl4d4j3e6oqo57g5n0hobi29c%404ax.com.
Anyway Linux is not required for CCS and its slow and inferior to Windows 10 version
who you want to believe Texas Instrumentr or TJF?
--
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...@googlegroups.com.
To view this discussion on the web visit