VS1205G, “Rec” program get stuck while recording

Discussion about writing software for VS1005 and the VSOS Operating System. Also posts about VS1005-related hardware design and device drivers should be posted here.
Post Reply
afu
User
Posts: 4
Joined: Tue 2017-09-12 4:32

VS1205G, “Rec” program get stuck while recording

Post by afu » Tue 2017-09-12 9:05

Dear engineer,
We trying to use VS1205G to record audio input and save it to the USB flash disk as a mp3 file. We find that the "Rec" program usually get stcuk for a few seconds while recording, meanwhile the data get lost, shell print some messages like "VID_1908 PID_1320 Generic Mass storage.
Has anyone ever tested record audio to a USB flash disk ?

Here are some details:

Hareware: vs1005 breakout board v1.1
VSOS kernel: VSOS 3.42 build May 18 2017 13:32:02
SYS: small_root in VSOS_342_RootAndLibrariesSourceCode package.

We test it using the SHELL:
1. power up breakout board
2. plug in the USB flash disk(8Gb, fat32)
3. load the usb driver:

S:>USBHOST D

VID_1908 PID_1320 Generic Mass storage
2 drive(s).
D: USB Flash

4.start record:

D:>Rec -fm -cs -r48000 1.mp3
Recording 48000 Hz stereo at quality 7
~050a'1.mp3

VID_1908 PID_1320 Generic Mass storage

VID_1908 PID_1320 Generic Mass storage

VID_1908 PID_1320 Generic Mass storage

VID_1908 PID_1320 Generic Mass storage

VID_1908 PID_1320 Generic Mass storage

VID_1908 PID_1320 Generic Mass storage

VID_1908 PID_1320 Generic Mass storage

VID_1908 PID_1320 Generic Mass storage

VID_1908 PID_1320 Generic Mass storage

VID_1908 PID_1320 Generic Mass storage
Output buffer size 34816 bytes
~030a=1
~030a=2

VID_1908 PID_1320 Generic Mass storage

VID_1908 PID_1320 Generic Mass storage

VID_1908 PID_1320 Generic Mass storage

VID_1908 PID_1320 Generic Mass storage

User avatar
Panu
VLSI Staff
Posts: 2418
Joined: Tue 2010-06-22 13:43

Re: VS1205G, “Rec” program get stuck while recording

Post by Panu » Tue 2017-09-12 10:36

Hi!

The "VID_1908 PID_1320 Generic Mass storage" message is printed when the USB mass storage driver initializes. You should see this message only once during initialization. If you see it more than once, it's an error.

It means that there is a problem with the USB flash device and the OS is doing its best to recover and reinitialize the USB flash device. It's often an electrical problem: how do you feed the 5 volts power to the USB flash? Please measure that the 5 volt voltage is stable.

One curious printout can be found:
2 drive(s).
Usually there is only 1 drive (LUN) in the USB flash. Do you know why it has two LUNs? How does it show in Windows or Linux?
How many flashes have you tested it with? Does it work reliably with other flashes?
Has anyone ever tested record audio to a USB flash disk ?
Yes, but I'd avoid it if possible, because USB flashes have wildly different performance figures, some have long delays and some use a lot of power. And writing to the flash is dangerous - if there's a power failure during the write, the user can loose a lot of valuable data if the flash corrupts. In your product, make sure that there's a lot of power always available to the flash.

To help with USB flash delays during recording, Henrik has written a driver called FILEBUF.DL3 to help with recording to the flash. It can provide buffering for at least a few hundred milliseconds while the OS is waiting for the flash to finish writing each block.

-Panu
Info: Line In and Line Out, VS1000 User interface, Overlay howto, Latest VSIDE, MCU Howto, Youtube
Panu-Kristian Poiksalo, VLSI Solution Oy

afu
User
Posts: 4
Joined: Tue 2017-09-12 4:32

Re: VS1205G, “Rec” program get stuck while recording

Post by afu » Tue 2017-09-12 11:15

Hi,
Thanks a lot for your reply.

1. We supply the breakout board with a 5V power from another DSP board, we will check the power first.

2. "2 drive(s)" is because the USB flash disk have two partitions, it shows two disks in Windows.

3. We will try the FILEBUF.DL3 driver later.

afu
User
Posts: 4
Joined: Tue 2017-09-12 4:32

Re: VS1205G, “Rec” program get stuck while recording

Post by afu » Wed 2017-09-13 3:23

