Can't use PWM with BBBCSIO library in monodevelop


i am trying to use the BBBCSIO library, i already got the UART to work and to communicate but the PWM doesn’t work.

on the website they have an example code and it said in the comments that there should be configuration before it can run,
the file BBBIO-EHRPWM-00A0.dts is attached to set up the ports

i copied it to the /lib/firmware library and then compiled it to a .dtbo file, after that when i try to echo it to slots it gets an error
saying that the file exists. i don’t know how to solve this, i tried everything but nothing works.

i managed to get the am33xx_pwm, BB-PWM1 and bone_pwm_P9_14 to appear in the slots but when i use the library to create an instance of a PWM port, the build is successful but when i run the code it returns a call stack error saying:

DEVMEM_FILE did not open.

please, can any one help me and tell me what i need to do in order to get the BBBIO-EHRPWM file to execute properly?



The code that is running is

// open the device memory file
fdDevMem = (BBBDefinitions.DEVMEM_FILE, OpenFlags.O_RDWR, FilePermissions.DEFFILEMODE);
if (fdDevMem == -1)
throw new Exception (“DEVMEM_FILE did not open”);

and the DEVMEM_FILE is defined as

public const string DEVMEM_FILE = @"/dev/mem";

Does that file exist and do you have permissions to open the DEVMEM file for RDWR? Most of the memory access routines require running under elevated permissions such as root. There used to be a File System Version of the PWM code but it was removed in version 6 and replaced with the memory mapped version because it was unreliable in various incarnations of Linux.