IRlib on STM32?

Can someone help me port this library?
victor_pv
Posts: 1337
Joined: Mon Apr 27, 2015 12:12 pm

Re: IRlib on STM32?

Post by victor_pv » Wed Jan 18, 2017 12:05 am

I was looking at that last year, and have intention to continue when i have time to dig the files and then continue with it.

I was using the ST application note linked by Andy in the previous post. That AN is for F0 and F3 chips that include an internal circuit to connect 2 timer outputs, in a way that they will provide an output with the 56Khz, 48Khz, or whatever needed for the IR receiver used in the application.
The F1 lacks that internal circuit, but nothing prevents you from using 2 timer outputs and implementing the circuit on the PCB with a couple of transistors and little more. That was my approach.

I had the code half way translated from the STM std peripheral library to mostly libmaple, but like I said that was last year and I had to put it aside for a long time, so I don't remember how close I was to getting it to work. I remember I had to order IR leds and put it aside and started working on a wav player using a timer to generate a PCM output. I got that working, and I didn't feel the IR stuff was much more complex, but then didn't have time to back to it.
It can definitely use DMA, and I planned to turn to DMA as soon as I had it working, to reduce the CPU load.

I do not think it's complicated. Anyone with a bit of experience in C and the STM32F1 timers should be able to complete it faster than me.

User avatar
GrumpyOldPizza
Posts: 174
Joined: Fri Apr 15, 2016 4:15 pm
Location: Denver, CO

Re: IRlib on STM32?

Post by GrumpyOldPizza » Wed Jan 18, 2017 10:27 pm

victor_pv wrote:I was looking at that last year, and have intention to continue when i have time to dig the files and then continue with it.

I was using the ST application note linked by Andy in the previous post. That AN is for F0 and F3 chips that include an internal circuit to connect 2 timer outputs, in a way that they will provide an output with the 56Khz, 48Khz, or whatever needed for the IR receiver used in the application.
The F1 lacks that internal circuit, but nothing prevents you from using 2 timer outputs and implementing the circuit on the PCB with a couple of transistors and little more. That was my approach.

I had the code half way translated from the STM std peripheral library to mostly libmaple, but like I said that was last year and I had to put it aside for a long time, so I don't remember how close I was to getting it to work. I remember I had to order IR leds and put it aside and started working on a wav player using a timer to generate a PCM output. I got that working, and I didn't feel the IR stuff was much more complex, but then didn't have time to back to it.
It can definitely use DMA, and I planned to turn to DMA as soon as I had it working, to reduce the CPU load.

I do not think it's complicated. Anyone with a bit of experience in C and the STM32F1 timers should be able to complete it faster than me.

Interesting note. Would one want a generic library, or something that can emit RC5 directly ?

victor_pv
Posts: 1337
Joined: Mon Apr 27, 2015 12:12 pm

Re: IRlib on STM32?

Post by victor_pv » Thu Jan 19, 2017 12:11 am

GrumpyOldPizza wrote:

Interesting note. Would one want a generic library, or something that can emit RC5 directly ?
The one I was trying to adapt, base on an application note from STM, can send RC5 and SIRC. I think I was working on the SIRC version, but both were very similar as far as most functions, only a different packet length and structure.
They both used a similar function to capture and send the individual bits, but different functions to format them.

User avatar
KaraWin
Posts: 4
Joined: Sun Mar 19, 2017 9:06 pm

Re: IRlib on STM32?

Post by KaraWin » Sun Mar 19, 2017 9:09 pm

Hi
I made an adaptation for irmp reception for stm32duino.

at https://github.com/karawin/irmp-master

Tested with the blue card.

User avatar
rexnanet
Posts: 190
Joined: Wed Mar 16, 2016 10:34 am

Re: IRlib on STM32?

Post by rexnanet » Tue Apr 11, 2017 9:53 am

KaraWin wrote:Hi
I made an adaptation for irmp reception for stm32duino.

at https://github.com/karawin/irmp-master