Hi!
It's often an electrical problem: how do you feed the 5 volts power to the USB flash? Please measure that the 5 volt voltage is stable.
We used a 5V-4.5A adapter as the Breakout board's power yesterday, the problem still exists.
To help with USB flash delays during recording, Henrik has written a driver called FILEBUF.DL3 to help with recording to the flash.
The dirver FILEBUF.DL3 has already been used in "Rec", we can find the relevant code in "Rec" solution.

We found another weird thing:
When use ADC/DAC for input/output, the record is OK(we tested 90 minutes yesterday). The problem arises when we use I2s slave mode. We need to use vs1205 chip as an I2s slave(48KHz sample rate) in our project .Can you give us more advice?

Thanks!

User avatar
Panu
VLSI Staff
Posts: 2418
Joined: Tue 2010-06-22 13:43

Re: VS1205G, “Rec” program get stuck while recording

Post by Panu » Mon 2017-09-18 16:13

Hi!
The problem arises when we use I2s slave mode.
Ok, that is very useful information! There must be some negative interaction with the interrupt handlers. Please send us your CONFIG.TXT contents and the commands that you use to run the encoder, as well as the complete serial port output of VS1005, starting from reset until the end of recording, so we can try to recreate the situation.

-Panu
Info: Line In and Line Out, VS1000 User interface, Overlay howto, Latest VSIDE, MCU Howto, Youtube
Panu-Kristian Poiksalo, VLSI Solution Oy

afu
User
Posts: 4
Joined: Tue 2017-09-12 4:32

Re: VS1205G, “Rec” program get stuck while recording

Post by afu » Tue 2017-09-19 6:36

Hi,

The record command: "Rec -fm -cs -r48 1.mp3".

CONFIG.TXT and serial port output file please see the attachments.
Attachments
config.txt
(1.83 KiB) Downloaded 9 times
Serial10_2017-09-18_09-13-03.log
(3.76 KiB) Downloaded 6 times

User avatar
Henrik
VLSI Staff
Posts: 1041
Joined: Tue 2010-06-22 14:10

Re: VS1205G, “Rec” program get stuck while recording

Post by Henrik » Thu 2017-10-19 11:32

Hello!

I have been unable to reproduce your issue. I did my test with a slightly different configuration so that I could monitor the recording from line out. My config.txt was as follows:

Code: Select all

[1]
# UART I/O driver
UARTIN
# I2S input
AUII2SS s
# DAC output
AUODAC s
# Synchronize input with output
AUXSYNCS
# Make I/O buffers of proper size so that we don't lose audio samples
RUN AUINPUT -s2048
RUN AUOUTPUT -s2048
# Make sure clock is exactly 60 MHz for proper USB operation
RUN SETCLOCK usb
# USB Host driver
USBHOST U
# The Shell
S:SHELL.AP3
The command I used for recording was:

Code: Select all

Rec -fm -cs -f -r48 u:test15.mp3
Note the important "-f" option that rells Rec to use the FILEBUF.DL3 buffering library.

The output I get is as follows:

Code: Select all

Hello.
VSOS 3.44 build Aug 18 2017 12:29:19
VLSI Solution Oy 2012-2017 - www.vlsi.fi

Starting the kernel..
Starting Devices... 
External SPI Flash

Installed system devices:
S: SPI Flash c814, handled by FAT.
Load drivers, config 0...
Driver: UARTIN... 
Driver: RUN... SETCLOCK usb
Driver: AUII2SS... 
Driver: AUODAC... 
Driver: AUXSYNCS... 
Driver: RUN... AUINPUT -s2048
Driver: RUN... AUOUTPUT -s2048
Driver: USBHOST... 
VID_090c PID_1000 SMI Corporation USB DISK 
1 drive(s).
U: USB Flash

Driver: S:SHELL.AP3... 
VSOS SHELL
S:>Rec -fm -cs -f -r48 u:test15.mp3
Recording MP3: 48000 Hz stereo at quality 7
~050a'u:test15.mp3
FILEBUF buffer size 34816 bytes
~030a=1
~030a=2
~030a=3
[... until I push 'Q' ...]
~030a=242
~010b=1
S:>
Could you try repeating with my configuration? If you still have failures, it might be an electrical issue. At least that's what your error messages look like. Could you try with several USB sticks?

Kind regards,
- Henrik
Good signatures never die. They just fade away.

Post Reply

Who is online

Users browsing this forum: No registered users