- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm new to this product so I apologize in advance if I'm missing something obvious.
I have an application where I need a period interrupt at around 1 KHz, (1 ms or so). I don't see an obvious way to generate this. The fine-time timer provided by the ble_ interface seems to have 12.5 ms resolution.
To take a step back, as there may be another approach: I'm trying to generate a couple PWM waveforms with a period of 25 Hz, (40 ms). The slowest clock to the PWM hardware seems to be 128 KHz, and the PWM hardware has only a 10 bit counter...which gets me a 5 ms period. Not quite slow enough!
Any thoughts are greatly appreciated.
Or a dope slap, that's even better, actually.
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi damaiano,
please refert to following the code to generate about 25Hz PWM.
aclk_configure(25500, ACLK1, ACLK_FREQ_24_MHZ);
pwm_start(PWM2, PMU_CLK, 0x200, 0);
gpio_configurePin((GPIO_PIN_LED) / 16, (GPIO_PIN_LED) % 16, (2 << 4), 0);
BTW, the ACLK_FREQ_24_MHZ will no function when 2073x is sleep, so you must use the function devlpm_registerForLowPowerQueries to let 2073x keep awake.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi!
Can you clarify if you need your BLE application to be interrupted every 1ms or you are looking for ways to generate a pulse out on a GPIO every 1ms to an external device?
Thanks,
Johan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I need to generate an output pulse on a GPIO. Problem is the signal (25 Hz) is too slow for the PWM--near as I can tell. That's why I was thinkig to do it with a periodic interrupt. 1 ms resolution is not critical. 25 Hz is.
Thanks! Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I see there is a hw_timer.h module that looks very useful.
Is there someplace I can read about this?
I guess I'm also having trouble finding documentation on things.
I also see that the PWM can use a programmable clock from the aclk.h module.
Where can I learn what range of clocks can be generated from the aclk module?
Thanks again!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The API documentation we provide is available within the SDK by accessing: /WICED-Smart-SDK/Doc/API.html
I see that aclk.h is mentioned within these docs, but not hw_timer.h.
In addition, much of the code provided includes inline documentation in the form of comments.
For using the PWM, the pmw_tone application is an excellent place to start. There's also a number of existing threads on the site related to PWM setup: WICED Smart Forums
Perhaps one of the other users know how to generate an interrupt at around 1 KHz (1 ms or so).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi damaiano,
please refert to following the code to generate about 25Hz PWM.
aclk_configure(25500, ACLK1, ACLK_FREQ_24_MHZ);
pwm_start(PWM2, PMU_CLK, 0x200, 0);
gpio_configurePin((GPIO_PIN_LED) / 16, (GPIO_PIN_LED) % 16, (2 << 4), 0);
BTW, the ACLK_FREQ_24_MHZ will no function when 2073x is sleep, so you must use the function devlpm_registerForLowPowerQueries to let 2073x keep awake.
- 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
Ok, thanks zhaohua I haven't had a chance to try this yet, but it looks simple enough.
Is there documentation on the range of clock values that can be generated with aclk_configure()?
I will try this out this out and get back.
Thanks again
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I cannot find a specific range of clock values for aclk_configure within the API documentation.
I see where this function is traced back into aclk.h:
void aclk_configure ( UINT32 frequency,
UINT32 src,
UINT32 freqSel
)
Configures an ACLK reference channel.
Parameters
frequency The desired frequency.
src The ACLK channel we are configuring. The internal reference fequency to use to
generated the desired frequency
Nothing specific.
There are some good references in this thread: Different Frequencies for PWM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content