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

Adafruit Trinket M0 won't persist port #82

Closed
rkincaid opened this issue Oct 27, 2020 · 6 comments · Fixed by #2165
Closed

Adafruit Trinket M0 won't persist port #82

rkincaid opened this issue Oct 27, 2020 · 6 comments · Fixed by #2165
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@rkincaid
Copy link

System
MacBook (Retina, 12-inch, 2017)
MacOS 10.15.7 (Catalina), 12
Pro IDE Version 0.1.2 (0.1.2)
Adafruit Trinket M0

I can get the IDE to properly compile my sketch AND transfer correctly to the Trinket, but after transfer it loses the port setting and requires I manually redefine the port setting again in the "select other board & port" dropdown. Additionally, it appears to recognize the Trinket incorrectly as an "Adafruit pIRKey" as this entry is always associated with the correct USB port and I never added it. If I manually specify the Trinket and USB port, it works once, but then the Trinket loses the port and the pIRKey definition remains. Also, it never persists my Trinket setting (regardless of port) once I close the IDE. The behavior seems to be that it insists on seeing the board as a pIRKey, but that's just a guess on my part.

I'm not sure if this has anything to do with it, but I've noticed on my Mac that once the sketch is installed and the board resets, the USB connection temporarily disconnects and reconnects. And I get the red X in the board combobox at the top of the screen. Perhaps this temporary disconnect is confusing the board settings?

QUESTION: Is there any way to remove boards from the board/port dropdown once they have been associated?

Also, FWIW, the standard IDE does just fine with the same sketch and persists settings correctly and recovers from the temporary board disconnect.

To Reproduce
Steps to reproduce the behavior:

  1. Install IDE, Trinket support (per Adafruit instructions), and required sketch libraries.
  2. Plug in Trinket.
  3. Observe that board settings automatically pick up an entry for pIRKey with the correct port we need for the Trinket
  4. Manually select the build for the Trinket M0 and correct board.
  5. Compile and upload successfully.
  6. Immediately loses the port setting and won't upload correctly until you repeat IDE launches - the editor opens, but nothing is happening but the "loading" circle in the middle arduino-pro-ide#4
  7. Close IDE, reopen and it's as if the Trinket was never there.

Expected behavior
Trinket and port settings should persist like the standard IDE

@rkincaid
Copy link
Author

UPDATE with workaround:

The following seems to work around the problem, but it still seems like something isn't right in order for this to matter...

  1. Edit /Users/robertkincaid/Library/Arduino15/packages/adafruit/hardware/samd/1.6.3/boards.txt
  2. remove he entry for "Adafruit PIRkey (SAMD21)"
  3. save boards.txt

@ubidefeo
Copy link

hi @rkincaid
as we groom our older issues I found this one and tested.
It indeed suddenly picks up the board as a pIRKey.
This might be due to the VID:PID pair being shared across Adafruit's boards (I have not investigated), hence you should report this to their forums or GH repos for their SAMD boards.

@rkincaid
Copy link
Author

Thanks for the followup. I would note however that this does not seem to occur with the non-pro IDE or with PlatformIO. I ended up moving to PlatformIO/Microsoft Code.

@ubidefeo
Copy link

thank you for replying so promptly, @rkincaid

@per1234 can you look into this?
I'm sure you can quickly figure out why this happens :)

@per1234
Copy link
Contributor

per1234 commented Feb 17, 2021

This might be due to the VID:PID pair being shared across Adafruit's boards

That's correct. Here's the VID/PID definition for the Trinket M0:
https://github.com/adafruit/ArduinoCore-samd/blob/1.6.5/boards.txt#L290-L293

adafruit_trinket_m0.vid.0=0x239A
adafruit_trinket_m0.pid.0=0x801E
adafruit_trinket_m0.vid.1=0x239A
adafruit_trinket_m0.pid.1=0x001E

and here for the pIRkey:
https://github.com/adafruit/ArduinoCore-samd/blob/1.6.5/boards.txt#L433-L436

adafruit_pirkey.vid.0=0x239A
adafruit_pirkey.pid.0=0x801E
adafruit_pirkey.vid.1=0x239A
adafruit_pirkey.pid.1=0x001E

So either one will match the automatic board detection. I don't own a Trinket M0, but I was able to reproduce the issue with the "Native USB" port of my Zero by just adding another board definition to the Arduino SAMD Boards boards.txt with the same VID/PID definition but different board ID and name.

I'm not sure if this has anything to do with it, but I've noticed on my Mac that once the sketch is installed and the board resets, the USB connection temporarily disconnects and reconnects. And I get the red X in the board combobox at the top of the screen. Perhaps this temporary disconnect is confusing the board settings?

That's exactly it. The board resets at the start of the upload and the bootloader runs, which has a different VID/PID, then the upload finishes and the application runs, which makes the standard VID/PID appear on the system. This triggers the Pro IDE/Arduino CLI's automatic board detection to happen and it seems to pick one of the two boards at random to associate with the port. You can actually reproduce the issue simply by pressing the reset button on the board, no upload needed.

this does not seem to occur with the non-pro IDE

That's because it doesn't have the automatic board detection feature. It just uses whichever board you manually selected from the Tools > Board menu.

remove he entry for "Adafruit PIRkey (SAMD21)"

I think that's the best provisional workaround for anyone encountering this issue.

@ubidefeo
Copy link

thank you, @per1234

@rsora rsora transferred this issue from arduino/arduino-pro-ide Mar 1, 2021
@cmaglie cmaglie removed the type: bug label Sep 16, 2021
@rsora rsora added the type: imperfection Perceived defect in any part of project label Sep 22, 2021
@per1234 per1234 added the topic: code Related to content of the project itself label Oct 29, 2021
@per1234 per1234 linked a pull request Aug 17, 2023 that will close this issue
4 tasks
kittaakos pushed a commit that referenced this issue Aug 17, 2023
Closes #43
Closes #82
Closes #1319
Closes #1366
Closes #2143
Closes #2158

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
kittaakos added a commit that referenced this issue Aug 18, 2023
Use Arduino CLI revision `38479dc`

Closes #43
Closes #82
Closes #1319
Closes #1366
Closes #2143
Closes #2158

Ref: arduino/arduino-cli@38479dc

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
@per1234 per1234 added the conclusion: resolved Issue was resolved label Aug 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants