I added a new combo to the usb_desc.h file (Serial + Serial + AUDIO) and the boards.txt to match. This adds to the 48KHz USB Audio changes I had made earlier.
I have been chasing some IDE Tools:Boards and Tools:USB Type menu flakiness getting trying to get things working in both VS code and IDE 2.0.3. Using TeensyDuino 1.57.2, tried 1.5.1 briefly also (got hit with the tools folder having only teensy.,exe left in it).
What I was seeing often:
1. Language server error, the compile seems to go on.
2. Errors about cpu specs not found so the compile aborts. Select a Teensy board (again) in Tools:Boards to continue. The board keeps getting unselected.
3. The USB Type menu would sometime not reflect the menu items I set up. My custom Serial+Serial+Audio USB Type combo would appear in the IDE board drop down list as "Triple Serial" or some other odd one.
4. I got different USB Type menu offerings in VS Code board manager vs Arduino IDE 2.0.3. Usually, the selected type in VS Code would not work, seen as no valid audio and/or no serial devices so compile aborts. The IDE did better. I think this has to do with lots of old IDE version path in the VS Code config files adding to the new issues here.
When I updated boards.txt I focused on the the .../AppData/local/Arduino15/.... paths and not the old version paths looking for multiple copies that might exists and get copied around for whatever reason by the IDE. I assumed the old and new would not intermingle much. I think I was wrong.
There is a C:\Users\[username]\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6 on my machine with a boards.txt containing the same Teensy menu info but it is the original boards.txt, not my new modified version with Serial+Serial+Audio.
Looking at the IDE log the IDE was trying to deal with both arduino:avr:teensy41 and teensy:avr:teensy41 boards. This appears to cause the IDE to randomly choose a boards.txt to process and then "forgets" what board I had chosen. When this happens a board is in an unselected state. This produces the CPU spec error. Selecting a board always fixes this temporarily.
I took a closer look at the Tools:Boards menu and I saw Arduino AVR, Teensy, and ESP32 in my case. When I navigated over the Arduino AVR expanding it, it listed Teensy model CPUs in the list, nothing else.
Once I removed (renamed) the C:\Users\[username]\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\boards.txt the Arduino AVR board name was removed from the menu.
After this I am able to compile with my Serial+Serial+Audio (and at 48KHz - must match the audio side sample rate!) for the first time, and the other older combos as well. I was using Serial+MIDI+Audio but I needed 2 Serial ports and no MIDI. I suspect as long as no one ever changes the boards.txt it would be no problem, and unseen issue. I see this as a bug waiting to pounce once you decide to add a new Board or USB type in the future. I think the language server errors went away also. Time will tell. Now I have to go back to reinstall VS Code and get it working again.
So the apparent rule for now is to ensure your boards.txt match everywhere (or remove unneeded ones) and the old version may cause a problem by appearing under Arduino avr board type.
- Mike
I have been chasing some IDE Tools:Boards and Tools:USB Type menu flakiness getting trying to get things working in both VS code and IDE 2.0.3. Using TeensyDuino 1.57.2, tried 1.5.1 briefly also (got hit with the tools folder having only teensy.,exe left in it).
What I was seeing often:
1. Language server error, the compile seems to go on.
2. Errors about cpu specs not found so the compile aborts. Select a Teensy board (again) in Tools:Boards to continue. The board keeps getting unselected.
3. The USB Type menu would sometime not reflect the menu items I set up. My custom Serial+Serial+Audio USB Type combo would appear in the IDE board drop down list as "Triple Serial" or some other odd one.
4. I got different USB Type menu offerings in VS Code board manager vs Arduino IDE 2.0.3. Usually, the selected type in VS Code would not work, seen as no valid audio and/or no serial devices so compile aborts. The IDE did better. I think this has to do with lots of old IDE version path in the VS Code config files adding to the new issues here.
When I updated boards.txt I focused on the the .../AppData/local/Arduino15/.... paths and not the old version paths looking for multiple copies that might exists and get copied around for whatever reason by the IDE. I assumed the old and new would not intermingle much. I think I was wrong.
There is a C:\Users\[username]\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6 on my machine with a boards.txt containing the same Teensy menu info but it is the original boards.txt, not my new modified version with Serial+Serial+Audio.
Looking at the IDE log the IDE was trying to deal with both arduino:avr:teensy41 and teensy:avr:teensy41 boards. This appears to cause the IDE to randomly choose a boards.txt to process and then "forgets" what board I had chosen. When this happens a board is in an unselected state. This produces the CPU spec error. Selecting a board always fixes this temporarily.
I took a closer look at the Tools:Boards menu and I saw Arduino AVR, Teensy, and ESP32 in my case. When I navigated over the Arduino AVR expanding it, it listed Teensy model CPUs in the list, nothing else.
Once I removed (renamed) the C:\Users\[username]\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\boards.txt the Arduino AVR board name was removed from the menu.
After this I am able to compile with my Serial+Serial+Audio (and at 48KHz - must match the audio side sample rate!) for the first time, and the other older combos as well. I was using Serial+MIDI+Audio but I needed 2 Serial ports and no MIDI. I suspect as long as no one ever changes the boards.txt it would be no problem, and unseen issue. I see this as a bug waiting to pounce once you decide to add a new Board or USB type in the future. I think the language server errors went away also. Time will tell. Now I have to go back to reinstall VS Code and get it working again.
So the apparent rule for now is to ensure your boards.txt match everywhere (or remove unneeded ones) and the old version may cause a problem by appearing under Arduino avr board type.
- Mike