Tested with the blue card.
Thanks! I was posting it on the forum and realized you already had done it :)
Have to test it ASAP! :)

User avatar
KaraWin
Posts: 4
Joined: Sun Mar 19, 2017 9:06 pm

Re: IRlib on STM32?

Post by KaraWin » Sat Apr 15, 2017 7:35 pm

Thanks! I was posting it on the forum and realized you already had done it :)
Have to test it ASAP! :)
Ok, let me know.

VadimEL
Posts: 61
Joined: Sat Aug 13, 2016 1:28 pm

Re: IRlib on STM32?

Post by VadimEL » Mon May 01, 2017 8:18 pm

https://github.com/karawin/irmp-master
can not compile :( Maple mini (STM32F103CBT6)


Code: Select all

In file included from C:\Documents and Settings\Vadim\Мои документы\Arduino\hardware\Arduino_STM32\STM32F1\libraries\irmp-master-master/irmp.h:18:0,

                 from C:\HELP\07ELECTRONIK\09MK\20MY\40shpagi\05LCD touch\00progr\24ver\PVS\PVS.ino:165:

C:\Documents and Settings\Vadim\Мои документы\Arduino\hardware\Arduino_STM32\STM32F1\libraries\irmp-master-master/irmpsystem.h:98:22: fatal error: avr/io.h: No such file or directory

 #  include <avr/io.h>

                      ^

compilation terminated.

exit status 1
Ошибка компиляции для платы Maple Mini.

User avatar
KaraWin
Posts: 4
Joined: Sun Mar 19, 2017 9:06 pm

Re: IRlib on STM32?

Post by KaraWin » Mon May 01, 2017 10:10 pm

Something is wrong in your board selection.
You are in
#if defined(ATMEL_AVR)
case.

I made the modification for
#elif defined(BOARD_generic_stm32f103c)

Please change all BOARD_generic_stm32f103c to your mapple mini definition or better, add an ifdef or elif case.
Probably
if defined(ARDUINO_MAPLE_MINI)

They are at
Search "stm32duino" (3 hits in 3 files)
C:\Users\jp\Documents\Arduino\libraries\irmp-master\irmpconfig.h (1 hit)
Line 162: * Change hardware pin here for STM32Duino
C:\Users\jp\Documents\Arduino\libraries\irmp-master\irmpsystem.h (1 hit)
Line 44: #elif defined(BOARD_generic_stm32f103c) // STM32DUINO
C:\Users\jp\Documents\Arduino\libraries\irmp-master\irsndconfig.h (1 hit)
Line 170: * generic_stm32f103c(STM32duino, see IRSEND.ino)

VadimEL
Posts: 61
Joined: Sat Aug 13, 2016 1:28 pm

Re: IRlib on STM32?

Post by VadimEL » Tue May 02, 2017 1:19 am

KaraWin
Thanks, it compile now. I change all to ARDUINO_MAPLE_MINI

Image


Ok found irmpconfig.h and change IN PIN to PA8

Code: Select all

 * Change hardware pin here for STM32Duino
 *---------------------------------------------------------------------------------------------------------------------------------------------------
 */
#elif defined(ARDUINO_MAPLE_MINI)  
#  define IRMP_BIT_NUMBER                       PA8                      // use C15 pin
and change HardwareTimer timer(2);
to
HardwareTimer timer(1);

and it WORK!!! :mrgreen: everyone laughs are all happy :mrgreen: :mrgreen: :mrgreen: Thanks for library =)
Last edited by VadimEL on Tue May 02, 2017 8:18 am, edited 2 times in total.

User avatar
KaraWin
Posts: 4
Joined: Sun Mar 19, 2017 9:06 pm

Re: IRlib on STM32?

Post by KaraWin » Tue May 02, 2017 7:59 am

Yes, you may delete the comment, it is a test to learn many way to implement a timer.
and it WORK!!! :mrgreen: everyone laughs are all happy :mrgreen: :mrgreen: :mrgreen: Thanks for library =)
Great. Enjoy.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest