Teensy 3.2 + Prop Shield trouble getting audio on flash

Status
Not open for further replies.
Hi,

I just started my first Teensy project (hurray!). I've soldered the Teensy 3.2 to the prop shield and a small 8 Ohm speaker and so far I have managed to test the orientation demo and for sound I successfully tested the Talkie examples.

So everything seems to be in good working order on the hardware side.

I tried to copy a RAW file (converted with sox) to the flash memory with the rawfile-uploader python script after uploading the CopyFromSerial script. This says it has successfully copied the file. But when I run the ListFiles script it I only get the message: 'All Files on SPI Flash chip:' and then nothing.

The LED on the Teensy flashes fast when running the CopyFromSerial script and then burns continuously. It doesn't go off after the supposed copying.
(do I need to change something in the CopyFromSerial script?)

At this point I don't know how to continue so any help is very much appreciated.


For completion, this the version I used for the python script. I only changed the memory size to 8.

Code:
#!/usr/bin/python
#
# Uploads raw audio files to Teensy + Audio board with SPI Flash on board.  To use this program, first 
# load the 'CopyFromSerial' example sketch.  When it first runs, it will format the SPI flash chip
# (this may take a long time for larger chips; a 128MB chip that I am using can take almost 10 minutes,
# but smaller 16MB ones should be faster).
#
# While the chip is being formatted, the LED (pin 13) will toggle at 1Hz rate.  When the formatting is
# done, it flashes quickly (10Hz) for one second, then stays on solid.  When nothing has been received
# for 3 seconds, the upload is assumed to be completed, and the light goes off.
#
# You can start this program immediately upon plugging in the Teensy.  It will buffer and wait until
# the Teensy starts to read the serial data from USB.
#
###################

import serial, sys, os, time

if (len(sys.argv) <= 2):
	print("Usage: '" + sys.argv[0] + " <port> <files>' where:\n\t<port> is the TTY USB port connected to Drum Master\n\t<files> is a list of .RAW files (bash globs work).")
	sys.exit()

#Special bytes
BYTE_START = "\x7e"
BYTE_ESCAPE = "\x7d"
BYTE_SEPARATOR = "\x7c"

#Flash size (in MB).  Change this to match how much space you have on your chip.
FLASH_SIZE = 8

totalFileSize = 0;
for i, filename in enumerate(sys.argv):
	if (i >= 2):
		totalFileSize = totalFileSize + os.path.getsize(filename)

flashSizeBytes = FLASH_SIZE * 1024 * 1024
if (totalFileSize > flashSizeBytes):
	print("Too many files selsected.\n\tTotal flash size:\t" + "{:>14,}".format(flashSizeBytes) + " bytes\n\tTotal file size:\t" + "{:>14,}".format(totalFileSize) + " bytes")
	sys.exit()

ser = serial.Serial(sys.argv[1])
print("Uploading " + str(len(sys.argv) - 2) + " files...")
for i, filename in enumerate(sys.argv):
	if (i >= 2):
		startTime = time.time();
		sys.stdout.write(str(i - 1) + ": ")
		sys.stdout.write(filename)
		sys.stdout.flush()
		

		f = open(filename, "rb")
		fileLength = os.path.getsize(filename)
		try:
			encoded = []
			#Start byte
			encoded.append(BYTE_START)
			#Filename
			for byte in os.path.basename(filename):
				encoded.append(byte)
			#End of filename
			encoded.append(BYTE_SEPARATOR)
			
			#File length (uint32_t)
			encoded.append(chr((fileLength >> 24) & 0xFF));
			encoded.append(chr((fileLength >> 16) & 0xFF));
			encoded.append(chr((fileLength >> 8) & 0xFF));
			encoded.append(chr((fileLength >> 0) & 0xFF));
			encoded.append(BYTE_SEPARATOR)
			
			#Binary data, with escaping
			for byte in f.read():
				if byte == BYTE_START or byte == BYTE_ESCAPE:
					encoded.append(BYTE_ESCAPE)
					encoded.append(chr(ord(byte) ^ 0x20))
				else:
					encoded.append(byte);
			
			#Write end of data byte
			encoded.append(BYTE_START)
			ser.write("".join(encoded))
		 
		finally:
			f.close()
			
		endTime = time.time();
		print(" (" + str(round(fileLength / 1024 / (endTime - startTime), 2)) + " KB/s)");

print("All files uploaded")
 
CorVanEssen, I am struggling at exactly the same point. Can I ask you for the exact steps that you did to resolve the upload issue?

How did you upload the RAW or WAF files to the Flash module exactly? Where did you put the audio files when you executed the teensytransfertool.ino? Did you also execute the python upload file? I can't somehow get it run on my Mac. I'm a bit lost right now.

When I execute the Python Uploader script I get the following message:

================================================================================
26.09.2017, 23:46:08
~/Downloads/SerialFlash-master/extras/rawfile-uploader.py
--------------------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/Martin/Downloads/SerialFlash-master/extras/rawfile-uploader.py", line 17, in <module>
import serial, sys, os, time
ImportError: No module named serial



Any detailed help will be appreciated. Many thanks and nice greetings from Münster...
 
@ manitou: Right, when I unpack the MAC zip file I get the "teensytransfer" executable file. A new window pops open with the following content:

