Comments on: Chapter 6: Interfacing to the Beagle Board Inputs/Outputs http://exploringbeaglebone.com Companion Site for the Book by Derek Molloy Mon, 12 Oct 2020 16:28:29 +0000 hourly 1 https://wordpress.org/?v=5.9.2 By: Brian Walker http://exploringbeaglebone.com/chapter6/#comment-2308 Mon, 12 Oct 2020 16:28:29 +0000 http://exploringbeaglebone.com/?page_id=181#comment-2308 Derek, I purchased your second book, “Exploring BeagleBone” a couple of months ago. I am working in Chapter 6 under the heading, “The Linix Device Tree”. I am specifically working the example under the subheading “Modifying a Board Device Tree”.

Device: BeagleBone Black Rev. C
Linux Version: Linux ebb 4.14.108-ti-r137 #lstretch SMP PREEMPT Tue Aug 25 01:48:39 UTC 2020 armv71 GNU/Linux

I followed the example line by line and it would not flash the “heartbeat” on LED5 on the beaglebone board.
I repeated this example 5 times total and was unable to get it to work. ANY HELP WOULD BE GREATLY APPRECIATED.

]]>
By: Pat http://exploringbeaglebone.com/chapter6/#comment-2306 Tue, 06 Oct 2020 17:19:03 +0000 http://exploringbeaglebone.com/?page_id=181#comment-2306 @Pavel Do you have a BeagleBoneBlack or PocketBeagle. The command you used was for the PocketBeagle.

Some commands in the book do not work with the current version of config-pin. For example,

debian@beaglebone:~$ config-pin p8.16 in+
ERROR: write() to /sys/devices/platform/ocp/ocp:P8_16_pinmux/state failed, No such device

debian@beaglebone:~$ config-pin P8_16 gpio_pu
Current mode for P8_16 is: gpio_pu

]]>
By: Pavel Yermolenko http://exploringbeaglebone.com/chapter6/#comment-2304 Wed, 09 Sep 2020 14:36:25 +0000 http://exploringbeaglebone.com/?page_id=181#comment-2304 Hello,

config-pin tool doesn’t work

debian@beaglebone:~$ config-pin -l p2.08
ERROR: open() for /sys/firmware/devicetree/base/ocp/P2_08_pinmux/pinctrl-names failed, No such file or directory
debian@beaglebone:~$

Any comments ?

Thanks.

]]>
By: Raymond http://exploringbeaglebone.com/chapter6/#comment-2252 Sun, 11 Aug 2019 22:50:54 +0000 http://exploringbeaglebone.com/?page_id=181#comment-2252 Hi Derek

I am using your GPIO library to count pulses coming in on a gpio pin @about 13 pulses per second it works very well and in fact have used it to prove that a python script doing the same job was losing pulses. My problem is that when I get to just over a 1000 pulses I get an error saying that there are too many files open:
GPIO: Failed to create epollfd: Too many open files

In my appplication I am using :
total= pulse1.waitForEdge(&callbackFunction)
int callbackFunction(int var) {
cout << "Pulse detected!" << pulse_count << endl;
pulse_count++;
return pulse_count;
}

So its pretty simple and any input would be greatly appreciated.

Thanks

]]>
By: Derek http://exploringbeaglebone.com/chapter6/#comment-2225 Tue, 28 May 2019 15:12:04 +0000 http://exploringbeaglebone.com/?page_id=181#comment-2225 In reply to Andrew Martin.

Thanks Andrew, that is very helpful. Derek.

]]>
By: Andrew Martin http://exploringbeaglebone.com/chapter6/#comment-2223 Mon, 27 May 2019 06:36:24 +0000 http://exploringbeaglebone.com/?page_id=181#comment-2223 Thanx for the excellent books. I would love a PDF of Issue 2, I find Kindle a bit difficult to use in the reference book context.

That aside, this post is about what seems to be a bug in the gpio export operation in my BeagleBone Black (4.14.71-ti-r80), which is that if you write to the export folder at /sys/class/gpio/export for a gpio that has already been exported, the gpio disappears (after giving an error).

There is some detail here:
https://stackoverflow.com/questions/52125581/the-gpio-folder-is-deleted-when-the-same-gpio-is-exported-again

I ‘fixed’ it by putting a test for the gpio# directory existence, before writing the gpio number to the export sysfs file.

I.e. I checked for the existence of ‘/sys/class/gpio/gpio7’

Before writing 7 to ‘/sys/class/gpio/export’

I changed the existing exportGPIO function in your GPIO.cpp from:

int GPIO::exportGPIO(){
return write(GPIO_PATH, “export”, this->number);
}

to:

int GPIO::exportGPIO(){
// APM – 2019-05-27 – export twice kills it

if (checkDirectoryExists(GPIO_PATH + this->name)) {
cout <name + ” already exists” <number);
}

The checkDirectoryExists function I wrote based on a stat() call.

I hope this helps someone, it wasted a lot of time for me, bringing some old code up to the new system.

I note that I do not use config-pin, and we use a custom dts; that may make this redundant.

]]>
By: Derek http://exploringbeaglebone.com/chapter6/#comment-2221 Mon, 20 May 2019 09:43:31 +0000 http://exploringbeaglebone.com/?page_id=181#comment-2221 In reply to John.

Hi John, Apologies, I haven’t rewritten the PWM C++ code to support config-pin, which is why you are having problems. However, the steps to use the new directory structure with code are reasonably straightfoward in code as config-pin is doing the heavy lifting. Essentially it involves writing to the file handles as outlined in the steps in Chapter 6. I didn’t remove the old code from the repo as I felt it could act as a basis for a rewrite. I will add a warning to other readers. Kind regards, Derek.

]]>
By: John http://exploringbeaglebone.com/chapter6/#comment-2211 Fri, 17 May 2019 16:52:17 +0000 http://exploringbeaglebone.com/?page_id=181#comment-2211 Afternoon All, question regarding the move away from $SLOTS file to “custom overlays” and the effect on PWM. Any help is appreciated.

Question: Now that $SLOTS are removed, is there a defined method for configuring the pwm pins to allow them to output a pwm signal from ssh cmds or c++ code?

Reason: I’ve attempted to use the PWM.h and util.h headers provided by the “exploringBB” library and the ssh method of “config-pin” and exporting “pwmchip”, with no success. I’m new to linux and am hesitant to modify the internal files without knowing exactly what I’m changing.

Attempted methods…
Libraries: When I tried running the “pwm_test.cpp” executable from the chp06 examples, the system told me I have a “GPIO: write failed to open file : No such file or directory” error.

ssh: I am able to configure the pins, query, and export from the correct pwmchip, but when I set “enable” to “1” with proper “period” and “duty_cycle”, there is no pwm output. “enable” becomes “1” but my oscilloscope is left blank.

]]>
By: Jason http://exploringbeaglebone.com/chapter6/#comment-2131 Fri, 10 Jun 2016 00:04:28 +0000 http://exploringbeaglebone.com/?page_id=181#comment-2131 Error in P8 figure: in the lower left corner it says “P9 Header”.

]]>
By: Michael http://exploringbeaglebone.com/chapter6/#comment-2113 Fri, 13 May 2016 17:20:23 +0000 http://exploringbeaglebone.com/?page_id=181#comment-2113 Hello
In chapter 6 of the book at activating the PWM GPIO pins in my /lib/firmware folder there are no dtbo-files that are named like bone_pwm_P*_*-*.dtbo

why?

]]>