- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi.
I have a 1ms timed event that is supposed to poll a GPIO input every time it runs.
However, after boot up the timed event only runs once.
If I change the time period to 5 ms, the timed event seems to run the function quite regularly.
/******************************************************
* Constants
******************************************************/
#define SAMPLING_PERIOD (1 * MILLISECONDS)
#define BUTTON (WICED_GPIO_26) //Pin 30
#define RELAY_CTRL_OUTPUT (WICED_GPIO_23)
#define BUTTON_STATE_PERSISTENCE_WAIT_TIME (100)
/******************************************************
* Static Function Declarations
******************************************************/
static wiced_result_t sampling_thread(void* arg);
/******************************************************
* Variable Definitions
******************************************************/
static wiced_timed_event_t button_sampling_timed_event;
/* relay */
static wiced_bool_t g_relay_state = WICED_FALSE;
void application_start( )
{
/* Initialise the WICED device */
wiced_init();
/* initialize the button input */
/* button input */
if( wiced_gpio_init( BUTTON, INPUT_HIGH_IMPEDANCE ) == WICED_SUCCESS ) {
printf("Success: Button is set as GPIO i/p with high impedance\n");
} else {
printf("Failure: Button is set as GPIO i/p with high impedance\n");
}
/* initialize the relay to open */
g_relay_state = WICED_FALSE;
wiced_gpio_output_low(RELAY_CTRL_OUTPUT);
/* Setup a timed event that will toggle RGB leds */
wiced_rtos_register_timed_event( &button_sampling_timed_event, WICED_HARDWARE_IO_WORKER_THREAD, sampling_thread, SAMPLING_PERIOD, 0 );
}
static wiced_result_t sampling_thread(void* arg)
{
UNUSED_PARAMETER( arg );
current_button_state = wiced_gpio_input_get( BUTTON ) ? WICED_TRUE : WICED_FALSE;
printf("current_button_state = %u\n", current_button_state);
return WICED_SUCCESS;
}
This is on Inventek's ISM43341_M4G_L44 platform.
- Labels:
-
GPIO
-
Interrupts
-
SDK 3.x
-
Wifi+Bluetooth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Starting WICED v3.7.0
Platform ISM43341_M4G_L44 initialised
Started ThreadX v5.6
Initialising NetX_Duo v5.7_sp2
Creating Packet pools
WWD SDIO interface initialised
WLAN MAC Address : C4:7F:51:81:B1:B7
WLAN Firmware : wl0: Nov 25 2015 14:01:39 version 6.49.2 (r602357) FWID 01-1302682f
Success: SolControl Button is set as GPIO i/p with high impedance
current_button_state = 1
current_button_state = 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Adding dickb and als@inventeksys.com from Inventek. I'm not sure if they've tested their module yet with SDK 3.7.0
- 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
Which RTOS you used ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Compiled it with ThreadX/NetX duo.
Manish-Kochhal:WICED-SDK-MFi-3.7.0$ ./make snip.button-ISM43341_M4G_L44
MAKEFILE MAKECMDGOALS=snip.button-ISM43341_M4G_L44 OTA2_SUPPORT is disabled
Building Bootloader
Finished Building Bootloader
snip.button-ISM43341_M4G_L44
----------------------------------|---------|---------|
| | Static |
Module | Flash | RAM |
----------------------------------+---------+---------|
App | 275 | 58 |
crc | 1060 | 0 |
Host MCU-family library | 13985 | 2481 |
Interrupt Vectors | 388 | 0 |
libc | 23347 | 3064 |
Networking | 989 | 8523 |
NetX-Duo - Interfaces & Stacks | 0 | 16 |
Other | 3678 | 92 |
Packet Buffers | 0 | 23086 |
platform | 1092 | 172 |
RAM Initialisation | 2316 | 0 |
resources | 16 | 0 |
Ring_Buffer | 112 | 0 |
Startup Stack & Link Script fill | 9 | 5 |
ThreadX | 7932 | 396 |
Wi-Fi Firmware | 374644 | 0 |
WICED | 2918 | 932 |
WWD | 12055 | 2995 |
----------------------------------+---------+---------|
TOTAL (bytes) | 442500 | 41820 |
----------------------------------|---------|---------|
Build complete
Making .gdbinit
Manish-Kochhal:WICED-SDK-MFi-3.7.0$
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Rather than poll, could you set up an interrupt on your GPIO instead?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Andrew,
Hi.
Thanks. I have thought about using this. However, as of now, 1 ms timed event is broken on WICED-3.7.0 and ISM43341 platform. It works well with the same hardware on WICED-3.5.1.
I am curious why that would be the case? I mean ThreadX version hasnt changed yet, it is still v5.6 unless some patches were applied in WICED-3.7.0 SDK?
Regards,
Manish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
andrew997 wrote:
Rather than poll, could you set up an interrupt on your GPIO instead?
No.
This is a regression.
The correct thing to do is find the bad commit and either revert it or fix it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks. I completely agree, the context in which the 1ms timer is used is irrelevant ... It could have been used to consume bytes coming from the RX UART buffer on a 1ms basis.
This is clearly a regression.