r-master/extras/teensytransfer ; exit;
Filename required

Compiled Oct 17 2016 11:40:15
Usage: teensytransfer [-w] [-r] [-l] [-d] [device] <file>
-w : write (default)
-r : read
-d : delete file
-e : erase device
-l : list files
-i : device info

Devices:
teensy
serflash (default)
eeprom
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.

[Prozess beendet]


And then nothing happens... I can't use that terminal window for anything else. What can I do now? Any suggestions?

@ Frank B: Nice area! I love the Münsterland.
 
I know nothing about MAC, but for sure there is a shell, terminal, or commandline.
TeensyTransfer has no GUI - it is a commandline-tool.
So you have to open your shell, and start it from there - with the proper arguments.
Before, flash the INO-Part to the teensy.

Good night ;-)
 
@ Frank B: Thanks for your help anyway!

@ manitou: Do you have any hint how to execute teensytransfer command properly in the Mac Terminal?
 
i usually work on linux boxes, but i fired up the mac laptop, and opened a terminal window
I had already loaded the teensytransfertool sketch to the T3.2 with USB in Raw HID mode
I listed (-l) files on the flash on my T3.2/shield and -i for info
Code:
[macpro:~/Desktop] manitou% ./teensytransfer -l
   65536 file01.txt
    1024 TST.DAT
      51 test1.dat
   65536 erase.dat
 2116800 TOPGUN.RAW
    7241 teensytransfer.gz
  617400 DAVE.RAW
[macpro:~/Desktop] manitou% ./teensytransfer -i
ID    : EF 40 17
Serial: D1 65 38 25 47 44 08 23
Size  : 8388608 Bytes
 
Last edited:
@Kali: So many responses already, cool
also not a MAC expert, but your initial post mentioned something about it not being able to find serial module.

Maybe you first need to install the correct python modules?

Hope that helps.

What are you building?

ps: so many people from the Münster area :D

@ Frank B: Thanks for your help anyway!

@ manitou: Do you have any hint how to execute teensytransfer command properly in the Mac Terminal?
 
All, thanks for the input so far. I will try over the next days if it works. I’m building a light saber for my son and he is desperate to get sound on the Prop Shield that reacts on the motion sensors. Exciting stuff. Many thanks.
 
Hello! I am also new to the Teensy and I have the same problem.
I am using a mac and I can execute the teensytransfer file from the terminal. I can open it from the finder but I can not add a filename or -l there.
In the Terminal I get the response: command not found!
Code:
unknown20c9d0e3d43f:~ Olli$ ls
Desktop			MacKeeper Backups	Sites
Documents		Movies			break.raw
Downloads		Music			teensytransfer
Dropbox			Pictures
Library			Public
unknown20c9d0e3d43f:~ Olli$ teenystransfer -l
-bash: teenystransfer: command not found
unknown20c9d0e3d43f:~ Olli$

It is probably a simple Mac thing that I don't know.
Can anyone help?
 
In the terminal window, if you are in the same folder as the teensytransfer executable, you need to type ./teensytransfer -l

otherwise you need to specify the full path to the folder where the teenystransfer executable resides.
 
Thank you for the quick response.
I tried that but I still don't get the same result as when I double click in the finder:
Code:
unknown20c9d0e3d43f:~ Olli$ ls
Desktop			MacKeeper Backups	Sites
Documents		Movies			break.raw
Downloads		Music			[B]teensytransfer[/B]
Dropbox			Pictures
Library			Public
unknown20c9d0e3d43f:~ Olli$ ./teensytransfer -l
unknown20c9d0e3d43f:~ Olli$

If I double click in the Finder I get this:
Code:
Last login: Sat Mar 24 22:14:34 on ttys000
/Users/Olli/teensytransfer ; exit;
unknown20c9d0e3d43f:~ Olli$ /Users/Olli/teensytransfer ; exit;
Filename required

Compiled Oct 17 2016 11:40:15
Usage: teensytransfer [-w] [-r] [-l] [-d] [device] <file>
	-w : write (default)
	-r : read
	-d : delete file
	-e : erase device
	-l : list files
	-i : device info

	 Devices:
	teensy
	serflash (default)
	eeprom
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.

I don't know why I am: unknown20c9d0.....
Could that be a reason?
 
maybe first try chmod +x teensytransfer
this assumes you downloaded the mac version of teensytransfer

do ./teensytranfer -i to get info
 
Last edited:
I have downloaded and unpacked the mac version.
What should I see when entering chmod +x teensytransfer?
Here is what I get:
Code:
unknown20c9d0e3d43f:~ Olli$ chmod +x teensytransfer
unknown20c9d0e3d43f:~ Olli$
 
Amazing!
It worked!
With -i I had a response and I could copy my file after that!
Code:
unknown20c9d0e3d43f:~ Olli$ ./teensytransfer -i
ID    : EF 40 17
Serial: D1 65 38 25 47 38 2E 27
Size  : 8388608 Bytes
unknown20c9d0e3d43f:~ Olli$ ./teensytransfer -w break.raw
....
unknown20c9d0e3d43f:~ Olli$ ./teensytransfer -l
   16454 break.raw

What did chmod +x teensytransfer do?

Anyway! Thanks a lot!
 
Status
Not open for further replies.
Back
Top