Boot mode Runlevels question

Designing hardware and software for systems that use the VS1010 MP3 Audio DSP Microcontroller.
Post Reply
MikeG
User
Posts: 8
Joined: Fri 2018-08-03 17:27

Boot mode Runlevels question

Post by MikeG » Thu 2018-09-06 20:29

Hi,
Extreme newbie question. Can you explain the runlevels in a little bit more detail than is in the data sheet? What I am wondering is what is the basic chip functionality for each level without adding additional code. So, as an example, in Normal Player mode, can I connect the USB cable and drag my audio files into the SPI Flash and then play them? Or do I need to write some code to be able to do this? Just a bit more detail on the run levels please.
Thanks,
Mike

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

Re: Boot mode Runlevels question

Post by Panu » Fri 2018-09-07 10:19

Hi!

That's a good idea, although it's probably quite a lot of work to write. But in a nutshell...

Basically the ROM runlevels are mostly meant for software development and uploading firmware to a VS1010 board. For example, the SD card and MMC card reader modes (modes 2 and 14) are meant for uploading firmware to the SD card (or data content, especially in the factory). Mode 1 is for bootstrapping devices without any external memory. Mode 4 is for uploading firmware to SPI flash. Mode 8 is for getting a command line prompt to the USB connector (UART command prompt can be invoked in almost all of the modes just by pressing Enter on a terminal). Then there are the USB audio modes and USB serial port modes, all basically meant to get a quick start with a project with some basic functionality so you can do first tests with PCBs before making the "final" end product software. The ROM runlevels may be useful in many ways, such as when there's another main controller in the system and the VS1010 is just a slave to that MCU, but they're not really meant for end user operation when there is just a VS1010. For example, USB suspend is not included in any of the ROM modes. Or any kind of power-off or power down.

The "normal player" mode tries to locate and execute firmware uploaded to the board in many ways; from files in SD card or SPI flash. If it doesn't find any firmware, then it plays WAVs and MP3s from the root directory of the SD card and/or SPI flash - again, very useful functionality for testing PCBs and giving first demos of products to customers. But probably not that great for final products - most products for example require some kind of user interface.

So basically you need some kind custom firmware for most end products. But it's not all that difficult, we've got a lot of pieces software already ready for the VS1010. Software that you can combine to make the product you need. VS1010 is built around the idea that you have several small programs that the VS1010 can run, and then return, and then run other programs. For example you can have a small program that detects if a PC is connected to the USB port. If it is, then it shows the SD card to that PC. And when the PC detachs or "safely removes" the drive, then the software also exits and then you can do something different. You can build the operation of your final product piece by piece and the ROM runlevels' functionality allows you to upload programs and test your product until it's ready to be released.

Just tell us what you need, we'll help you to get your product done.

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

MikeG
User
Posts: 8
Joined: Fri 2018-08-03 17:27

Re: Boot mode Runlevels question

Post by MikeG » Mon 2018-09-10 20:32

Hi Panu,

Thanks for the explanation.

A little background. I have been put on to a project that had been started a bit over a year ago, I am not the original designer. The original idea was to take the VS1000 Adafruit Audio FX Board design and combine it with a couple other designs and flash the Adafruit image that is already written to the VS1000. So, by the time I was put on the project it had sat for over a year. The engineer who designed it couldn't get the board working and has gone on to something else. I was able to get the board operational, barely, but was not able to get the Adafruit image to run. I was able to get a demo image from the VLSI website to run, vs1000b_25X16_spiflash_usb_player.img. And also the UART controlled player sort of ran.

While I was doing some research for the VS1000, I came across another thread in which you explained that the VS1010 may be a better option for several reasons. So, I decided to change things up and redesign our project using the VS1010.

So, what am I trying to design? I need a system that will play pre recorded audio files that get selected by the gpio pins. The audio files would be stored in Flash memory or SD card. New audio files may be added by using the USB connection, drag and drop in file explorer, etc or through the SD card. That is our basic functionality. Down the road, we may want to use a microphone. Nothing really all that complex.

Myself, I am more of a hardware engineer and have experience with microcontrollers and fpga's as far a writing code goes.

Here is my understanding at this point:

The VS1010 may have some of the basic functionality that I need for our project already built in to the ROM. Such as the capability to see the SPI Flash through the USB Port as a FAT drive and load files to the flash. It also has the ability to play files from the SPI Flash or the SD card.

The code I would need to write would be for the gpio control of which audio file gets played.

Really, very basic to start with. We may get into more complexity as our system matures.

Do I understand things correctly at this point? If not please point me in the right direction.

Thanks for your help,
Mike

Hannu
Senior User
Posts: 40
Joined: Mon 2016-05-30 11:54

Re: Boot mode Runlevels question

Post by Hannu » Tue 2018-09-11 7:55

Hello!

A quickie morning coffee program. This is just a demo. You could write real player application and most of the stuff is on the rom. And executing your own programs is possible and so on...

Here's the output of my program. I ran it while keeping the button pressed.

Code: Select all

VS1010>btnplay

VS1010>btnplay
D: SD/SD Card
F: SPI Flash ffff
I: STREAM
R: ROMDISK
S: SD/SD Card

VS1010>btnplay
B0 pushed.
VS1010>
And here's the code.

Code: Select all

/// \file main.c VS1010C VSOS Executable main file
/// This is a starting point for developing VS1010C DLX libraries and executables

#include <vo_stdio.h>
#include <volink.h>     // Linker directives like DLLENTRY
#include <apploader.h>  // RunLibraryFunction etc
#include <vs1010bRom.h>
#include <vo_gpio.h>
#include <vs1010b.h>
#include <playerinfo.h>
#include <string.h>
#include <protocol.h>
#include <spitv.h>
#include <lcd.h>

u_int16 buttons[] = {
	0x1c, //B0 GPIO1_12
	0x1d, //B1 GPIO1_13
	0x10, //B2 GPIO1_0
/*
	//Something triggers my B3 button...
	0x12  //B3 GPIO1_2
*/
};
ioresult main (char *params) {
	u_int16 i, val;
	
	for (i = 0; i < sizeof(buttons)/sizeof(buttons[0]); i++) {
		GpioSetAsInput(buttons[i]);
	}
	for (i = 0; i < sizeof(buttons)/sizeof(buttons[0]); i++) {
		val = GpioReadPin(buttons[i]);
		if (val) { //Skip rest if button high
			continue;
		}
		switch (i) {
			case 0:
			RunLib("echo", "B0 pushed."); //Your another program
			break;
			case 1:
			//PlayFiles("D:music/push1.mp3");
			RunLib("devices", "");
			break;
			default:
			printf("Lazy engineer didn't implement everything for %x\n", i);
		}
	}
	return S_OK;
}


MikeG
User
Posts: 8
Joined: Fri 2018-08-03 17:27

Re: Boot mode Runlevels question

Post by MikeG » Fri 2018-09-14 17:37

Thanks Hannu,
I just got back from a few days of vacation. I'll look at this as soon as I get a chance. Lots to catch up on for just a few days away.
Mike

Post Reply