lunedì 30 luglio 2012

Mp3 Player with scrolling menu from scratch (Beatstream 2.0)


Developed by Gian Marco Iodice
Electronic engineering student at University of Pisa (Italy)

For any question contact me:
g.iodice10@gmail.com


The Beatstream 2.0 is the update of "Beatstream" project. The first version was created in June 2011 and concerned the development of “wav audio player” with STM32 (STM) MCU without O.S.. Since the the pins associated to DAC was already used by LCD on the board, I decided to implement a software DAC with PWM peripheral at 10 bit resolution. Also, for the oldest version of Beatstream, I created:

  1. GUI (with drag finger scroll) - This GUI was not portable to other platform 
  2. Library to decode wav file
  3. Driver for resistive touch screen (GetCoordinate(), Calibration()...)
  4. Driver for SDcard - I used FATFS module by elm-chan to manipulate file (open, read, write file)

The new version of Beatstream started in Junuary 2012 in parallel with the development of "Gooey" Lib.
Gooey is a computer graphics library for embedded syystem written in C and completely separated from I/O layer to guarantee the easy portability on any architecture. It was written from scratch with low level approach and it can be incorporated into low cost MCU without O.S. or used under Linux or Windows environment, enabling optional support of SDL library. Contains a collection of functions and data structures that covering the main features of a basic computer graphics and computer vision. The name of this library it was inspired by pronunciation of GUI but is not only a graphic user interface but a set of modules, such as GUI, that helps the user to cover a lot of application in the world of computer graphics and computer vision.
The library is LCD resolution indipendent and works only with 16 bit (RGB565) pixel depth.
It is composed by these modules:



  1. GUI - Allows support for scrollable-menu, list of file and widget such as progress bar, scrollbar
  2. Image processing - Allows to have a set of functions for most image-processing techniques that involve treating the image in two-dimensional. It is under construction
  3. Image decompressor - At this moment support only Bmp and Jpeg format and it is under profiling

The programmer, with some pre-processor directive, can decide which modules and which components of this compile.






The lib Gooey support Antialias Font.
Gooey is used with Beatstream 2.0. In the new version of audio player, also, it was included Mp3 and Wma decoder. The new mp3 player works WITHOUT O.S., and it was developed with the same board of first version.





 



The MP3 player was developed with:

1. STM32F1x microcontroller with ARM cortex M3 core. The microcontroller works with 72 MHz and has 512 Kbyte of Program Memory and 64 Kbyte of Data Ram

2. ILI9325 as LCD controller

3. TSC2046 as touchscreen controller. The controller works with SPI protocol

4. VS1003 as co-processor to decode audio files

Some peripherals of microcontroller are: 

1. PWM

2. Timer

3. Flexible static memory to interface Flash, SRAM, PSRAM, NOR and NAND memories. This is used to interface ILI9325

4. Serial data interface as SPI, I2C, UART..

5. 12 bit DAC/ADC

6. SDIO to interface microsd, SDcard

7. ...











Some features of Gooey are:


  1. Intuitive APIs for C language 
  2. Optional support for SDL library under Windows or Linux O.S.
  3. Platform independent and then easy to port to other platforms
  4. Support for Frame Buffer or External display controller
  5. Draw geometric primitive as line, point, circle, rectangle.. and print string, with different font and color, and image
  6. Support Antialias Font
  7. Clip of Image or geometric primitive in particular display area 
  8. Image's animation (similar to Powerpoint animation). You can configure a type (fade, bounce, fly, slide...) and anchor's point of animation
  9. Chroma key support 
  10. Widget (Scrollbar, Progressbar...) 
  11. Create menu or items list with only 4 functions. There are 2 different menus: “Scrollable” and “Simply”. The first is perfect for touchscreen or pointing devices and is based on “Gooey scrolling”. This is composed by click (or touch) & drag scrolling with an additional movement after the finger is lifted off the screen. The movement, after lifted off the screen, is based on how fast the finger was dragged on the screen. The duration, speed and deceleration are customizable with some pre-processor defines. The scrolling works with the same timing on different machine. In this mode you can have the same reactivity independently of the performance of system. However the smooth of animation increases with the increase of computational capabilities. Below link to video that show “Gooey scrolling” on Ubuntu with the support of SDL library. The second menu can be use with system based on keyboard or infrared remote.




Antialias Disable (16 bit depth)

Antialias Enable (16 bit depth)


Since the GUI is completely separated from I/O layer, it requires the following functions provided by user. 

1. EXTAPI_Delayms(); // delay millisecond 

2. EXTAPI_CheckTouch(); // check touch display 

3. EXTAPI_GetCoordinate(); // return the coordinate of touch 

4. EXTAPI_CheckButtonPress(); // check button press 

5. EXTAPI_GetButtonPress(); //return button press 

6. EXTAPI_StartTime(); // start millisecond timer 

7. EXTAPI_StopTime(); // stop millisecond timer 

8. EXTAPI_SnapshotTime(); // return value of timer in millisecond



To decode Mp3/Wma files I used an external VLSI (VS1003) co-processor. VS1003 is a single-chip Mp3/Wma/MIDI audio decoder and ADPCM encoder that works with SPI protocol. VS1003 receives its input bitstream through a serial input bus, which it listens to as a system slave and decode it. I have implemented a driver to control this chip.