-
-
Notifications
You must be signed in to change notification settings - Fork 6
Arduino IDE 2.0 problem with ESP32-CAM-MB and Module CH340G #17
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
Comments
Hi @Erhie ! I've read the discussion on the forum, it's a really bad issue. I'd like to send you a small terminal program written in golang to try out, to further reduce the possible causes. May you compile a golang program in case? |
package main
import (
"fmt"
"os"
"strconv"
"go.bug.st/serial"
)
func usage() {
fmt.Println("Usage: term <PORT> [baudrate]")
os.Exit(1)
}
func main() {
args := os.Args[1:]
if len(args) == 0 {
usage()
}
portname, args := args[0], args[1:]
baudrate := 9600
if len(args) > 0 {
if b, err := strconv.Atoi(args[0]); err != nil {
fmt.Println("Invalid baudrate:", args[0])
os.Exit(1)
} else {
baudrate = b
}
args = args[1:]
}
if len(args) > 0 {
usage()
}
port, err := serial.Open(portname, &serial.Mode{BaudRate: baudrate})
if err != nil {
fmt.Printf("Error opening serial port %s: %s\n", portname, err)
os.Exit(2)
}
var buff [1024]byte
for {
n, err := port.Read(buff[:])
if err != nil {
fmt.Println("Error reading from serial port:", err)
break
}
if n == 0 {
fmt.Println("Timeout reading from serial port.")
continue
}
os.Stdout.Write(buff[:n])
}
port.Close()
} ok this is the program, it should be run like this:
Otherwise you can use this precompiled term.exe, you should run it the same:
|
I've been looking at the Arduino IDE 1.8.x source code and I see that the IDE is explicitly setting RTS/CTS: On the IDE 1.8 they are always enabled (unless specified otherwise), instead on the IDE 2.0/CLI they are left "untouched". It may be that the board you're using requires an explicit activation of those bits, something to try out. |
@Erhie |
|
now I test IDE 2.0 rc9.1 int i = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
// Serial.setDebugOutput(true); uncommented by OpaErhard
Serial.println();
}
void loop() {
// put your main code here, to run repeatedly:
Serial.println(i++);
} |
Thanks @Erhie. Are you able to run the test that was requested above at this comment? Please let us know if you have any questions or problems. |
sorry, I have problems with Go with VS code don't know how to fix it because all helps are for Linux alike |
It seems you have a file named I'll provide complete instructions (omitting installation of Go since I can see you already have it):
Please let me know if you have any questions or problems while following those instructions. After executing the Once you are finished, you can exit the program by pressing Ctrl+C. If you prefer, you can also try the executable provided by @cmaglie in the previous reply:
Unfortunately, Windows Defender was not happy about the file when I downloaded it to my computer, so it is possible you will have difficulty with that approach as well, but maybe worth a try if building the program from source is not convenient? |
Thank you for your patience with me. |
now:
|
sorry, more packages are need:
|
The package |
I just managed it.
On my ESP32-cam board I loaded the sketch int i = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
Serial.println(i++);
delay(1000);
} and the serial monitor of IDE 1.8.19 shows the expected output.
it runs, but see no output |
ok could you try this variant: package main
import (
"fmt"
"os"
"strconv"
"go.bug.st/serial"
)
func usage() {
fmt.Println("Usage: term <PORT> [baudrate]")
os.Exit(1)
}
func main() {
args := os.Args[1:]
if len(args) == 0 {
usage()
}
portname, args := args[0], args[1:]
baudrate := 9600
if len(args) > 0 {
if b, err := strconv.Atoi(args[0]); err != nil {
fmt.Println("Invalid baudrate:", args[0])
os.Exit(1)
} else {
baudrate = b
}
args = args[1:]
}
if len(args) > 0 {
usage()
}
port, err := serial.Open(portname, &serial.Mode{BaudRate: baudrate})
if err != nil {
fmt.Printf("Error opening serial port %s: %s\n", portname, err)
os.Exit(2)
}
port.SetDTR(true) // <-----------------
port.SetRTS(true) // <-----------------
var buff [1024]byte
for {
n, err := port.Read(buff[:])
if err != nil {
fmt.Println("Error reading from serial port:", err)
break
}
if n == 0 {
fmt.Println("Timeout reading from serial port.")
continue
}
os.Stdout.Write(buff[:n])
}
port.Close()
} I've added the two lines marked with the arrows: port.SetDTR(true) // <-----------------
port.SetRTS(true) // <----------------- that sets the DTR and RTS bits of the port. It's the only difference I found with the Arduino IDE 1.8.x.
I hope that this unlocks something, otherwise, I'm out of ideas... |
it seems that false, false is promising.
|
@Erhie |
Hey @Erhie do you find the time to check it out? 😄 |
I'm closing this as fixed. @Erhie if the issue is not fixed for you feel free to re-open. |
Describe the problem
No output in Serial Monitor using Arduino IDE 2.0 RC6 on Windows 10 with ESP32-CAM and CH340G
Because there are some pictures the detailed description in a Google Docs:
[Arduino IDE 2.0 problem with Serial monitor - Google Docs 2]
Discussion with ptillisch and also tests with CLI nightly build https://downloads.arduino.cc/arduino-cli/nightly/arduino-cli_nightly-latest_Windows_64bit.zip don't solve the problem.
To reproduce
Plug USB and according the sketch the LED blinks
starting the command
./arduino-cli.exe monitor -p COM5
The led is dark and the message is
Connected to COM5! Press CTRL-C to exit
no output is logged.
starting the command with unplugged USB
and plug USB few seconds after the message is
and the led is dark.
With same sketch and
Arduino 1.8.16 after press reset on ESP board:
and led blinks
Expected behavior
to have the same output as on Arduino 1.8.16
serial-monitor version
arduino-cli.exe Version: nightly-20220519 Commit: 6883b39 Date: 2022-05-19T01:34:16Z
Operating system
Windows
Operating system version
10 Pro 21H2
Additional context
please implement the behavior on Arduino 2.0 as on Arduino 1.8.16
Issue checklist
The text was updated successfully, but these errors were encountered: