Hi folks,
I'd like to configure ePWM1 on the controlCARD processor to drive one of the user LEDs (LD3, GPIO34.) I've got the ePWM configured (it's counting ;) ) and the plan, of course, is to use one of the comparators to vary the duty cycle (by varying the comparator between 0 and the period.) The problem I'm facing is how to route the comparator output to a GPIO pin. I've read through the X-BAR section in the TRM (spruhm8e) and found it a bit dense. Or I am a bit dense. I've looked at a couple examples and it is not obvious to me how to configure ePWM, output X-BAR and GPIO to make this connection. Pointers to additional documentation or relevant examples are most welcome!
I did find this set of statements in GpioSetup.c that seems to be a hint:
GpioCtrlRegs.GPAMUX1.bit.GPIO0 = 1; // GPIO0 = PWM1A GpioCtrlRegs.GPAMUX1.bit.GPIO1 = 1; // GPIO1 = PWM1B GpioCtrlRegs.GPAMUX1.bit.GPIO2 = 1; // GPIO2 = PWM2A GpioCtrlRegs.GPAMUX1.bit.GPIO3 = 1; // GPIO3 = PWM2B GpioCtrlRegs.GPAMUX1.bit.GPIO4 = 1; // GPIO4 = PWM3A GpioCtrlRegs.GPAMUX1.bit.GPIO5 = 1; // GPIO5 = PWM3B
I'm don't understand that and it is not obvious to me how to convert the first statement to route PWM1A to GPIO34 (LD3)
As an aside, I think a Blinky style example that uses a PWM output to drive one of the user LEDs would make a great addition to the resource explorer. :D
Thanks!