I'm trying to get PWM output on an ICE board.
Apology for the long post, there's a lot I'm still learning about ...
From schematic (AM335x_ICE_3h0013_Schematic_Rev 1_0a.pdf)
J12 -> pin41/pin44 = SPI0_D0, SPI0_CLK
Those lines are routed to uC ball A17, B17 that can be re-mux to EHRPWM0A / EHRPWM0B
I am trying to go create a mux for this new configuration.
My baseline application comes from sdk/protocols/ethercat_slave/ecat_appl.
I see that EcatStack/ecat_appl_cnfg.h:
{ 0x0950 , 0 , AM335X_PIN_OUTPUT | AM335X_PIN_INPUT }, // spi0_sclk
{ 0x0954 , 0 , AM335X_PIN_INPUT }, // spi0_DO
Using the pin-mux tool, Device Package ZCZ, AM335x Rev1.x, I select the PWM to make it match ball A17, B17
The code generated gives:
MUX_VAL(CONTROL_PADCONF_SPI0_SCLK, (IEN | OFF | MODE3 )) /* ehrpwm0A_mux1 */
MUX_VAL(CONTROL_PADCONF_SPI0_D0, (IEN | OFF | MODE3 )) /* ehrpwm0B_mux1 */
on one hand, I have pin-mux saying
IEN = 1 << 5
OFF = 1 << 3
on the other, I have the sdk saying
/* am335x specific mux bit defines */
#define AM335X_SLEWCTRL_FAST (0 << 6)
#define AM335X_SLEWCTRL_SLOW (1 << 6)
#define AM335X_INPUT_EN (1 << 5)
#define AM335X_PULL_UP (1 << 4)
/* bit 3: 0 - enable, 1 - disable for pull enable */
#define AM335X_PULL_DISA (1 << 3)
#define AM335X_PIN_OUTPUT (0)
#define AM335X_PIN_OUTPUT_PULLUP (AM335X_PULL_UP)
#define AM335X_PIN_INPUT (AM335X_INPUT_EN | AM335X_PULL_DISA)
#define AM335X_PIN_INPUT_PULLUP (AM335X_INPUT_EN | AM335X_PULL_UP)
#define AM335X_PIN_INPUT_PULLDOWN (AM335X_INPUT_EN)
so pin-mux is telling to use (1<<5)|(1<<3), which I read as (AM335X_INPUT_EN | AM335X_PULL_DISA), that is AM335X_PIN_INPUT
I update EcatStack/ecat_appl_cnfg.h with
{ 0x0950 , 3 , AM335X_PIN_INPUT }, // spi0_sclk // XXX gpio0[2] -> EHRPWM0A // A17
{ 0x0954 , 3 , AM335X_PIN_INPUT }, // spi0_DO // XXX gpio0[3] -> EHRPWM0B // B17
My questions are:
1 - whatever I'm doing must be flawed because it does not work. Am I missing some steps?
2- I dont understand pin-mux setting, because I would have expected the value for EHRPWM0A/B somewhat to be an output .. not an AM335X_PIN_INPUT