Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Soft PWM Support #5

Open
FinalFrontierPrototyping opened this issue Jan 15, 2015 · 5 comments
Open

Soft PWM Support #5

FinalFrontierPrototyping opened this issue Jan 15, 2015 · 5 comments
Assignees

Comments

@FinalFrontierPrototyping

Hello,

I am building a quadcopter using a Raspberry PI and C#. At the moment for I2C communication between my Raspberry PI and MPU9150 (works great).

I would like to add motor control so I would need 4 PWM outputs. Does the wrapper support the Software PWM library (https://projects.drogon.net/raspberry-pi/wiringpi/software-pwm-library)?

If not, will adding this to the wrapper work:

    [DllImport("libwiringPi.so", EntryPoint = "softPwmCreate")]
    public static extern int softPwmCreate(int pin, int initialValue, int pwmRange);

    [DllImport("libwiringPi.so", EntryPoint = "softPwmWrite")]
    public static extern void softPwmWrite(int pin, int value);

It may also be a good idea to add an example of PWM usage to the test console program.

Thanks in advance and with best regards!

@danriches
Copy link
Owner

Hi,
I haven't done any work on this library for over a year. I'm not sure if your additions will work but feel free to try them out. I would suggest you use another method of generating pwm as the library that Gordon wrote uses softpwm and may cause your C# application to run slowly, but having said that it all depends on how much processing power you need from the RasPi.

I'll take a look at this on Saturday if I can, then test it out and report back. I hope you enjoy using the library as much as I did writing it!

Regards, Dan

@danriches danriches self-assigned this Jan 15, 2015
@davidreher
Copy link

Hey,

are you making progress on this? I cannot get it up and running ... I always get

System.EntryPointNotFoundException: softPwmCreate
  at (wrapper managed-to-native) WiringPi.GPIO:softPwmCreate (int,int,int)

In softPwm.h it says:

extern int  softPwmCreate (int pin, int value, int range) ;

When I searched for the symbol, I get the following output:

nm -A libwiringPi.so | grep softPwmCreate
libwiringPi.so:         U softPwmCreate

Best,
David

@davidreher
Copy link

Since softPwm is not that complicated I tried to implement it on my own, but now I get

mono: symbol lookup error: /home/osmc/monoLedColor/libwiringPi.so: undefined symbol: softPwmStop

although I am not using softPwm at all ...

@TrevorNewsome
Copy link

Hello all,

Not sure if this is still supported, but I have install and run according to the readme but I am getting an Unhandled Exception: System.EntryPointFileNotFoundException when running the RunTest methods for all three SPITest methods. I have even tried copying all the files in the same directory as well as using adding the files in a routing path in the app.config with no success. Its rather difficult to debug as I have having to compile the code on a Windows machine and then copy the exe on the my Pi2

Any suggestions would be welcomed. Out of curiosity, why was this project never continued with? Is there a better way of doing this?

Thank you
Trev

@danriches
Copy link
Owner

Hi Trev,
It looks like you don't have Gordon's WiringPi C library installed properly or compiled as a shared object library. The project wasn't continued with as it does exactly what most need it to do. Di you have any other requirements from it?

HTH, Dan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants