Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serial Monitor does not send data to Arduino (2.0.0 rc7) #1051

Closed
3 tasks done
tigoe opened this issue Jun 12, 2022 · 7 comments
Closed
3 tasks done

Serial Monitor does not send data to Arduino (2.0.0 rc7) #1051

tigoe opened this issue Jun 12, 2022 · 7 comments
Assignees
Labels
conclusion: duplicate Has already been submitted topic: serial monitor Related to the Serial Monitor type: imperfection Perceived defect in any part of project

Comments

@tigoe
Copy link
Member

tigoe commented Jun 12, 2022

Describe the problem

Serial Monitor does not send data to Arduino

To reproduce

  1. Open File -> Examples -> Communications -> Physical Pixel
  2. Change ledPin to LED_BUILTIN
  3. open serial monitor
  4. Type H then enter
  5. nothing happens
  6. Type L then enter
  7. nothing happens
  8. Repeat steps 4 - 7 until you are satisfied

For other tests, try File -> Examples -> Communications -> ReadAsciiString. Same results.

All sketches respond just fine in other serial terminals, such as CoolTerm or Serial Studio

Expected behavior

The LED should turn on with H and off with L. With the ReadAsciiString sketch, I should get three values back in hexadecimal.

Arduino IDE version

2.0.0-rc7

Operating system

macOS

Operating system version

12.4 (21F79)

Additional context

Same results on Windows 11.

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the latest nightly build
  • My report contains all necessary details
@tigoe tigoe added the type: imperfection Perceived defect in any part of project label Jun 12, 2022
@per1234 per1234 added the topic: serial monitor Related to the Serial Monitor label Jun 13, 2022
@per1234 per1234 self-assigned this Jun 13, 2022
@per1234
Copy link
Contributor

per1234 commented Jun 13, 2022

Hi @tigoe

Type H then enter

