This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Developing a stream driver for ePWM0, usage of EnableDeviceClocks in BSP, accessing registers on CPU

I have started implementing a stream driver for the pwm (ePWM0) on a Variscite AM33 SOM eval kit (AM335x), using CE7. I am not very far along. So far I have a do-nothing stream driver that can be accessed from a c# app via IOControls. Now I need the driver to access the pwm module, starting with something simple like reading one of the registers.

I've looked at several drivers that came with the BSP. They use EnableDeviceClocks() and macros like OUTREG32, INREG16. So I tried that too. My driver code does this:

if (FALSE == EnableDeviceClocks(AM_DEVICE_EPWM0, TRUE))

    RETAILMSG(1,(TEXT("MyPwm: enable pwm clock failed\r\n") ));

else

   RETAILMSG(1,(TEXT("MyPwm: enable pwm clock ok\r\n") ));

The call to EnableDeviceClocks returns false. Stepping thru the code in the debugger I see that EnableDeviceClocks (in clock.c in ...\ceddk\clock folder) calls ClockInitialize which calls KernelIoControl(IOCTL_PRCM_DEVICE_GET_DEVICEMANAGEMENTTABLE,...), which returns false, hence the failure.

My driver is running in kernel mode. It is linked with ceddk and coredll in the sources file like this:

TARGETLIBS= \

$(SG_OUTPUT_ROOT)\sdk\lib\$(_CPUINDPATH)\coredll.lib \

$(SG_OUTPUT_ROOT)\platform\VAR_SOM_AM33\lib\$(_CPUINDPATH)\ceddk.lib \


I am not even sure I am on the right track here. Can my driver call EnableDeviceClocks? Must something else be initialized first? Is there another way to do this?

Thanks in advance for any help on this.