OK, well I'm not saying anything bad, just noticing that you're struggling.
I was in your shoes around 3.5 years ago too.

In fact, I've not written any code for PWM on the BBB yet, but I know it's
possible, and I know how. Just not all the exact details.

So, what you need to understand is how the sysfs PWM file system works.
Then all you need to understand is how a good file system library for the
programming language you're using works. Me, I've done this for most every
"normal" peripheral except PWM, but in C, and Javascript ( Nodejs ). PWM I
wont do until I get a good "test jig" to make sure I've done everything
correctly.

However . . . Here is one example:
http://stackoverflow.com/questions/29369616/beaglebone-black-pwm-using-c

And here is another where a person talks about how this is done from the
command line. Which would be really easy to "wrap" in C, or any language
with a good file system library. I've also no doubt python has at least one
. . .
https://briancode.wordpress.com/2015/01/06/working-with-pwm-on-a-beaglebone-black/

So if you do not understand what I mean by "wrap", here:

"use strict";
var fs = require('fs');
var path = "/sys/bus/iio/devices/iio:device0/in_voltage";

exports.read = function(ch, callback){
        fs.access(path + ch + "_raw", fs.F_OK, (err) => {
        if(err){throw err;}
    });

    fs.readFile(path + ch + "_raw", (err, data) => {
                if(err){data = null;}

                callback(data);
    });
};

This is for the ADC, and this is written in Javascript for Nodejs. But the
point, in code I'm using the sysfs "object" exactly how it's used from the
command line with cat. Or as close as possible, while still remaining
flexible.


On Fri, Jun 10, 2016 at 1:27 PM, Eshaan Ghosh <[email protected]>
wrote:

> Hey William
>
> I have been programming in TI F28335 DSP and Microchip MCUs. I recently
> moved to raspberry pi and now beaglebone. So I am not exactly familiar with
> python, but the implementation of PWM is not clear. I have been using MCUs
> to run industrial converters. But the prospect of IoT with beaglebone makes
> me want to move to these small credit card sized devices.
> So I shall give it a try. I tried programming the beaglebone using python,
> Node_red, bonescript. In all case i get some different failure messages. So
> I am not clear of how to proceed with this!
>
> On Fri, Jun 10, 2016 at 4:20 PM, William Hermans <[email protected]>
> wrote:
>
>> Eshaan,
>>
>> I take it you're not exactly a programmer, or one who does not know
>> python very well ?
>>
>>
>> The reason why I ask is that PWM is controlled via sysfs directories /
>> files, and python like all programming languages should have file system
>> libraries. The point here is that this would be really really easy to
>> implement yourself.
>>
>> On Fri, Jun 10, 2016 at 1:07 PM, Eshaan Ghosh <[email protected]>
>> wrote:
>>
>>> Yes it is Adafruit. SO what is the best way to implement PWM? Do I mount
>>> the image of linux 3.8 on the SD card and then try it? If it doesn't work
>>> then i shall use the tree overlay?!
>>>
>>> On Fri, Jun 10, 2016 at 3:44 PM Robert Nelson <[email protected]>
>>> wrote:
>>>
>>>> On Fri, Jun 10, 2016 at 2:35 PM, Eshaan Ghosh <[email protected]>
>>>> wrote:
>>>> > Thank you. Robert. I did try downloading that version and it worked.
>>>> But
>>>> > after everything the reason why i started looking into the problem
>>>> actually
>>>> > didn't solve my problem. I am trying to generate PWM using python and
>>>> I am
>>>> > getting this error
>>>> >
>>>> > Getting IOError: [Errno 2] No such file or directory: '/slots'
>>>>
>>>> Adafuit library?
>>>>
>>>> It's being worked on..
>>>>
>>>> https://github.com/adafruit/adafruit-beaglebone-io-python/commits/master
>>>>
>>>> https://github.com/adafruit/adafruit-beaglebone-io-python/issues/103
>>>>
>>>> Regards,
>>>>
>>>> --
>>>> Robert Nelson
>>>> https://rcn-ee.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 [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/beagleboard/CAG4MCi32kix3reRqyXYBmNApHGZhUuq_KQSYRwO8RXJJdUt0XA%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/beagleboard/CAG4MCi32kix3reRqyXYBmNApHGZhUuq_KQSYRwO8RXJJdUt0XA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
>> For more options, visit http://beagleboard.org/discuss
>> ---
>> You received this message because you are subscribed to a topic in the
>> Google Groups "BeagleBoard" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/beagleboard/OG1_tts4OcU/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/beagleboard/CALHSORoRAyUuG1hqmmqc7OWiHjeu-XnCE9HvJwseGhHMu375yA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/beagleboard/CALHSORoRAyUuG1hqmmqc7OWiHjeu-XnCE9HvJwseGhHMu375yA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
>
> ESHAAN GHOSH
>
> Ph No.: +91-9475526023, +91-8444972110
>
> --
> 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/CAG4MCi2xgHv9eJs_TFy_QtPDajmFFu%2BULOnkh9kHo5WF1iHdbQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/beagleboard/CAG4MCi2xgHv9eJs_TFy_QtPDajmFFu%2BULOnkh9kHo5WF1iHdbQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CALHSORp0XuQ0zmdG5wWpd%2Bqga_14-zd3P16a5tSHvvD390vV1Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to