Unlike the Arduino IDE 1.x Serial Monitor, it is currently necessary to use Ctrl+Enter rather than just Enter alone in order to send data to the board from Serial Monitor (#572).

Please give that a try and then let me know whether the issue still occurs for you.

@per1234 per1234 added the status: waiting for information More information must be provided before work can proceed label Jun 13, 2022
@PaulStoffregen
Copy link
Sponsor

fwiw, I tried it on Linux with Arduino Zero and Teensy 4.1 (to also check whether any difference exists between Teensy's pluggable monitor and Arduino's implementation).

Even having just read this, my fingers still didn't hold the CTRL key on the first few tries! So awkward.

Can confirm, both do change their LED running the PhysicalPixel example when I use CTRL+Enter to send.

@PaulStoffregen
Copy link
Sponsor

Slightly off-topic, 04.Communication > PhysicalPixel has pin 13 hard coded. Might be good to update it to LED_BUILTIN for compatibility with Arduino's newer products...

@ubidefeo
Copy link

@PaulStoffregen
I have made a PR for that LED_BUILTIN

@tigoe
Copy link
Member Author

tigoe commented Jun 13, 2022

Thanks for the PR, @ubidefeo . I agree with @PaulStoffregen on that.

Taking my response to #572 per @per1234 's instructions

@per1234 per1234 removed the status: waiting for information More information must be provided before work can proceed label Jun 13, 2022
@per1234
Copy link
Contributor

per1234 commented Jun 13, 2022

Thanks everyone. Since we now know that the issue was caused by #572, I will close this issue in favor of the other one.

@KurtE
Copy link

KurtE commented Jun 15, 2022

On this issue, I am running into this issue of not receiving data from the the Serial Monitor.
I am running today's daily build 0615.

The below sketch... Which maybe a pain to setup... but uses the new Teensy install, plus MTP_Teensy from my github...

Note: I ran into this with another sketch yesterday (MakeFiles from defragster...)

#include <SD.h>
#include <MTP_Teensy.h>

#define CS_SD BUILTIN_SDCARD  // Works on T_3.6 and T_4.1

#ifdef ARDUINO_TEENSY41
extern "C" uint8_t external_psram_size;
#endif

class RAMStream : public Stream {
public:
  // overrides for Stream
  virtual int available() { return (tail_ - head_); }
  virtual int read() { return (tail_ != head_) ? buffer_[head_++] : -1; }
  virtual int peek() { return (tail_ != head_) ? buffer_[head_] : -1; }

  // overrides for Print
  virtual size_t write(uint8_t b) {
    if (tail_ < buffer_size) {
      buffer_[tail_++] = b;
      return 1;
    }
    return 0;
  }

  enum { BUFFER_SIZE = 32768 };
//  uint8_t buffer_[BUFFER_SIZE];
  uint8_t *buffer_ = nullptr;
  uint32_t buffer_size = BUFFER_SIZE;
  uint32_t head_ = 0;
  uint32_t tail_ = 0;
};

RAMStream rstream;

//#define CS_SD 10  // Works on SPI with this CS pin
void setup()
{

  // see if external memory
#ifdef ARDUINO_TEENSY41
  if (external_psram_size) {
    rstream.buffer_size = 2097152;
    rstream.buffer_ = (uint8_t*)extmem_malloc(rstream.buffer_size);
    Serial.printf("extmem_malloc %p %u %u\n", rstream.buffer_, rstream.buffer_size, external_psram_size);
  }
#endif
  if (!rstream.buffer_) {
    rstream.buffer_ = (uint8_t*)malloc(rstream.buffer_size);
    Serial.printf("malloc %p %u\n", rstream.buffer_, rstream.buffer_size);
  }


  // mandatory to begin the MTP session.
  //MTP.begin();

  Serial.begin(9600);
  while (!Serial && millis() < 5000) {
    // wait for serial port to connect.
  }

  // Add SD Card
  if (SD.begin(CS_SD)) {
    MTP.addFilesystem(SD, "SD Card");
    Serial.println("Added SD card using built in SDIO, or given SPI CS");
  } else {
    Serial.println("No SD Card");
  }
  Serial.println("\nSetup done");
}


uint8_t print_buffer[256];
void print_capture_data() {

  #ifdef ARDUINO_TEENSY41
  Serial.printf("Capture size: %d out of %d PS:%u\n", rstream.available(), rstream.buffer_size, external_psram_size);
  #else
  Serial.printf("Capture size: %d out of %d\n", rstream.available(), rstream.buffer_size);
  #endif
  
  int avail;
  while ((avail = rstream.available())) {
    if (avail > (int)sizeof(print_buffer)) avail = sizeof(print_buffer);

    int avail_for_write = Serial.availableForWrite();
    if (avail_for_write < avail) avail = avail_for_write;
    rstream.readBytes(print_buffer, avail);
    Serial.write(print_buffer, avail);

  } 


  int ch;
  while ((ch = rstream.read()) != -1)
    Serial.write(ch);
}

void loop() {
  MTP.loop();  //This is mandatory to be placed in the loop code.

  if (Serial.available()) {
    uint8_t command = Serial.read();
    switch (command) {
    case 'c':
      // start capture debug info
      rstream.head_ = 0;
      rstream.tail_ = 0;
      MTP.PrintStream(&rstream); // Setup which stream to use...
      Serial.println("Capturing MTP debug output");
      break;
    case 's':
      Serial.println("Stop Captured data");
      rstream.head_ = 0;
      rstream.tail_ = 0;
      break;
    case 'p':
      MTP.PrintStream(&Serial); // Setup which stream to use...
      Serial.println("Print Captured data");
      print_capture_data();
      rstream.head_ = 0;
      rstream.tail_ = 0;
      break;
    case 'd':
      // first dump list of storages:
      {
        uint32_t fsCount = MTP.getFilesystemCount();
        Serial.printf("\nDump Storage list(%u)\n", fsCount);
        for (uint32_t ii = 0; ii < fsCount; ii++) {
          Serial.printf("store:%u storage:%x name:%s fs:%x\n", ii,
                        MTP.Store2Storage(ii), MTP.getFilesystemNameByIndex(ii),
                        (uint32_t)MTP.getFilesystemNameByIndex(ii));
        }
        Serial.println("\nDump Index List");
        MTP.storage()->dumpIndexList();
      }
      break;
    default:  
      Serial.println("Menu");
      Serial.println("\t c - start capture debug data");
      Serial.println("\t p - Stop capture and print");
      Serial.println("\t s - stop capture and discard");
      Serial.println("\t d - dump storage info");
    }
    while (Serial.read() != -1);
  }

}

In this build I built on Teensy Micromod and did USB type = MTP Disk
This uses the SEREMU (Serial emulation)

I tried entering the simple commands, like d and no response.
I tried just (holding the CTRL key and did not see the simple menu printed...

Now going to build with USB Type: Serial + MTP

Same results. However If I choose COM60 over the Teensy port, then it appears like I do receive the input.
image

So maybe the plugable serial is not receiving the data.

@per1234 per1234 closed this as not planned Won't fix, can't repro, duplicate, stale Jun 17, 2022
@per1234 per1234 added the conclusion: duplicate Has already been submitted label Jul 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: duplicate Has already been submitted topic: serial monitor Related to the Serial Monitor type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

5 participants