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

Several Problems AND SOLUTIONS I Found During My Build #36

Open
mpetti1816 opened this issue Jan 23, 2023 · 20 comments
Open

Several Problems AND SOLUTIONS I Found During My Build #36

mpetti1816 opened this issue Jan 23, 2023 · 20 comments

Comments

@mpetti1816
Copy link

mpetti1816 commented Jan 23, 2023

It took me a lot of hunting around to fix some of the code issues I was encountering and I'd thought I'd explain my solutions to those of you who are struggling with the same problems. The answers were pulled from this project's main page, the "Closed Issues" board, and a few other places on the internet, but here they are consolidated.

My experiences only pertain to the Github code for this project as of January 22, 2023 and the specific hardware/software that I used.

My hardware:
Teensy 4.0 board
Teensy4_AUDIO Audio Shield
Momentary pushbutton
Vintage telephone

My software:
Arduino IDE 1.8.19
Teensyduino 1.57 using Windows installer

First steps: I did all of the installation adjustments included on the audio-guestbook Github main page, such as

  • copied boards.local.txt
  • copied platform.txt
  • Changed "Audio tweaks" to "Bigger blocks (256 samples)"

I then had several compiling errors that I had to hunt around for solutions to

Problem:
AudioPlaySdWavX does not name a type
&
'playWav1' was not declared in this scope
Solution:
Inside your sketch, go to the "Sketch" dropdown at the top, choose "Add File" and add play_wav_sd.cpp and repeat with play_wav_sd.h files that were in the Github code download.
Leave those tabs open, then try Verifying your sketch and you should lose those errors.

Problem:
Multiple libraries were found for "SD.h"
Solution:
I cut/pasted the folder 'C:\Program Files (x86)\Arduino\libraries\SD' out of the Arduino libraries directory and saved it elsewhere on my computer for safe keeping. Now, the only 'SD' folder should be under Arduino\hardware\teensy\avr\libraries\

Problem:
Compiling error involving SerialFlash.h
Solution:
Re-ran the TeensyDuino installer and added the 'SerialFlash' library

Problem:
Multiple errors involving MTP_Teensy.h
Solution:
Download the Github code from https://github.com/KurtE/MTP_Teensy and unzip the folder into 'C:\Program Files (x86)\Arduino\libraries'
Then, in your Arduino sketch, select from the dropdowns at the top "Tools > USB Type > Serial + MTP Disk (Experimental)"

Problem:
Audio was clipping (breaking up) during playback after I got everything "working"
Solution:
There are two volume adjustments in the code that I fiddled with. Use CTRL+F in the code to find "sgt15000_1.volume(0.95)". The 0.95 is 95% volume on the headset speaker, which was too loud. I dropped it down to 0.7 and it stopped clipping on playback.
I also adjusted the "sgt15000_1.micGain(5)", which is how loud the microphone on the headset is recorded in the file. I dropped it to (4) because the recordings sounded blown out.

Problem:
My greeting message wasn't playing back, I would just get a single "beep" when I lifted the handset
Solution:
I downloaded Audacity and opened my greeting message, then exported it using 44.1kHz and 16-bit PCM as a new WAV file. I also had a stereo recording, so I had to delete one of the tracks to make it "mono". That fixed the playback problem.

Problem:
The code compiled correctly (finally), but the handset wasn't responding properly and I was hearing a constant clicking noise in the speaker.
Solution:
My phone had a lot of shared terminals in the internal wiring. I disconnected all of the wires from the phone's terminals and directly wired each wire from the speaker/microphone/handset contact/pushbutton to the inputs/outputs of my Teensy board. This solved the clicking issue and after troubleshooting my code, it also solved the audio issues.

@mpetti1816 mpetti1816 changed the title Several Problems and Solutions I Found During My Build Several Problems AND SOLUTIONS I Found During My Build Jan 23, 2023
@fivefortyfour
Copy link

Nice, thanks for your update! Where do you put the greeting audio file?

@BrandonJam
Copy link

Ok. So I have board soldered. Code compiled and uploaded to the Board. I add power to the Board and I hear a beep. After that, I get nothing. Not sure what the issue is. Is there a way to see a log of the steps of code the Board is going through? Maybe then I can determine where my issue is.

@mpetti1816
Copy link
Author

Ok. So I have board soldered. Code compiled and uploaded to the Board. I add power to the Board and I hear a beep. After that, I get nothing. Not sure what the issue is. Is there a way to see a log of the steps of code the Board is going through? Maybe then I can determine where my issue is.

