The problem is as soon as I close Xojo and reopen this project, it no longer receives any serial data. I have rebuilt the project 3 times from scratch and get the same results. It works until I close Xojo and reopen it. Any thoughts as to why this might be happening?
Yes, the device shows up in the popup menu. I can also open arduino and see the data in the serial monitor. I also always close arduino all the way out before I try to run this. Yes, I have also unplugged and replugged the device.
I am on a Mac. ChatGPT thinks my mac might be holding onto the serial port. I can see the same behavior in terminal. It works and I see data. Then I close and reopen terminal and it can’t see the data until I kill the connection in terminal.
Thanks for the project sample tip. I did not know that.
I am pretty sure I did not disconnect in the program before exiting. But I tried again and opened the program connected, then disconnected. Still no luck. Jumped over to Arduino, it reads the serial monitor just fine. Closed Arduino, tried the Xojo program again. It connects ok but no data. I shutdown my mac and restarted it, opened Xojo, it connects but still no data. Someone else in the mac world must have run into this.
OK, so I went to the office and grabbed my PC laptop. Installed Xojo, opened the sample barcode scanner code and I can see the serial device and connect to it, but no data coming in.
Soooo, I then make a new project and build the barcode scanner sample from scratch and it works!
Then, I close Xojo. Reopen Xojo, reopen my app that WAS JUST WORKING, and now the same behavior that I saw on my mac. I don’t get what is going on. I can open the serial port but no serial data coming in. If I make a new app from scratch, it will work just fine until I close Xojo and then reopen it. Repeatable everytime.
Something may be stalled needing some reset at the comm level at the app startup time? like a DTR off, sleep(500), DTR on ? Something like that. Read the docs of the devices involved.
I am connecting to a SAMD16g18 M0 microcontroller with adafruit’s M0 bootloader. The PCB is a custom PCB that I have built.
here is the Arduino code that I am running. It just simulates a moving object.
Blockquote
float lat=45.64166787140118;
float lon=-111.18697809606275;
void setup() {
Serial.begin(9600); // Start serial communication at 9600 baud
delay(1000); // Give it time to initialize
Serial.println(“Arduino ready!”);
}
void loop() {
lat=lat+.001;
lon=lon+.001;
Serial.print(lat,4);
Serial.print(" , ");
Serial.println(lon,4); //Serial.println(“56,000 ft”);
delay(1000); // Send data every second
}
Indy your the man! That fixed it! I added that to my connect button! I don’t understand why it needs this but heck ya! Thanks everyone! I appreciate you all taking the time to try and help me. I hope the rest of your weekends are enjoyable! Thank you! Thank you! Thank you!
Seems so. I don’t think it is as easy to just check the datasheets. For example, I tried a quick look for the Adafruit Metro RP2040 but couldn’t find any type of datasheet stating DTR was required for serial communication.
I did find this part of a conversation that was helpful to me:
Indeed the Arduino Uno boards, whether they are the original one with the USB-to-UART converter being the ATMega16u2, or a CH340, or an FTDI chip, do not care whether DTR is asserted or not. But many of the Arduino cores for boards in which the target MCU does the USB communication itself (such as for the Pico, STM32 chips if configured so) do need DTR asserted.