Process for loading a sketch with Arduino

Play with it! Please tell us which board you're using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
robertbryce
 
Posts: 7
Joined: Fri Nov 08, 2019 1:07 pm

Process for loading a sketch with Arduino

Post by robertbryce »

Hi there, Just a quickie request please.

As an existing programmer of Adafruit devices and a regular user of Arduino IDE, I've just bought a Circuit Playground Express and wanted to confirm the strange behaviour I'm seeing on loading sketches through the IDE.

After a lot of investigation, I find I'm needing to double press the reset button, the neopixels turn green and wait for the CPLAYBOOT drive to popup before the IDE is able to upload code. Is that correct?

I'm using Arduino IDE 1.8.13 on a laptop running Linux Mint Cinnamon 20.

It seems counter-intuitive (and inefficient) as I don't need access to this drive. The weird thing is that the CPX board is recognised on /dev/ttyACM0 at all times plus my username is correctly registered as being a part of the dialout group at all times but I'm only able to upload when CPLAYBOOT is present.
The other strange behaviour is that while the CPLAYBOOT drive does show up shortly after plugging in the USB port, it only remains for circa 60 seconds and then silently vanishes. This leads to user confusion since one never knows if one needs to do the double-reset to achieve a successful upload or not.

If the CPLAYBOOT drive must be present in order to ensure a successful upload from Arduino IDE, is there a way to stop it silently vanishing?

Thanks
Bob

User avatar
Franklin97355
 
Posts: 23910
Joined: Mon Apr 21, 2008 2:33 pm

Re: Process for loading a sketch with Arduino

Post by Franklin97355 »

I think the express models are directed for programming in python and have made it easier to do so but at a cost for the Arduino code. I'll see if there is a workaround.

User avatar
adafruit2
 
Posts: 22147
Joined: Fri Mar 11, 2005 7:36 pm

Re: Process for loading a sketch with Arduino

Post by adafruit2 »

arduino auto-starts the bootloader and then auto-leaves it. so its normal for the bootloader drive to appear and then disappear. you can tell your OS to not open up the drive if the window opening/closing is annoying.

however, once you upload Blink, the COM port should appear. could be a linux thing. can you upload any sketches and have it auto-reset into the bootloader?

User avatar
robertbryce
 
Posts: 7
Joined: Fri Nov 08, 2019 1:07 pm

Re: Process for loading a sketch with Arduino

Post by robertbryce »

Thanks both for comments.
adafruit2 wrote:arduino auto-starts the bootloader and then auto-leaves it. so its normal for the bootloader drive to appear and then disappear. you can tell your OS to not open up the drive if the window opening/closing is annoying.

however, once you upload Blink, the COM port should appear. could be a linux thing. can you upload any sketches and have it auto-reset into the bootloader?
Adafruit2,
Thanks for your comments, but I think you've misunderstood / I wasn't clear enough.
1) It's not that it's annoying - as my system currently stands, the bootloader MUST be open in order to upload code. If the bootloader is not open, the IDE fails to upload code and complains "No device found on ttyACM0". (This is incorrect as proved by testing via the Terminal.)
2) I don't need to upload Blink or any other script to have the COM port appear. It seems to be a context thing - plugging in the CPX board enables the port - as can be checked from the Terminal. Thereafter - and from a Terminal perspective - the port is always open until the USB cable is removed. However, the IDE sees things differently - it only sees the port when the bootloader window is open and this only happens under the following conditions:-
a) Immediately after cable plug-in and for about 60 seconds thereafter (until the Bootloader closes down)
b) Re-uploading code after receiving the "No device found" error message (in this case, the error message appears to put the CPX into Bootloader mode as evidenced by the neopixels turning green and the Bootloader showing up several seconds later. In this case, the Bootloader remains open and the neopixels remain green for a long time - certainly much longer than 60 seconds)
c) Double-clicking the CPX reset button

So, it seems the Bootloader can be made to remain open for long enough to upload code - you just have to compile and upload twice!

At the end of the day, this is not major - just a bit annoying when you're going through the development cycling of writing and testing code (the way I do it anyway!).

User avatar
adafruit2
 
Posts: 22147
Joined: Fri Mar 11, 2005 7:36 pm

Re: Process for loading a sketch with Arduino

Post by adafruit2 »

you shouldnt hav to do anything.
whats the output during upload if you turn on verbose output in arduino IDE prefs?
are you in the dialout group? linux has more problems than other OSes :(

User avatar
robertbryce
 
Posts: 7
Joined: Fri Nov 08, 2019 1:07 pm

Re: Process for loading a sketch with Arduino

Post by robertbryce »

Thanks again Adafruit2

The answer to Q2 is yes, as per start of the post, I did follow the trouble-shooting information and got to a webpage on Linux permissions that explained there may be an issue with not being a member of the dialout group. The actions were taken and verified correct - my username is registered as a member of the dialout group - so that should not be an issue.

As for Q1, I enabled verbose mode and captured a successful run and a failed run. The former wasn't particularly helpful, but the last few lines of the failed run (see below) may be helpful. It seems to be saying a) it has found the port and b) it has not found the device. Does that make sense?

Code: Select all

Sketch uses 33108 bytes (12%) of program storage space. Maximum is 262144 bytes.
Global variables use 4236 bytes (12%) of dynamic memory, leaving 28532 bytes for local variables. Maximum is 32768 bytes.
Forcing reset using 1200bps open/close on port /dev/ttyACM0
PORTS {/dev/ttyACM0, } / {/dev/ttyACM0, } => {}
PORTS {/dev/ttyACM0, } / {} => {}
PORTS {} / {/dev/ttyACM0, } => {/dev/ttyACM0, }
Found upload port: /dev/ttyACM0
/home/bob/.arduino15/packages/arduino/tools/bossac/1.7.0-arduino3/bossac -i -d --port=ttyACM0 -U true -i -e -w -v /tmp/arduino_build_367577/Hello_Blink.ino.bin -R 
No device found on ttyACM0
An error occurred while uploading the sketch
The complete text is in the attached file.
CPX_failed_upload.txt
(21.83 KiB) Downloaded 5 times

User avatar
adafruit2
 
Posts: 22147
Joined: Fri Mar 11, 2005 7:36 pm

Re: Process for loading a sketch with Arduino

Post by adafruit2 »

ugh its def doing the right thing, but still failing on the upload

only thing remaining you could try is non-linux OS computer, do you have one?

User avatar
robertbryce
 
Posts: 7
Joined: Fri Nov 08, 2019 1:07 pm

Re: Process for loading a sketch with Arduino

Post by robertbryce »

adafruit2 - thanks for trying but I'll live with the constraint. That's a no-brainer decision compared to moving my development environment.

Cheers
Bob
adafruit2 wrote:ugh its def doing the right thing, but still failing on the upload

only thing remaining you could try is non-linux OS computer, do you have one?

Locked
Please be positive and constructive with your questions and comments.

Return to “Circuit Playground Classic, Circuit Playground Express, Circuit Playground Bluefruit”