WTV020-SD-20SS Help

pwaggie

New Member
WTV020-SD-20SS

A few days ago I bought one of these cheap modules on ebay with the ambition of adding voices to a project, taking advice from this forum I managed to buy an SD card that was compatible and soon got it working in "Key Mode" but of course I wanted a picaxe to control it and that was when I ran into difficulties.

I am sure the code is right and have checked the output on my scope (see photo) but after several days I've had no joy. Looking round on internet I found some suppliers say that it must be programmed into serial mode at manufacture, does anyone know if this is correct as the add did not suggest this.

I have also included my latest code if anyone can see anything wrong there I would be very grateful for any help or suggestions as I have spent many many hours trying to solve the problem and got nowhere. (Hope I've done the attachment and code right:) )

STV020.jpg

Code:
#picaxe 18m2

Symbol mask	= bit0	        	; Mask word for the shiftout proceedure
Symbol index	= b1				; Bit counter for shifting data
Symbol track	= w1				; Pointer to the required track file
Symbol dat	= w2			        ; Data to send to module is a word(16-bit) value
Symbol msb	= $8000		        ; Mask for the most Significant Bit = bit 16
Symbol sdat	= b.4		        ; Serial data output is on pinb.3
Symbol clk		= b.5			; Serial clock output is on pinb.2
Symbol busy	= pin1		        ; Busy line back from module
Symbol rset	= b.6			; Reset line for WVT020 device

Init:
	Low sdat						; Data line Low
	High clk						; Set clock to high	on WTV020 device
	High rset						; Set reset line high on WTV020 device
	Pause 2000
Main:
	track = 6
	Low rset						; Reset the device
	Pause 5						; For 5ms reset pulse
	High rset						; then high again
	Pause 300						; Delay 300ms 
	dat = track					; Load track number into dat
	Low clk						; Pull clock-line low to start
	Pause 3						; Start-bit time >= 2msec to indicate a start of command
	
	For index = 1 To 16				; loop for each of 16 bits of filename/number
  		mask = dat And msb / msb 	; mask out the most sig. bit to ascertain if next bit is 1 or 0
		Low sdat
		If mask = 0 Then Skip		; check if current data bit is "0" skip if it is a zero
		High sdat					; set data line high only if the data bit is a "1" 
Skip: 
		If index = 16 Then Skip16th	; Skip here as 16th bit is clocked out at the end
		Pulsout clk, 20				; Create 200usec clock pulse for the current data bit
  		dat = dat * 2				; shift data one bit left
		
Skip16th:
Next index					; Get next bit till all 16 bits of data presented to module
		High clk			; Pull clock-line high which also clocks out the 16th data bit
		Pause 3			; End-bit minimum time >= 2msec for STOP indication
		Low clk
		Low sdat
		End
 

hippy

Technical Support
Staff member
It always help to provide a description of what the module does and a link to its datasheet, and details of exactly what you have bought, simply to save everyone having to individually look for those details. I believe this would be the datasheet -

letsmakerobots.com/files/WTV020_manual_V1.3.pdf

It does seem to be that the device is pre-programmed; WTV020-SD-20S is serial (SPI) and WTV020-SD-20P is parallel / key mode, so you seem to have the serial device if it is a 250S.

From looking at the datasheet I recalled controlling the device via SPI has been described in previous posts -

www.picaxeforum.co.uk/showthread.php?23399
 

pwaggie

New Member
Thanks for the reply Hippy, sorry about the datasheet but you had the same one as me, I have tried code from a few other posts online but none seem to work, I have checked the reset, clock and data lines with the oscilloscope and everything is exactly as the datasheet but it still does not clock the data into the module. I don’t quite understand how the device knows which mode to operate in, I would have thought that it needed a command code to set it into the right mode of operation but that does not seem to be the case. I does not help that the data sheet is written in such a way that can only be produced in the far east. :rolleyes:
 

Technical

Technical Support
Staff member
Section 7.5 - does it automatically go into 'key mode' 1 second after reset is pulsed low (if no 'serial pulses' received within that 1 second)?
 

hippy

Technical Support
Staff member
Having looked again at that datasheet it seems both use the WTV020-SD chip. The -20S and -16P appear to refer to the assembled module type but also the packaging 20-pin SDIP or 16-pin DIP later on. But from the circuit of the -16P it has 20-pins and the only difference seems to be a direct connection between leg 13 (VPP) and 3V3 or via a 150R. It's very hard to figure it out from that datasheet.
 

pwaggie

New Member
Hi, thanks for the suggetion, but I set the Reset line high then low for 6ms, high then and the first clock pulse starts 300ms later. from Reset to the end of the first control word (Set volume high) is 432ms, the track number (6) then follows 210ms later. No track is played but if I take Next to ground it plays track 1.
 

pwaggie

New Member
Having looked again at that datasheet it seems both use the WTV020-SD chip. The -20S and -16P appear to refer to the assembled module type but also the packaging 20-pin SDIP or 16-pin DIP later on. But from the circuit of the -16P it has 20-pins and the only difference seems to be a direct connection between leg 13 (VPP) and 3V3 or via a 150R. It's very hard to figure it out from that datasheet.
Thanks Hippy, I find the datasheet a little confusing and one or two contradictions in it, basicaly the 16P and 20S have similar pinouts and I thinkthey work the same.

As I mentioned earlier I send a low reset for 6ms then reset stays high, 300ms later the first control command starts (to set volume high) 200 ms after this I send a command to play track 6, nothing happens but if it press Next it plays track 1, another press track 2 etc, the Previous and Pause/Play button also works but not an SPI command to play any particular track, which of course is what I want. All clock pulses are 200us.
 
Top