That initial beep is an indication that it has power and is running (at least that's what it seems like, mine does the same beep upon power). If you look under the Tools menu, there is something called the Serial Monitor. When you open that and run your board, there are sections of the code that will print out what is going on while it's running. I used that to troubleshoot a few wiring problems I had.

@BrandonJam
Copy link

BrandonJam commented Jan 23, 2023

I just did Serial Monitor. It keep saying "unable to access SD card". SD card is definitely present though. It is in the same way after programming the board.

@mpetti1816
Copy link
Author

mpetti1816 commented Jan 23, 2023

I just did Serial Monitor. It keep saying "unable to access SD card". SD card is definitely present though. It is in the same way after programming the board.

I am no where near an expert on this stuff, but a couple things that come to mind. Ensuring your MTP_Teensy libraries were put in the right folders and that "Serial + MTP Disk (Experimental)" was selected (both in my initial post). The other thing to check is that your SD card is not larger than 2TB. That limitation is mentioned at the bottom of this page https://www.pjrc.com/store/teensy3_audio.html

Other than that, I can't think of anything else, so good luck Googling or having someone else chime in.

@BrandonJam
Copy link

I saw another Issue down below that said it was the pin locations with Rev D of the Audio Shield. I changed those to match the Rev D diagram, but still getting the same message.

@cpereirauy
Copy link

I just did Serial Monitor. It keep saying "unable to access SD card". SD card is definitely present though. It is in the same way after programming the board.

I am no where near an expert on this stuff, but a couple things that come to mind. Ensuring your MTP_Teensy libraries were put in the right folders and that "Serial + MTP Disk (Experimental)" was selected (both in my initial post). The other thing to check is that your SD card is not larger than 2TB. That limitation is mentioned at the bottom of this page https://www.pjrc.com/store/teensy3_audio.html

Other than that, I can't think of anything else, so good luck Googling or having someone else chime in.

I formatted my SC card (32gb Samsung) to exfat, not saying that would solve your issue, but worth trying.
Another thing, where are you inserting your SD card? Teensy or Audio Shield? Try swithching them

@fivefortyfour
Copy link

When I compile to the teensy I’m getting an error about Serial port not selected.

@BrandonJam
Copy link

BrandonJam commented Jan 25, 2023 via email

@BrandonJam
Copy link

BrandonJam commented Jan 25, 2023 via email

@fivefortyfour
Copy link

Finally, all working!

@rich-day
Copy link

rich-day commented Jan 25, 2023

I had to amend my SD card pins in the code as I am using Audio Shield Rev D - this ended up working (as well as making sure my pins were connected accordingly)

#define SDCARD_CS_PIN 10
#define SDCARD_MOSI_PIN 11
#define SDCARD_SCK_PIN 13

@BrandonJam
Copy link

Thanks, Rich. So, I have done this with a few different variations of the code, and also by changing the pin numbers in the code for those different variations, because I too saw that the PIN locations for the T4.0/Audio Shield were different than what people were using.

https://www.pjrc.com/store/teensy3_audio.html

I ended up getting the DD4WH fork code to work WITHOUT changing the pin locations, which confuses me somewhat as to why that worked if the pin locations are off.

Question back to you though... so I know how to easily change the pin locations in the code, but I wasn't thinking about physically changing the pin connections on the board. I was under the impression that when the T4.0 and Audio Shield were stacked together, then that is where the pins lined up appropriately based on the link above. Can you touch on this part a little more? Maybe even a pic of your board?

@rich-day
Copy link

Sorry, to clarify, I just meant confirming that my pins (10,11,13 in this case) were soldered well and that the board was stacked correctly (e.g. not misaligned or upside down etc). I am by means no expert on this, I've just recently completed this project and ran in to similar problems so just sharing my learnings.

Glad to hear you got it working however!

@Cbbfrench Cbbfrench mentioned this issue Feb 1, 2023
@DevlinDiener
Copy link

DevlinDiener commented Feb 13, 2023

I am using Teensy 4.0 so SD only in Audio Shield. I ended up using a different fork version of the code and it worked fine with my sd card as is. Weird.

@BrandonJam Can I ask which fork you ended up using? I am facing the same problem.

@BrandonJam
Copy link

the fork version from @DD4WH

@fivefortyfour
Copy link

I'm recording my wav files to sd card but when I plug teensy into laptop with usb cable, I can't play the files as it says they're in use? I can't copy them either. How do you use them? I want to access them with usb cable and not take out the sd card.

@TWK-Nattttttttt
Copy link

I'm a little confused. I downloaded the MTP_Teensy documents that you said to and put them in the libraries folder, but I'm still getting "'MTP' was not defined in this scope."

The extent of my knowledge with code is drawing a circle on Khan Academy, so I'd appreciate any help I can get imagine there is a laughing emoji here

@fivefortyfour
Copy link

fivefortyfour commented Mar 5, 2023 via email

@markmak77
Copy link

Does anyone know if the author (@alastaira) is still accepting Pull Requests? It'd be nice to add something like this to a "Troubleshooting" section of the readme...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants