- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
i am using 4 GPIO pins. Two are INPUT Configure as button input.
wiced_hal_gpio_configure_pin(WICED_P32,GPIO_INPUT_ENABLE|GPIO_PULL_UP|GPIO_EN_INT_RISING_EDGE,GPIO_PIN_OUTPUT_LOW);
wiced_hal_gpio_configure_pin(WICED_P31,GPIO_INPUT_ENABLE|GPIO_EN_INT_FALLING_EDGE,GPIO_PIN_OUTPUT_HIGH);
wiced_hal_gpio_register_pin_for_interrupt( WICED_P32, hello_sensor_interrupt_handler, NULL );
wiced_hal_gpio_register_pin_for_interrupt( WICED_P31, hello_sensor_interrupt_handler, NULL );
AND i am using the smae interrupt handler for both the buttons? is this okay?
Two as Output pin Configure as LED output
wiced_hal_gpio_configure_pin(WICED_P28,GPIO_OUTPUT_ENABLE,GPIO_PIN_OUTPUT_HIGH);
wiced_hal_gpio_configure_pin(WICED_P30,GPIO_OUTPUT_ENABLE,GPIO_PIN_OUTPUT_LOW);
1. As i press button, i get output as my LED glows, but when i switch off the module, that time the output led glows? Does it mean Interrupt is detected? Any debouncing logic?
2. Sometimes my CYBT-343026-01 gets hang i think becuase it doesn't perform the function, so i restart it by switching on and off power?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I think, the restart happens due to wiced_hal_gpio_configure_pin(WICED_P31,GPIO_INPUT_ENABLE|GPIO_EN_INT_RISING_EDGE,GPIO_PIN_OUTPUT_HIGH);
The pin WICED_P31 is already used as WICED_PUART_TXD (check wiced_platform.h) and it is configured in APPLICATION_START in hello_sensor.c.
#define WICED_PUART_TXD WICED_P31 /* ARM GPIO pin for PUART TXD */
#define WICED_PUART_RXD WICED_P04 /* ARM GPIO pin for PUART RXD */
#define WICED_PUART_CTS WICED_P03 /* pin for PUART CTS (I2C_SCL, P3, P29, P35) */
#define WICED_PUART_RTS WICED_P30 /* pin for PUART RTS (BT_GPIO_7, P30) */
I believe you are using WICED Studio for the development. I would suggest you to use Modustoolbox IDE, and repeat the experiment.
Latest features and bug fixes will be applied to Modustoolbox. (CYBT-343026-01 is supported).
https://www.cypress.com/products/modustoolbox-software-environment
Thanks,
-Dheeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
"but when i switch off the module,that time the output led glows" -> Could you explain? How do you turn of the board?
Could you please try to configure the both buttons witih GPIO_PULL_UP or GPIO_PULL_DOWN.
Not sure why the board hangs for you. Could you please share you code snippet where you have implemented this logic?
I will try to reproduce the issue at my side.
Thanks,
-Dheeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello, DheerajP_41
By switch off means, when i Turn off the Power supply. Below i have attached my code. Anf if i am connected to CYSMART android app, after some time it automatically disconnect itself? and module automatically resets.
Thank You.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I think, the restart happens due to wiced_hal_gpio_configure_pin(WICED_P31,GPIO_INPUT_ENABLE|GPIO_EN_INT_RISING_EDGE,GPIO_PIN_OUTPUT_HIGH);
The pin WICED_P31 is already used as WICED_PUART_TXD (check wiced_platform.h) and it is configured in APPLICATION_START in hello_sensor.c.
#define WICED_PUART_TXD WICED_P31 /* ARM GPIO pin for PUART TXD */
#define WICED_PUART_RXD WICED_P04 /* ARM GPIO pin for PUART RXD */
#define WICED_PUART_CTS WICED_P03 /* pin for PUART CTS (I2C_SCL, P3, P29, P35) */
#define WICED_PUART_RTS WICED_P30 /* pin for PUART RTS (BT_GPIO_7, P30) */
I believe you are using WICED Studio for the development. I would suggest you to use Modustoolbox IDE, and repeat the experiment.
Latest features and bug fixes will be applied to Modustoolbox. (CYBT-343026-01 is supported).
https://www.cypress.com/products/modustoolbox-software-environment
Thanks,
-Dheeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi DheerajP_41,
Thank you for your help.
I think I was doing one more mistake, by calling hello_sensor_led_blink(500,500,1); in hello_srnsor_fine_timeout() function which is a callback for every 1 ms. It might leads to a recursive function?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Yes, I think so.
hello_sensor_fine_timeout() is configured to call every 1ms by hello_sensor_ms_timer. hello_sensor_led_blink( 500, 500, 1) will start the LED timer (hello_sensor_led_timer) with "on_ms" (500ms) value as timeout. If we call hello_sensor_led_blink( 500, 500, 1) inside hello_sensor_fine_timeout(), LED may not work as expected.
Thanks,
-Dheeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content