# Tenda MP3 Module (TDB380) Lag



## studiokraft (Feb 7, 2012)

Hi all,

I'm a bit of a lurker in the forums and have been working quietly in the shadows on this year's display, and despite all the great advice and information I've found here, I can't locate any about a particular problem I am experiencing.

I've been working on a prop controller using a Picaxe 08M2 and the Tenda MP3 board from MDFly.

I've wired it up and loaded a simple program, but it seems no matter what I do, there is a lag of about 2 seconds before a sound will play. It also seems that unless the points M0 and M1 on the Tenda board are soldered to ground, the module wouldn't play anything.

I am pretty sure that others have been able to get the board to work with no lag, so I am not sure what I am doing wrong. I suspect it may be the 2G SD card I am using, although I formatted it with FAT32 and used the DriveSort program to arrange the files on the card. The MP3 files are named A001.mp3, A002.mp3 etc. and are in the root folder.

The simple program I am using to test is:


```
high 0 ' set output 0 idle high
wait 5 'allow module to wake up and initialize(might not need that long)

serout 0,T4800,($EF) 'STOP module before doing anything

start:
if pinC.2 = 1 then
	gosub playWelcome
else
	goto start
endif

playWelcome:
serout 0,T4800,($03)
gosub busy
goto waitforshot

waitforshot:
if pinC.2 = 1 then
	gosub playShot
else
	goto waitforshot
endif

playShot:
serout 0,T4800,($02)
gosub busy
goto waitforshot

busy:
if pinC.3=1 then 'If BUSY is high then
	return 'go back 
else 'Otherwise
	goto busy 'Stay in this loop 
endif
```
Note that the Picaxe should wait for an input high on C.2 (currently just a jumper) prior to playing anything. When this is set, the "busy" light will appear on the board but there is a lag before any sound.

Any hints or insights about using this board would be greatly appreciated!


----------



## pshort (May 6, 2008)

No real insights, but I've been seeing some lag as well. After power-up it takes about 0.6s before the controller seems to accept a command. I haven't done any testing to determine how long it takes for the controller to respond to a play command.

I'm using the controller (from mdfly) in a totally stock configuration. If I recall right, M0 and M1 were connected to ground when I first received the controllers. At the moment I'm using only one mp3 clip, and I'm not using the busy signal at all. I don't know if either of these factors could affect the lag.


----------



## hedg12 (Jul 6, 2008)

I haven't had a chance to play with one of these since I first found them, but my best guess would be your card formatting. Re-format the card to fat16 & see if it works any better. Also, you might try just naming the files 001.mp3, 002.mp3, etc. instead of beginning the file name with "A".


----------



## studiokraft (Feb 7, 2012)

Thanks for the tips! 

I will try the reformat and see if that helps. Also, I had noticed continuity between M0 & M1 and Ground so I had assumed that is how they were configured, but for whatever reason the board will not play without the ground being physically connected. 

I am assuming I have an issue with the dual Power Supply config I have currently (12v for the Tenda and 5v for the Picaxe), and am going to throw together a 5v regulator circuit and use the 12v only.

Thanks!


----------



## halstaff (Nov 18, 2009)

Also check on this thread on the Picaxe forum that deals primarily with the Tenda board - http://www.picaxeforum.co.uk/showthread.php?16353-mp3-playback-module/page2&highlight=tenda+sd+card
Lots of good info there.


----------



## studiokraft (Feb 7, 2012)

Thanks, Halstaff, I have been in that thread more than I care to admit.


----------



## studiokraft (Feb 7, 2012)

In the interest of closure, it appears that my problems were twofold - unnecessary delays in the code itself combined with MP3 files that Audacity added silence to the beginning was apparently causing the lag that I was experiencing. I now have a much more acceptable circuit/code combo for my purposes.


----------



## hedg12 (Jul 6, 2008)

Good to know, thanks.


----------



## David_AVD (Nov 9, 2012)

Some of the Tenda modules have the capability of playing files from a background music folder when no "advert" files are being played.

This is all good and well, but if that BGM folder is empty, by default the module keeps spitting out messages about the missing file(s). This causes random lagging in the start of the "advert" files.

You can sent the module a command that tells it not to use the BGM files. This stops the messages and the lagging issue. Hope that helps someone.


----------



## studiokraft (Feb 7, 2012)

Thanks, David_AVD! 

I hadn't seen anything in the documentation that I had regarding the BGM music files, perhaps it is a feature on a later version of the Tenda board than I have, but I will definitely check it out to see if it helps.


----------



## JeffHaas (Sep 7, 2010)

What were the delays in the code that you fixed? Just curious.


----------



## studiokraft (Feb 7, 2012)

You know honestly I don't recall - the code I was using for my shooting gallery gun was more complex than the test code that I had posted, and I believe the delays were in that code in the form of "pause" commands.

I did notice that the Tenda board seems to almost cache the sounds, as since it plays them once it accesses them faster the next time, which may have also accounted for my frustration.


----------



## David_AVD (Nov 9, 2012)

I just checked and you are right, the TDB380 doesn't have the BGM mode that I talked about. It is the TDS055 that has this feature and associated issue.


----------

