Strictly necessary cookies are on by default and cannot be turned off. Functional, Performance and Tracking/targeting/sharing cookies can be turned on below based on your preferences (this banner will remain available for you to accept cookies). You may change your cookie settings by deleting cookies from your browser. Then this banner will appear again. You can learn more details about cookies HERE.
Strictly necessary (always on)
Functional, Performance and Tracking/targeting/sharing (default off)
Is there a way to create a 38kHz signal from WICED platform for infrared packet transmission? I would normally prefer to do this sort of programming on a separate MCU which is not running any OS/framework so that I can have control over timings. Is there any specific way time-accurate functions can be implemented in such environments?
The idea is that there are two states for the output:
ON = toggled at 38kHz (freq changeable by the program)
OFF = Not toggled.
The communication will take place based on the lengths of ON and OFF. The timings need to be accurate to nearest microsecond.
The problem is that WICED has a thread-based OS, which may not be able to deliver exact timings. I thought of two ways this can be approached.
1) Using native MCU timers to achieve the above mentioned requirements (devboard based on STM32F2xx MCU)
2) Using SPI to transmit required data as a stream.
The problem with SPI is that I cannot define clock rate below 234kHz due to some prescalar limitation. And even if I use >235kHz clock speed, there is no guarantee that clock will always be at this speed (thus affecting the timings)
As for using Timer functionality of the MCU, I am not sure how to approach it. There is a STM32F2xx peripheral library which provides functions for output compare using TIM1 and TIM8. My approach in this case will be to use these Timers with DMA to output required waveform with accurate timings. Now the question is, are these timers being used by some other functions? Will defining them cause any problem on the system, and how to use them under WICED environment?
Also, has anyone been able to successfully use the Timers or implemented IR control on WICED platform? It would be quite helpful you can share your experience.
No, I was not able to use the native timers. It would be great if someone could help with that, as that would greatly help in controlling the infrared transmission.
As for infra-red communication, the way it works is there are periods of highs and lows modulated with a certain frequency (38kHz) in my case.
Reading IR Comm: I'm using an infra-red receiver of 38kHz which is gives high or low based on whether it is receiving the modulated signal or there is silence. This signal is inputted to the SPI on MCU and clocks are counted for highs and lows (i.e. duration of highs and lows).
Transmitting IR: Similarly, transmission is carried out using SPI as well. Using the same clock speed, the SPI buffer is filled with 0's and 1's and transmitted through DMA. Before going to the transmitter it is modulated at 38KHz.
Hence, a timer would significantly reduce the memory usage when transmitting and receiving. When receiving, all I need to know is the duration of highs and lows. And same for transmitting, all I need to provide is the duration of highs and lows.
Additionally, it would be great if I could clock the received signal at higher frequency than modulation (at least twice) to detect the frequency of the received signal. And similarly be able to modulate the signal internally, rather than requiring additional circuitry outside of the MCU.
If anyone has better ideas, it would be appreciated?