🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Enabling IRda on Serial 2

    Scheduled Pinned Locked Moved Arduino
    infraredirdaserialarduino
    4 Posts 3 Posters 14.1k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Q Offline
      quangan
      last edited by

      I'm trying to enable IRda TX and RX in the configuration for my M5core in Arduino. I saw in the documentation that this is possible: https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/peripherals/uart.html#api-reference

      However, I don't know what library functions in Arduino I need to call to enable this.

      Here's my code so far:

      #include <M5Stack.h>

      void setup() {

      M5.begin();

      Serial.begin(115200);

      // Serial2.begin(unsigned long baud, uint32_t config, int8_t rxPin, int8_t txPin, bool invert)
      Serial2.begin(115200, SERIAL_8N1, 22, 21,0);
      }

      Any pointers on how to enable IRda tx and rx would be much appreciated! OR please show me where to look for the right configuration keyboard/syntax!

      Thank you!

      m5-docsM 1 Reply Last reply Reply Quote 0
      • m5-docsM Offline
        m5-docs @quangan
        last edited by

        @quangan
        Hi Maybe you can refer to this article.

        https://www.esp32.com/viewtopic.php?t=276

        /* IRda transmitter */
        
        //HardwareSerial Serial1(1);
        HardwareSerial Serial2(2); // GPIO 17: TXD U2  +  GPIO 16: RXD U2
        
        void setup() {
            Serial.begin (115200); // (USB + TX/RX) to check
            Serial2.begin(115200); // GPIO 17: TXD U2  +  GPIO 16: RXD U2
        
            //UART_CONF0_REG  Configuration register 0
            //UART0: 0x3FF40020
            //UART1: 0x3FF50020
            //UART2: 0x3FF6E020
        
            WRITE_PERI_REG( 0x3FF6E020 , READ_PERI_REG(0x3FF6E020) | (1<<16 ) | (1<<10 ) );  //UART_IRDA_EN + UART_IRDA_TX_EN  "Let there be light"
            //Serial.print("Reg: "); Serial.println(READ_PERI_REG(0x3FF6E020),BIN);  //For Debug only
        }//setup
        
        void loop() {
            Serial.println("Hello");
            Serial2.println("Hello");
            delay(1000);
        } //loop
        

        M5Stack documentation URL

        https://docs.m5stack.com

        B 1 Reply Last reply Reply Quote 0
        • B Offline
          bigjim991 @m5-docs
          last edited by

          @m5-docs The link should be https://esp32.com/viewtopic.php?t=2766
          (add one 6 to the end)

          1 Reply Last reply Reply Quote 0
          • B Offline
            bigjim991
            last edited by

            Does anyone know how to 'redirect' the UART on Pin 17 for sending to Pin 9. This since the IR-Led on the M5StickC and others within the M5-Family is build connected to Pin 9. It would be interesting to have that light use the irDA protocol, since it is already available inside it.

            1 Reply Last reply Reply Quote 0

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            • First post
              Last post