Sorry for the delay. This is a little bit outside the scope of this forum, since we don't have the tools we need to test this and time to implement.
If you run into SDK issues when you try to implement this, maybe we can help you along at that time?
I was able to use SPI and DMA to perform IR transmission.
Just used SPI to transmit highs or lows for a required length of times and used external oscillator to modulate the IR signal at required frequency (38kHz).
I will upload my strategy at a later stage, once I get time to finalize it. But, I was looking for something more elegant, like using timers and DMA to achieve the same.
Were you able to use the native timer?
Sorry for the late reply.
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?
I'm using the SN8200 platform based on the STM32F103 MCU. I managed to use the native timer with the normal procedure:
- Enable the clock and configure the timer
- Configure the priority and sub-priority (NVIC configuration)
- Enable the timer and the interrupt
- Clear the interrupt bit in the handler
It's very important that you use the correct name for the handler (located in the interrupt vector table in the startup code).
Discussion is being locked. If you have any follow-up, please start a new discussion.