- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Very similar to this thread: PWM generation problem
We also see an inversion of our PWM signal for LED dimming - request a 20% duty cycle will sometimes switch to 80%.
The "solution" from #153024 generated some magic numbers as pointers to registers relevant to GPIO #26, with no real discussion on where those numbers came from.
I unfortunately cannot change my GPIO pin as it's been wired on a PCB already and need these same numbers for GPIO pin #17. Can we get some clarity as to where these register numbers come from?
The relevant code
gpioConfig.outValue = CyFalse;
gpioConfig.inputEn = CyFalse;
gpioConfig.driveLowEn = CyTrue;
gpioConfig.driveHighEn = CyTrue;
gpioConfig.pinMode = CY_U3P_GPIO_MODE_PWM;
gpioConfig.intrMode = CY_U3P_GPIO_NO_INTR;
gpioConfig.timerMode = CY_U3P_GPIO_TIMER_HIGH_FREQ;
gpioConfig.timer = 0;
gpioConfig.period = CY_FX_PWM_PERIOD;
gpioConfig.threshold = (int) (LEDIntensity[LEDNum]);
apiRetStatus = CyU3PGpioSetComplexConfig(17, &gpioConfig);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
The SDK 1.3.4 which is on the web should not have this problem. Please do test it with the same.
Link for new SDK: http://www.cypress.com/documentation/software-and-drivers/ez-usb-fx3-software-development-kit
However, please find the explanation for the register addresses below:
Please have a look at the register address defined in the gpio_regs.h which is in the following path:
C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\fx3_sdk_1_3_4_src\fx3_sdk_1_3_3_src\sdk\firmware\include
--------------------------------------------------------------
typedef struct
{
struct
{
uvint32_t status; /* 0xe0001000 */
uvint32_t timer; /* 0xe0001004 */
uvint32_t period; /* 0xe0001008 */
uvint32_t threshold; /* 0xe000100c */
} lpp_gpio_pin[8];
uvint32_t rsrvd0[32];
uvint32_t lpp_gpio_simple[61]; /* 0xe0001100 */
uvint32_t rsrvd1[119];
uvint32_t lpp_gpio_invalue0; /* 0xe00013d0 */
uvint32_t lpp_gpio_invalue1; /* 0xe00013d4 */
uvint32_t rsrvd2[2];
uvint32_t lpp_gpio_intr0; /* 0xe00013e0 */
uvint32_t lpp_gpio_intr1; /* 0xe00013e4 */
uvint32_t lpp_gpio_pin_intr; /* 0xe00013e8 */
uvint32_t rsrvd3;
uvint32_t lpp_gpio_id; /* 0xe00013f0 */
uvint32_t lpp_gpio_power; /* 0xe00013f4 */
} GPIO_REGS_T, *PGPIO_REGS_T;
#define GPIO ((PGPIO_REGS_T) GPIO_BASE_ADDR)
--------------------------------------------------------------
- As you might already know that only 8 complex GPIOs can be used at a time.
- From the above structure, the member lpp_gpio_pin[8] is for complex GPIO configuration.
- Each element of lpp_gpio_pin corresponds to the configuration of all GPIOs which are equal modulo 8.
Meaning:
the address from 0xe0001000 to 0xe000100f correspond to configuration of GPIO 0, 8,...56
the address from 0xe0001010 to 0xe000101f correspond to configuration of GPIO 1, 9,...57
Your case:
- Make sure that you have selected the corresponding bit in ComplexIO matrix corresponding to GPIO17.
- Then the configuration of complex GPIO 17 starts from address 0xe0001010(since 1 and 17 are equal modulo 8).
- So, 0xe0001010 is for status, 0xe0001014 for timer and so on.
Let me know if you have any questions.
Regards,
Hemanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
The status register address of a pin can be calculated as:(0xe0001000 + ((n) * 0x0010)) and the address of the threshold register of a pin can be calculated as : (0xe000100c + ((n) * 0x0010))
where n = gpio id %8
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
The SDK 1.3.4 which is on the web should not have this problem. Please do test it with the same.
Link for new SDK: http://www.cypress.com/documentation/software-and-drivers/ez-usb-fx3-software-development-kit
However, please find the explanation for the register addresses below:
Please have a look at the register address defined in the gpio_regs.h which is in the following path:
C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\fx3_sdk_1_3_4_src\fx3_sdk_1_3_3_src\sdk\firmware\include
--------------------------------------------------------------
typedef struct
{
struct
{
uvint32_t status; /* 0xe0001000 */
uvint32_t timer; /* 0xe0001004 */
uvint32_t period; /* 0xe0001008 */
uvint32_t threshold; /* 0xe000100c */
} lpp_gpio_pin[8];
uvint32_t rsrvd0[32];
uvint32_t lpp_gpio_simple[61]; /* 0xe0001100 */
uvint32_t rsrvd1[119];
uvint32_t lpp_gpio_invalue0; /* 0xe00013d0 */
uvint32_t lpp_gpio_invalue1; /* 0xe00013d4 */
uvint32_t rsrvd2[2];
uvint32_t lpp_gpio_intr0; /* 0xe00013e0 */
uvint32_t lpp_gpio_intr1; /* 0xe00013e4 */
uvint32_t lpp_gpio_pin_intr; /* 0xe00013e8 */
uvint32_t rsrvd3;
uvint32_t lpp_gpio_id; /* 0xe00013f0 */
uvint32_t lpp_gpio_power; /* 0xe00013f4 */
} GPIO_REGS_T, *PGPIO_REGS_T;
#define GPIO ((PGPIO_REGS_T) GPIO_BASE_ADDR)
--------------------------------------------------------------
- As you might already know that only 8 complex GPIOs can be used at a time.
- From the above structure, the member lpp_gpio_pin[8] is for complex GPIO configuration.
- Each element of lpp_gpio_pin corresponds to the configuration of all GPIOs which are equal modulo 8.
Meaning:
the address from 0xe0001000 to 0xe000100f correspond to configuration of GPIO 0, 8,...56
the address from 0xe0001010 to 0xe000101f correspond to configuration of GPIO 1, 9,...57
Your case:
- Make sure that you have selected the corresponding bit in ComplexIO matrix corresponding to GPIO17.
- Then the configuration of complex GPIO 17 starts from address 0xe0001010(since 1 and 17 are equal modulo 8).
- So, 0xe0001010 is for status, 0xe0001014 for timer and so on.
Let me know if you have any questions.
Regards,
Hemanth