IRMP-org / IRMP

Infrared Multi Protocol Decoder
GNU General Public License v3.0
273 stars 44 forks source link

Library not working on STM32L Series #14

Closed ninadshah18 closed 3 years ago

ninadshah18 commented 4 years ago

Bug Report

Arduino Platform

IDE

IR-Protocol

Example to reproduce the issue

Pin(s) used for IR-receive, if not default

Version

Current behavior

/*

include

/*

include

/*

//#define STM32F1xx //#define STM32L4xx

define IRSND_OUTPUT_PIN 3

IRMP_DATA irsnd_data;

void setup() { Serial.begin(115200);

if defined(__AVR_ATmega32U4__)

while (!Serial); //delay for Leonardo, but this loops forever for Maple Serial

endif

if defined(SERIAL_USB) || defined(SERIAL_PORT_USBVIRTUAL)

delay(2000); // To be able to connect Serial monitor after reset and before first printout

endif

if defined(ESP8266)

Serial.println(); // to separate it from the internal boot output

endif

// Just to know which program is running on my Arduino
Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_IRMP));

irsnd_init();
irmp_irsnd_LEDFeedback(true); // Enable send signal feedback at LED_BUILTIN

if defined(STM32F1xx)

Serial.println(F("Ready to send IR signals at pin PA5")); // the internal pin numbers are crazy for the STM32 Boards library

else

Serial.println(F("Ready to send IR signals at pin " STR(IRSND_OUTPUT_PIN)));

endif

irsnd_data.protocol = IRMP_SAMSUNG32_PROTOCOL;
irsnd_data.address = 0x0707;
irsnd_data.command = 0xFB04;
irsnd_data.flags = 0; // repeat frame 0 time

Serial.print(F("Send 0x"));
Serial.println(irsnd_data.command, HEX);
irsnd_send_data(&irsnd_data, false);

}

void loop() { delay(5000); uint8_t tNextCommand = irsnd_data.command; tNextCommand++; // For my Samsung the high byte is the negative of the low byte irsnd_data.command = ((~tNextCommand) << 8) | tNextCommand;

// #if defined(STM32F1xx) // Serial.println(F("Ready to send IR signals at pin PA5")); // the internal pin numbers are crazy for the STM32 Boards library //#else Serial.println(F("Ready to send IR signals at pin " STR(IRSND_OUTPUT_PIN))); //#endif

Serial.print(F("Send 0x"));
Serial.println(irsnd_data.command, HEX);
irsnd_send_data(&irsnd_data, false); // This stores timer state and restores it after sending

}

I am expecting IR LED to blink when seen from the camera but it was not blinking.

Expected behavior

I am expecting that the connecter IR LED should blink when IR code is being emitted.

Error output

Additional context

ArminJo commented 4 years ago

Where do you connect the IR LED? For testing it is easier to connect a standard LED. Did you check other pins (especially pin4)? Where is the #define IRSND_OUTPUT_PIN 3 used? Where should it be used? I just updated the repository. Please using the new repo content for testing.

ninadshah18 commented 4 years ago

I have removed #define IRSND_OUTPUT_PIN 3 and used default pin 4 but still, it is not working. BTQ pin4 for STM32L476 is not a PWM pin. I have pulled the latest repository from master as below but still, it is not blinking.

~/Arduino/libraries/IRMP$ git pull remote: Enumerating objects: 18, done. remote: Counting objects: 100% (18/18), done. remote: Compressing objects: 100% (4/4), done. remote: Total 18 (delta 14), reused 18 (delta 14), pack-reused 0 Unpacking objects: 100% (18/18), done. From github.com:ukw100/IRMP abca5bc..4664059 master -> origin/master Updating abca5bc..4664059 Fast-forward .github/issue_template.md | 1 + examples/AllProtocols/PinDefinitionsAndMore.h | 10 +++++++++- examples/Callback/PinDefinitionsAndMore.h | 10 +++++++++- examples/Interrupt/PinDefinitionsAndMore.h | 10 +++++++++- examples/MinimalReceiver/PinDefinitionsAndMore.h | 10 +++++++++- examples/OneProtocol/PinDefinitionsAndMore.h | 10 +++++++++- examples/RFProtocols/PinDefinitionsAndMore.h | 10 +++++++++- examples/ReceiveAndSend/PinDefinitionsAndMore.h | 10 +++++++++- examples/ReceiveAndSendDynamicPins/PinDefinitionsAndMore.h | 10 +++++++++- examples/SimpleReceiver/PinDefinitionsAndMore.h | 10 +++++++++- examples/SimpleSender/PinDefinitionsAndMore.h | 10 +++++++++- src/IRTimer.cpp.h | 3 +++ 12 files changed, 94 insertions(+), 10 deletions(-)

ArminJo commented 4 years ago

The pins etc. must be defined BEFORE the line #include

ninadshah18 commented 4 years ago

I have already defined it before #include I feel that the library is not supporting STM32L series, it supports only STM32F1 series. Please, verify.

ArminJo commented 4 years ago

How and where do you specify, that you have STM32L Series?

ninadshah18 commented 4 years ago

I haven't specify it anywhere as there is no specific code for STM32L series. So, it takes default configuration and code path. My thinking is STM32L may require some extra processing or configuration which is not supported in current library of IRMP.

ArminJo commented 4 years ago

OK I added some definitions. Please try the latest version from the repo.

ninadshah18 commented 4 years ago

I have tried with both default pin (pin 4) and custom defined pin (pin 3), but still it didn't work.

ArminJo commented 3 years ago

I updated the repo. Please activate #define IRMP_MEASURE_TIMING in PinDefinitionsAndMore.h and connect a LED to this pin. It must flicker.

ninadshah1 commented 3 years ago

I tried #define IRMP_MEASURE_TIMING 3 but still no flickering.

ArminJo commented 3 years ago

Have you checked the other examples? Just to be sure time is working.

elexal commented 3 years ago

hi this library for stm32f1 problem my code : `#include

include "PinDefinitionsAndMore.h"

//#define IRMP_PROTOCOL_NAMES 1

include

include

//#include

include

IRMP_DATA irmp_data; IRMP_DATA irsnd_data;

void setup() { Serial1.begin(115200); // irmp_init(); irsnd_init(); irmp_irsnd_LEDFeedback(true); // Enable send signal feedback at LED_BUILTIN

irsnd_data.protocol = IRMP_SAMSUNG32_PROTOCOL; irsnd_data.address = 0x0707; irsnd_data.command = 0xFB04; irsnd_data.flags = 0; // repeat frame 0 time irsnd_send_data(&irsnd_data, false); }

void loop() {

delay(500);

uint8_t tNextCommand = irsnd_data.command;
tNextCommand++;
// For my Samsung the high byte is the negative of the low byte
irsnd_data.command = ((~tNextCommand) << 8) | tNextCommand;
Serial.print(F("Send 0x"));
Serial.println(irsnd_data.command, HEX);
irsnd_send_data(&irsnd_data, false); // This stores timer state and restores it after sending

}`

when #include is activated, there is a problem to send ir & when this line is active it cant send ir code ,when this line isdeactive then ir send ok, but receiver both mode is ok ! note: but when they are activated alone in each project they work all right ! but both

include

include

together not ok !

ArminJo commented 3 years ago

Thanks for reporting the error. You forgot to define USE_ONE_TIMER_FOR_IRMP_AND_IRSND and the automatic warning failed. I fixed the warning now in the new release.